Bug 484004: Start publishing Eclipse platform artifacts to Maven central
- polish the main script
- add script/pom for jdt upload
diff --git a/releng/EnrichPoms/CBIaggregator.sh b/releng/EnrichPoms/CBIaggregator.sh
index 4ce3746..39a2485 100644
--- a/releng/EnrichPoms/CBIaggregator.sh
+++ b/releng/EnrichPoms/CBIaggregator.sh
@@ -50,6 +50,11 @@
 	fi
 }
 
+#================================================================================
+#   (1) Install and run the CBI aggregator
+#================================================================================
+echo "==== CBI aggregator ===="
+
 # -------- fetch .aggr file **TEMP** will eventually move to the releng git: ------------
 git archive --remote=file://localhost/gitroot/objectteams/org.eclipse.objectteams.git \
 	master releng/EnrichPoms/SDK4Mvn.aggr \
@@ -57,9 +62,6 @@
 /bin/mv releng/EnrichPoms/SDK4Mvn.aggr ${WORKSPACE}/
 /bin/rmdir -p releng/EnrichPoms
 
-#================================================================================
-#   (1) Install and run the CBI aggregator
-#================================================================================
 if [ ! -d ${LOCAL_TOOLS} ]
 then
 	/bin/mkdir ${LOCAL_TOOLS}
@@ -68,6 +70,7 @@
 if [ ! -x ${ECLIPSE} ]
 then
 	cd ${LOCAL_TOOLS}
+	echo "Extracting Eclipse from ${FILE_ECLIPSE} ..."
 	tar xf ${FILE_ECLIPSE}
 	cd ${WORKSPACE}
 fi
@@ -75,6 +78,7 @@
 
 if [ ! -x ${AGGREGATOR} ]
 then
+	echo "Installing the CBI aggregator into ${LOCAL_TOOLS}/${DIR_AGGREGATOR} ..."
 	${ECLIPSE} -application ${APP_NAME_P2DIRECTOR} \
 		-r ${URL_AGG_UPDATES} \
 		-d ${LOCAL_TOOLS}/${DIR_AGGREGATOR} -p CBIProfile \
@@ -86,6 +90,7 @@
 Repo=${WORKSPACE}/repo-${BUILD_NUMBER}
 /bin/mkdir ${RepoRaw}
 
+echo "Running the aggregator with build model ${FILE_SDK_AGGR} ..."
 ${AGGREGATOR} aggregate --buildModel ${FILE_SDK_AGGR} --action CLEAN_BUILD --buildRoot ${RepoRaw}
 if [ "$?" != "0" ]
 then
@@ -159,9 +164,11 @@
 		cd ${1}
 		# expect only one sub-directory, starting with a digit, plus maven-metadata.xml*:
 		other=`ls -d [!0-9]* 2> /dev/null`
-        if `echo "${other}" | egrep "^maven-metadata.xml\s*maven-metadata.xml.md5\s*maven-metadata.xml.sha1$"`
+        if `echo "${other}" | tr "\n" " " | egrep "^maven-metadata.xml maven-metadata.xml.md5 maven-metadata.xml.sha1 \$"`
         then
-        	exit 1
+        	; # clean -> proceed below
+        else
+        	exit 1 # unexpected content found, don't remove
         fi
         # scan all *.pom inside the version sub-directory
         r=1
@@ -275,7 +282,9 @@
 # - dynamic content (retrieved mostly from MANIFEST.MF):
 #   - name
 #   - url
-#   - scm connection and tag
+#   - scm connection, tag and url
+# - semi dynamic
+#   - developers (based on static map git-repo-base -> project leads)
 # - static content
 #   - license
 #   - organization
@@ -305,7 +314,7 @@
         updateCheckSums ${pom}
 done
 
