blob: 5044500b3ce7fe2e0e39bcb59d9396719e1fa9ed [file] [log] [blame]
pipeline {
agent { label 'migration' }
options {
buildDiscarder(logRotator(numToKeepStr: '10'))
disableConcurrentBuilds()
}
tools {
maven 'apache-maven-latest'
jdk 'openjdk-jdk14-latest'
}
parameters {
string(
name: 'URL',
defaultValue: '',
description: """${pretty(
'''
The script will run but will do nothing other than updating the parameter definitions of the job as a side-effect.
Enter the URL of a simple repository or a product *.tar.gz to analyze all the modules dependencies of that repository or product.
<br>
E.g., https://download.eclipse.org/staging/2020-06 or https://download.eclipse.org/oomph/epp/2020-06/R/eclipse-inst-linux64.tar.gz
'''
)}""")
}
environment {
JUSTJ_STORAGE_LOCATION = '/home/data/httpd/download.eclipse.org/justj'
}
stages {
stage('Download Jars') {
steps {
script {
if (params.URL != "" && !params.URL.startsWith("https://download.eclipse.org/")) {
error("Only repositories or products located at https://download.eclipse.org/ are supported.")
} else {
env.REPORT_BASE_LOCATION = "jdeps"
if (params.URL == "") {
echo "Only rebuilding the index."
} else {
env.LOCATION = "/home/data/httpd/" + params.URL.replace("https:/", "")
env.REPORT_LOCATION = params.URL.replace("https://download.eclipse.org/", "")
echo "Using repository ${env.LOCATION}"
}
sh '''
mkdir -p org/eclipse/justj/codegen/templates/jdeps/
cd org/eclipse/justj/codegen/templates/jdeps/
curl -O https://git.eclipse.org/c/justj/justj.tools.git/plain/plugins/org.eclipse.justj.codegen/src/org/eclipse/justj/codegen/templates/jdeps/JdepsIndex.java
cd -
javac org/eclipse/justj/codegen/templates/jdeps/JdepsIndex.java
'''
sshagent(['projects-storage.eclipse.org-bot-ssh']) {
script {
if (params.URL != "") {
sh '''
if [[ "$LOCATION" == *.tar.gz ]]; then
rsync -avsh "genie.justj@projects-storage.eclipse.org:$LOCATION" .
tar -xf $(basename $LOCATION)
mv */plugins plugins
rm plugins/*.source_* || true
else
mkdir plugins
rsync -avsh --exclude '*.source_*' "genie.justj@projects-storage.eclipse.org:$LOCATION/plugins/*.jar" plugins/
fi
cd plugins
for plugin in *.jar; do
jdeps --ignore-missing-deps --multi-release 14 --print-module-deps $plugin > $plugin-out-deps 2> $plugin-error-deps || true
if [[ $(wc -w < $plugin-error-deps) == 0 ]]; then
rm $plugin-error-deps
else
cat $plugin-error-deps
fi
cat $plugin-out-deps
done
java -cp .. org.eclipse.justj.codegen.templates.jdeps.JdepsIndex . $URL
ssh genie.justj@projects-storage.eclipse.org "mkdir -p $JUSTJ_STORAGE_LOCATION/$REPORT_BASE_LOCATION/$REPORT_LOCATION"
scp index.html justj.modules genie.justj@projects-storage.eclipse.org:$JUSTJ_STORAGE_LOCATION/$REPORT_BASE_LOCATION/$REPORT_LOCATION
'''
}
}
// Build the index.
sh '''
mkdir -p $REPORT_BASE_LOCATION
cd $REPORT_BASE_LOCATION
rsync -avsh "genie.justj@projects-storage.eclipse.org:$JUSTJ_STORAGE_LOCATION/$REPORT_BASE_LOCATION/" .
java -cp .. org.eclipse.justj.codegen.templates.jdeps.JdepsIndex -index .
rsync -avsh . "genie.justj@projects-storage.eclipse.org:$JUSTJ_STORAGE_LOCATION/$REPORT_BASE_LOCATION"
'''
script {
if (params.URL != "") {
dir('plugins') {
archiveArtifacts '*-deps,index.html,justj.modules'
}
} else {
dir(env.REPORT_BASE_LOCATION) {
archiveArtifacts 'index.html,justj.modules'
}
}
}
}
}
}
}
}
}
}
def pretty(string) {
return string.replaceAll("^\r?\n", "").replaceAll("\r?\n\$", "").replace("\r", "").stripIndent()
}