blob: 9e1cd127fb664f1103436d1f77e9461fe589f3bc [file] [log] [blame]
Stephan Herrmann068180a2017-01-01 23:32:19 +01001#!/bin/sh
2#*******************************************************************************
3# Copyright (c) 2017 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
13REPO_BASE=${WORKSPACE}/../../CBIaggregator/workspace
14REPO=${REPO_BASE}/repo-${REPO_ID}
15PDE=org/eclipse/pde
16
Stephan Herrmann558b3802017-10-17 13:59:03 +020017# load versions from the baseline (to avoid illegal double-upload):
18source ${WORKSPACE}/baseline.txt
19
Stephan Herrmann068180a2017-01-01 23:32:19 +010020if [ ! -d ${REPO} ]
21then
22 echo "No repo at ${REPO}"
23 exit 1
24fi
25
26echo "==== Copy artifacts from ${REPO}/${PDE} ===="
27
Stephan Herrmannc051f1d2017-03-05 15:52:41 +010028if [ -d ${PDE} ]
29then
30 /bin/rm -r ${PDE}/*
31else
32 mkdir -p ${PDE}
33fi
Stephan Herrmann068180a2017-01-01 23:32:19 +010034cp -r ${REPO}/${PDE}/* ${PDE}/
35
36
37echo "==== UPLOAD ===="
38
39URL=https://oss.sonatype.org/service/local/staging/deploy/maven2/
40REPO=ossrh
41SETTINGS=/opt/public/hipp/homes/genie.releng/.m2/settings-deploy-ossrh-pde.xml
42MVN=/shared/common/apache-maven-latest/bin/mvn
43
44/bin/mkdir .log
45
Stephan Herrmann558b3802017-10-17 13:59:03 +020046function 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 Herrmannd734c992018-07-12 22:20:05 +020050 base_versions=`eval echo \\${VERSION_$name}`
51 if [ -n $base_versions ]
Stephan Herrmann558b3802017-10-17 13:59:03 +020052 then
Stephan Herrmannd734c992018-07-12 22:20:05 +020053 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 Herrmann558b3802017-10-17 13:59:03 +020063 else
Stephan Herrmannd734c992018-07-12 22:20:05 +020064 echo "Plug-in ${name}: ${version} seems to be new"
Stephan Herrmann558b3802017-10-17 13:59:03 +020065 return 1
66 fi
Stephan Herrmannd734c992018-07-12 22:20:05 +020067 echo "different versions for ${name}: ${version} is not in ${base_versions}"
68 return 1
Stephan Herrmann558b3802017-10-17 13:59:03 +020069}
70
Stephan Herrmann068180a2017-01-01 23:32:19 +010071for pomFile in org/eclipse/pde/*/*/*.pom
72do
Stephan Herrmann558b3802017-10-17 13:59:03 +020073 if same_as_baseline $pomFile
74 then
Stephan Herrmann33e8ee02017-11-18 20:55:02 +010075 echo "Skipping file $pomFile which is already present in the baseline"
Stephan Herrmann558b3802017-10-17 13:59:03 +020076 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 pde-pom.xml -s ${SETTINGS} gpg:sign-and-deploy-file -Durl=${URL} -DrepositoryId=${REPO} -Dfile=${file} -DpomFile=${pomFile}"
82
Stephan Herrmann33e8ee02017-11-18 20:55:02 +010083 ${MVN} -f pde-pom.xml -s ${SETTINGS} gpg:sign-and-deploy-file \
Stephan Herrmann558b3802017-10-17 13:59:03 +020084 -Durl=${URL} -DrepositoryId=${REPO} \
85 -Dfile=${file} -DpomFile=${pomFile} \
86 >> .log/artifact-upload.txt
87
88 echo -e "\t${sourcesFile}"
Stephan Herrmann33e8ee02017-11-18 20:55:02 +010089 ${MVN} -f pde-pom.xml -s ${SETTINGS} gpg:sign-and-deploy-file \
Stephan Herrmann558b3802017-10-17 13:59:03 +020090 -Durl=${URL} -DrepositoryId=${REPO} \
91 -Dfile=${sourcesFile} -DpomFile=${pomFile} -Dclassifier=sources \
92 >> .log/sources-upload.txt
93
94 echo -e "\t${javadocFile}"
Stephan Herrmann33e8ee02017-11-18 20:55:02 +010095 ${MVN} -f pde-pom.xml -s ${SETTINGS} gpg:sign-and-deploy-file \
Stephan Herrmann558b3802017-10-17 13:59:03 +020096 -Durl=${URL} -DrepositoryId=${REPO} \
97 -Dfile=${javadocFile} -DpomFile=${pomFile} -Dclassifier=javadoc \
98 >> .log/javadoc-upload.txt
99 fi
Stephan Herrmann068180a2017-01-01 23:32:19 +0100100done
101
102/bin/ls -la .log
103
104/bin/grep -i fail .log/*
105