Stephan Herrmann | 9a98101 | 2017-01-01 11:05:54 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | #******************************************************************************* |
| 3 | # Copyright (c) 2016 GK Software AG and others. |
| 4 | # All rights reserved. This program and the accompanying materials |
| 5 | # are made available under the terms of the Eclipse Public License v1.0 |
| 6 | # which accompanies this distribution, and is available at |
| 7 | # http://www.eclipse.org/legal/epl-v10.html |
| 8 | # |
| 9 | # Contributors: |
| 10 | # Stephan Herrmann - initial API and implementation |
| 11 | #******************************************************************************** |
| 12 | |
| 13 | REPO_BASE=${WORKSPACE}/../../CBIaggregator/workspace |
| 14 | REPO=${REPO_BASE}/repo-${REPO_ID} |
| 15 | JDT=org/eclipse/jdt |
| 16 | |
Stephan Herrmann | 558b380 | 2017-10-17 13:59:03 +0200 | [diff] [blame] | 17 | # load versions from the baseline (to avoid illegal double-upload): |
| 18 | source ${WORKSPACE}/baseline.txt |
| 19 | |
Stephan Herrmann | 9a98101 | 2017-01-01 11:05:54 +0100 | [diff] [blame] | 20 | if [ ! -d ${REPO} ] |
| 21 | then |
| 22 | echo "No repo at ${REPO}" |
| 23 | exit 1 |
| 24 | fi |
| 25 | |
| 26 | echo "==== Copy artifacts from ${REPO}/${JDT} ====" |
| 27 | |
Stephan Herrmann | c051f1d | 2017-03-05 15:52:41 +0100 | [diff] [blame] | 28 | if [ -d ${JDT} ] |
| 29 | then |
| 30 | /bin/rm -r ${JDT}/* |
| 31 | else |
| 32 | mkdir -p ${JDT} |
| 33 | fi |
Stephan Herrmann | 9a98101 | 2017-01-01 11:05:54 +0100 | [diff] [blame] | 34 | cp -r ${REPO}/${JDT}/* ${JDT}/ |
| 35 | |
| 36 | |
| 37 | echo "==== UPLOAD ====" |
| 38 | |
| 39 | URL=https://oss.sonatype.org/service/local/staging/deploy/maven2/ |
| 40 | REPO=ossrh |
| 41 | SETTINGS=/opt/public/hipp/homes/genie.releng/.m2/settings-deploy-ossrh-jdt.xml |
| 42 | MVN=/shared/common/apache-maven-latest/bin/mvn |
| 43 | |
| 44 | /bin/mkdir .log |
| 45 | |
Stephan Herrmann | 558b380 | 2017-10-17 13:59:03 +0200 | [diff] [blame] | 46 | function same_as_baseline() { |
| 47 | simple=`basename $1` |
| 48 | name=`echo $simple | sed -e "s|\(.*\)-.*|\1|" | tr '.' '_'` |
| 49 | version=`echo $simple | sed -e "s|.*-\(.*\).pom|\1|"` |
Stephan Herrmann | d734c99 | 2018-07-12 22:20:05 +0200 | [diff] [blame] | 50 | base_versions=`eval echo \\${VERSION_$name}` |
| 51 | if [ -n $base_versions ] |
Stephan Herrmann | 558b380 | 2017-10-17 13:59:03 +0200 | [diff] [blame] | 52 | then |
Stephan Herrmann | d734c99 | 2018-07-12 22:20:05 +0200 | [diff] [blame] | 53 | local base_single |
| 54 | while read -d "," base_single |
| 55 | do |
| 56 | if [ $base_single == $version ]; then |
| 57 | return 0 |
| 58 | fi |
| 59 | done <<< "$base_versions" |
| 60 | if [ $base_single == $version ]; then |
| 61 | return 0 |
| 62 | fi |
Stephan Herrmann | 558b380 | 2017-10-17 13:59:03 +0200 | [diff] [blame] | 63 | else |
Stephan Herrmann | d734c99 | 2018-07-12 22:20:05 +0200 | [diff] [blame] | 64 | echo "Plug-in ${name}: ${version} seems to be new" |
Stephan Herrmann | 558b380 | 2017-10-17 13:59:03 +0200 | [diff] [blame] | 65 | return 1 |
| 66 | fi |
Stephan Herrmann | d734c99 | 2018-07-12 22:20:05 +0200 | [diff] [blame] | 67 | echo "different versions for ${name}: ${version} is not in ${base_versions}" |
| 68 | return 1 |
Stephan Herrmann | 558b380 | 2017-10-17 13:59:03 +0200 | [diff] [blame] | 69 | } |
| 70 | |
Stephan Herrmann | e2be439 | 2018-10-30 21:23:17 +0100 | [diff] [blame] | 71 | for pomFile in org/eclipse/jdt/*/*/*.pom |
Stephan Herrmann | 9a98101 | 2017-01-01 11:05:54 +0100 | [diff] [blame] | 72 | do |
Stephan Herrmann | 558b380 | 2017-10-17 13:59:03 +0200 | [diff] [blame] | 73 | if same_as_baseline $pomFile |
| 74 | then |
| 75 | echo "Skipping file $pomFile which is already present in the baseline" |
| 76 | else |
| 77 | file=`echo $pomFile | sed -e "s|\(.*\)\.pom|\1.jar|"` |
| 78 | sourcesFile=`echo $pomFile | sed -e "s|\(.*\)\.pom|\1-sources.jar|"` |
| 79 | javadocFile=`echo $pomFile | sed -e "s|\(.*\)\.pom|\1-javadoc.jar|"` |
| 80 | |
| 81 | echo "${MVN} -f jdt-pom.xml -s ${SETTINGS} gpg:sign-and-deploy-file -Durl=${URL} -DrepositoryId=${REPO} -Dfile=${file} -DpomFile=${pomFile}" |
| 82 | |
| 83 | ${MVN} -f jdt-pom.xml -s ${SETTINGS} gpg:sign-and-deploy-file \ |
| 84 | -Durl=${URL} -DrepositoryId=${REPO} \ |
| 85 | -Dfile=${file} -DpomFile=${pomFile} \ |
| 86 | >> .log/artifact-upload.txt |
| 87 | |
| 88 | echo -e "\t${sourcesFile}" |
| 89 | ${MVN} -f jdt-pom.xml -s ${SETTINGS} gpg:sign-and-deploy-file \ |
| 90 | -Durl=${URL} -DrepositoryId=${REPO} \ |
| 91 | -Dfile=${sourcesFile} -DpomFile=${pomFile} -Dclassifier=sources \ |
| 92 | >> .log/sources-upload.txt |
| 93 | |
| 94 | echo -e "\t${javadocFile}" |
| 95 | ${MVN} -f jdt-pom.xml -s ${SETTINGS} gpg:sign-and-deploy-file \ |
| 96 | -Durl=${URL} -DrepositoryId=${REPO} \ |
| 97 | -Dfile=${javadocFile} -DpomFile=${pomFile} -Dclassifier=javadoc \ |
| 98 | >> .log/javadoc-upload.txt |
| 99 | fi |
Stephan Herrmann | 9a98101 | 2017-01-01 11:05:54 +0100 | [diff] [blame] | 100 | done |
| 101 | |
| 102 | /bin/ls -la .log |
| 103 | |
| 104 | /bin/grep -i fail .log/* |
| 105 | |