blob: bfec1630859dcd394fb8eaa1282907b06ebe0ce8 [file] [log] [blame]
Stephan Herrmann9a981012017-01-01 11:05:54 +01001#!/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
13REPO_BASE=${WORKSPACE}/../../CBIaggregator/workspace
14REPO=${REPO_BASE}/repo-${REPO_ID}
15JDT=org/eclipse/jdt
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 Herrmann9a981012017-01-01 11:05:54 +010020if [ ! -d ${REPO} ]
21then
22 echo "No repo at ${REPO}"
23 exit 1
24fi
25
26echo "==== Copy artifacts from ${REPO}/${JDT} ===="
27
Stephan Herrmannc051f1d2017-03-05 15:52:41 +010028if [ -d ${JDT} ]
29then
30 /bin/rm -r ${JDT}/*
31else
32 mkdir -p ${JDT}
33fi
Stephan Herrmann9a981012017-01-01 11:05:54 +010034cp -r ${REPO}/${JDT}/* ${JDT}/
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-jdt.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 Herrmanne95849c2017-10-17 20:46:47 +020050 base_version=`eval echo \\${VERSION_$name}`
Stephan Herrmannb4abe3d2017-10-17 20:47:29 +020051 if [[ $base_version =~ $version ]]
Stephan Herrmann558b3802017-10-17 13:59:03 +020052 then
53 return 0
54 else
Stephan Herrmanne95849c2017-10-17 20:46:47 +020055 echo "different versions for ${name}: ${version} is not in ${base_version}"
Stephan Herrmann558b3802017-10-17 13:59:03 +020056 return 1
57 fi
58}
59
Stephan Herrmann9a981012017-01-01 11:05:54 +010060for pomFile in org/eclipse/jdt/*/*/*.pom
61do
Stephan Herrmann558b3802017-10-17 13:59:03 +020062 if same_as_baseline $pomFile
63 then
64 echo "Skipping file $pomFile which is already present in the baseline"
65 else
66 file=`echo $pomFile | sed -e "s|\(.*\)\.pom|\1.jar|"`
67 sourcesFile=`echo $pomFile | sed -e "s|\(.*\)\.pom|\1-sources.jar|"`
68 javadocFile=`echo $pomFile | sed -e "s|\(.*\)\.pom|\1-javadoc.jar|"`
69
70 echo "${MVN} -f jdt-pom.xml -s ${SETTINGS} gpg:sign-and-deploy-file -Durl=${URL} -DrepositoryId=${REPO} -Dfile=${file} -DpomFile=${pomFile}"
71
72 ${MVN} -f jdt-pom.xml -s ${SETTINGS} gpg:sign-and-deploy-file \
73 -Durl=${URL} -DrepositoryId=${REPO} \
74 -Dfile=${file} -DpomFile=${pomFile} \
75 >> .log/artifact-upload.txt
76
77 echo -e "\t${sourcesFile}"
78 ${MVN} -f jdt-pom.xml -s ${SETTINGS} gpg:sign-and-deploy-file \
79 -Durl=${URL} -DrepositoryId=${REPO} \
80 -Dfile=${sourcesFile} -DpomFile=${pomFile} -Dclassifier=sources \
81 >> .log/sources-upload.txt
82
83 echo -e "\t${javadocFile}"
84 ${MVN} -f jdt-pom.xml -s ${SETTINGS} gpg:sign-and-deploy-file \
85 -Durl=${URL} -DrepositoryId=${REPO} \
86 -Dfile=${javadocFile} -DpomFile=${pomFile} -Dclassifier=javadoc \
87 >> .log/javadoc-upload.txt
88 fi
Stephan Herrmann9a981012017-01-01 11:05:54 +010089done
90
91/bin/ls -la .log
92
93/bin/grep -i fail .log/*
94