2021-02-01 11:44:34 +01:00
|
|
|
pipeline {
|
|
|
|
agent { label 'slave' }
|
|
|
|
options { timestamps() }
|
|
|
|
stages {
|
|
|
|
stage('Cleanup') {
|
|
|
|
steps {
|
|
|
|
scmSkip(deleteBuild: true, skipPattern:'.*\\[CI-SKIP\\].*')
|
2021-04-12 17:34:11 +02:00
|
|
|
sh 'git config --global gc.auto 0'
|
2021-02-01 11:44:34 +01:00
|
|
|
sh 'rm -rf ./target'
|
2021-04-12 17:34:11 +02:00
|
|
|
sh 'rm -rf ./Paper/Paper-API ./Paper/Paper-Server ./Paper/work'
|
2021-02-01 11:44:34 +01:00
|
|
|
sh 'rm -rf ./Yatopia-API ./Yatopia-Server'
|
2021-04-12 17:37:38 +02:00
|
|
|
sh 'chmod +x ./gradlew'
|
2021-04-12 17:34:11 +02:00
|
|
|
sh './gradlew clean'
|
2021-02-01 11:44:34 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Init project & submodules') {
|
|
|
|
steps {
|
|
|
|
withMaven(
|
|
|
|
maven: '3',
|
|
|
|
mavenLocalRepo: '.repository',
|
|
|
|
publisherStrategy: 'EXPLICIT',
|
|
|
|
) {
|
|
|
|
sh './gradlew initGitSubmodules'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Decompile & apply patches') {
|
|
|
|
tools {
|
|
|
|
jdk "OpenJDK 8"
|
|
|
|
}
|
|
|
|
steps {
|
|
|
|
withMaven(
|
|
|
|
maven: '3',
|
|
|
|
mavenLocalRepo: '.repository',
|
|
|
|
publisherStrategy: 'EXPLICIT',
|
|
|
|
) {
|
|
|
|
sh '''
|
|
|
|
./gradlew setupUpstream
|
|
|
|
./gradlew applyPatches
|
|
|
|
'''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Build') {
|
|
|
|
tools {
|
|
|
|
jdk "OpenJDK 8"
|
|
|
|
}
|
|
|
|
steps {
|
|
|
|
withMaven(
|
|
|
|
maven: '3',
|
|
|
|
mavenLocalRepo: '.repository',
|
|
|
|
publisherStrategy: 'EXPLICIT'
|
|
|
|
) {
|
|
|
|
withCredentials([usernamePassword(credentialsId: 'jenkins-deploy', usernameVariable: 'ORG_GRADLE_PROJECT_mavenUsername', passwordVariable: 'ORG_GRADLE_PROJECT_mavenPassword')]) {
|
|
|
|
sh '''
|
2021-04-12 17:34:11 +02:00
|
|
|
./gradlew build publish
|
2021-02-01 11:44:34 +01:00
|
|
|
mkdir -p "./target"
|
|
|
|
basedir=$(pwd)
|
|
|
|
paperworkdir="$basedir/Paper/work"
|
|
|
|
mcver=$(cat "$paperworkdir/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4)
|
2021-04-07 05:23:14 +02:00
|
|
|
|
2021-04-07 05:16:51 +02:00
|
|
|
patchedJarPath="$basedir/Yatopia-Server/build/libs/yatopia-server-$mcver-R0.1-SNAPSHOT.jar"
|
|
|
|
vanillaJarPath="$paperworkdir/Minecraft/$mcver/$mcver.jar"
|
2021-04-07 05:23:14 +02:00
|
|
|
|
|
|
|
cd "$paperworkdir/Paperclip"
|
|
|
|
mvn -T 2C clean package -Dmcver="$mcver" -Dpaperjar="$patchedJarPath" -Dvanillajar="$vanillaJarPath" -Dstyle.color=never
|
|
|
|
cd "$basedir"
|
|
|
|
|
2021-04-07 05:16:51 +02:00
|
|
|
cp -v "$paperworkdir/Paperclip/assembly/target/paperclip-$mcver.jar" "./target/yatopia-$mcver-paperclip-b$BUILD_NUMBER.jar"
|
2021-02-01 11:44:34 +01:00
|
|
|
'''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-04-12 17:39:49 +02:00
|
|
|
}
|
2021-04-12 17:34:11 +02:00
|
|
|
|
2021-04-12 17:58:23 +02:00
|
|
|
stage('Archive Jars') {
|
|
|
|
steps {
|
|
|
|
archiveArtifacts(artifacts: 'target/*.jar', fingerprint: true)
|
|
|
|
}
|
|
|
|
post {
|
|
|
|
always {
|
|
|
|
cleanWs()
|
2021-02-01 11:44:34 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|