blob: f8eb330f4b4d5929ae50bd50890dcba3fb4978ab [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: 'REPOSITORY_URL',
defaultValue: 'https://download.eclipse.org/staging/2020-06',
description: '''
Enter the URL of a simple repository to analyze all the modules dependencies of that repository.
''')
}
environment {
JUSTJ_STORAGE_LOCATION = '/home/data/httpd/download.eclipse.org/justj'
}
stages {
stage('Download Jars') {
steps {
script {
if (!params.REPOSITORY_URL.startsWith("https://download.eclipse.org/")) {
error("Only repositories located at https://download.eclipse.org/ are permitted.")
} else {
env.REPOSITORY_LOCATION = "/home/data/httpd/" + params.REPOSITORY_URL.replace("https:/", "")
env.REPOSITORY_REPORT_LOCATION = params.REPOSITORY_URL.replace("https://download.eclipse.org/", "")
echo "Using repository ${env.REPOSITORY_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']) {
sh '''
mkdir plugins
rsync -avsh --exclude '*.source_*' "genie.justj@projects-storage.eclipse.org:$REPOSITORY_LOCATION/plugins/*.jar" plugins/
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 . $REPOSITORY_URL
ssh genie.justj@projects-storage.eclipse.org "mkdir -p $JUSTJ_STORAGE_LOCATION/jdeps/$REPOSITORY_REPORT_LOCATION"
scp index.html justj.modules genie.justj@projects-storage.eclipse.org:$JUSTJ_STORAGE_LOCATION/jdeps/$REPOSITORY_REPORT_LOCATION
'''
// Build the index.
sh '''
mkdir jdeps
cd jdeps
rsync -avsh "genie.justj@projects-storage.eclipse.org:$JUSTJ_STORAGE_LOCATION/jdeps" .
java -cp .. org.eclipse.justj.codegen.templates.jdeps.JdepsIndex -index .
rsync -avsh . "genie.justj@projects-storage.eclipse.org:$JUSTJ_STORAGE_LOCATION/jdeps"
'''
dir('plugins') {
archiveArtifacts '*-deps,index.html,justj.modules'
}
}
}
}
}
}
}
}