-echo "==== Add Javadoc Stubs ===="
+echo "==== Add Javadoc stubs ===="
 
 # (groupSimpleName, javadocArtifactGA)
 function createJavadocs() {
diff --git a/releng/EnrichPoms/jdt-pom.xml b/releng/EnrichPoms/jdt-pom.xml
new file mode 100644
index 0000000..9b4e90f
--- /dev/null
+++ b/releng/EnrichPoms/jdt-pom.xml
@@ -0,0 +1,47 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.eclipse.cbi</groupId>
+  <artifactId>org.eclipse.jdt.publish2maven</artifactId>
+  <version>0.0.1-SNAPSHOT</version>
+  <packaging>pom</packaging>
+  
+  <properties>
+  	<gpg.key.id>B414F87E</gpg.key.id>
+  </properties>
+
+  <distributionManagement>
+    <snapshotRepository>
+      <id>ossrh</id>
+      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
+    </snapshotRepository>
+  </distributionManagement>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-gpg-plugin</artifactId>
+        <version>1.6</version>
+        <configuration>
+          <gpgArguments>
+            <arg>--default-key</arg>
+            <arg>${gpg.key.id}</arg>
+          </gpgArguments>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.sonatype.plugins</groupId>
+        <artifactId>nexus-staging-maven-plugin</artifactId>
+        <version>1.1</version>
+        <extensions>true</extensions>
+        <configuration>
+        <!-- The Base URL of Nexus instance where we want to stage -->
+          <nexusUrl>https://oss.sonatype.org/service/local/staging/deploy/maven2/</nexusUrl>
+          <!-- The server "id" element from settings to use authentication from -->
+          <serverId>ossrh</serverId>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/releng/EnrichPoms/publishJDT.sh b/releng/EnrichPoms/publishJDT.sh
new file mode 100644
index 0000000..58d0e7c
--- /dev/null
+++ b/releng/EnrichPoms/publishJDT.sh
@@ -0,0 +1,68 @@
+#!/bin/sh
+#*******************************************************************************
+# Copyright (c) 2016 GK Software AG and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#     Stephan Herrmann - initial API and implementation
+#********************************************************************************
+
+REPO_BASE=${WORKSPACE}/../../CBIaggregator/workspace
+REPO=${REPO_BASE}/repo-${REPO_ID}
+JDT=org/eclipse/jdt
+
+if [ ! -d ${REPO} ]
+then
+	echo "No repo at ${REPO}"
+	exit 1
+fi
+
+echo "==== Copy artifacts from ${REPO}/${JDT} ===="
+
+mkdir -p ${JDT}
+cp -r ${REPO}/${JDT}/* ${JDT}/
+
+
+echo "==== UPLOAD ===="
+
+URL=https://oss.sonatype.org/service/local/staging/deploy/maven2/
+REPO=ossrh
+SETTINGS=/opt/public/hipp/homes/genie.releng/.m2/settings-deploy-ossrh-jdt.xml
+MVN=/shared/common/apache-maven-latest/bin/mvn
+
+/bin/mkdir .log
+
+for pomFile in org/eclipse/jdt/*/*/*.pom
+do
+  file=`echo $pomFile | sed -e "s|\(.*\)\.pom|\1.jar|"`
+  sourcesFile=`echo $pomFile | sed -e "s|\(.*\)\.pom|\1-sources.jar|"`
+  javadocFile=`echo $pomFile | sed -e "s|\(.*\)\.pom|\1-javadoc.jar|"`
+
+  echo "${MVN} -f jdt-pom.xml -s ${SETTINGS} gpg:sign-and-deploy-file -Durl=${URL} -DrepositoryId=${REPO} -Dfile=${file} -DpomFile=${pomFile}"
+  
+  ${MVN} -f jdt-pom.xml -s ${SETTINGS} gpg:sign-and-deploy-file \
+     -Durl=${URL} -DrepositoryId=${REPO} \
+     -Dfile=${file} -DpomFile=${pomFile} \
+     >> .log/artifact-upload.txt
+     
+  echo -e "\t${sourcesFile}"
+  ${MVN} -f jdt-pom.xml -s ${SETTINGS} gpg:sign-and-deploy-file \
+     -Durl=${URL} -DrepositoryId=${REPO} \
+     -Dfile=${sourcesFile} -DpomFile=${pomFile} -Dclassifier=sources \
+     >> .log/sources-upload.txt
+  
+  echo -e "\t${javadocFile}"
+  ${MVN} -f jdt-pom.xml -s ${SETTINGS} gpg:sign-and-deploy-file \
+     -Durl=${URL} -DrepositoryId=${REPO} \
+     -Dfile=${javadocFile} -DpomFile=${pomFile} -Dclassifier=javadoc \
+     >> .log/javadoc-upload.txt
+
+done
+
+/bin/ls -la .log
+
+/bin/grep -i fail .log/*
+