From 1e88afae7a7609eec8af9480a270e5f40bbc94ca Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Tue, 6 Apr 2021 21:54:44 -0400 Subject: [PATCH 01/14] test --- build.gradle.kts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index 57ce074c..73c127dc 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,5 @@ +file("Paper").deleteRecursively() + plugins { `java-library` `maven-publish` From 104950c98cb52021b4077717edd39b98fc346dfd Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Tue, 6 Apr 2021 21:54:56 -0400 Subject: [PATCH 02/14] Revert "test" This reverts commit 1e88afae7a7609eec8af9480a270e5f40bbc94ca. --- build.gradle.kts | 2 -- 1 file changed, 2 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 73c127dc..57ce074c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,3 @@ -file("Paper").deleteRecursively() - plugins { `java-library` `maven-publish` From 141861daa3a0f9112989e7848a190380dc429a2e Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Tue, 6 Apr 2021 22:30:04 -0400 Subject: [PATCH 03/14] maven test --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index cd91b073..6b524690 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -51,6 +51,7 @@ pipeline { ) { withCredentials([usernamePassword(credentialsId: 'jenkins-deploy', usernameVariable: 'ORG_GRADLE_PROJECT_mavenUsername', passwordVariable: 'ORG_GRADLE_PROJECT_mavenPassword')]) { sh ''' + mvn --version && exit #for testing purposes, remove later ./gradlew clean build paperclip publish mkdir -p "./target" basedir=$(pwd) From f564431f5a81b2b07db486d8e2d0e5245a668a45 Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Tue, 6 Apr 2021 22:35:23 -0400 Subject: [PATCH 04/14] maven test 2 --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6b524690..38de7229 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -33,6 +33,7 @@ pipeline { publisherStrategy: 'EXPLICIT', ) { sh ''' + whereis mvn && exit ./gradlew setupUpstream ./gradlew applyPatches ''' @@ -51,7 +52,6 @@ pipeline { ) { withCredentials([usernamePassword(credentialsId: 'jenkins-deploy', usernameVariable: 'ORG_GRADLE_PROJECT_mavenUsername', passwordVariable: 'ORG_GRADLE_PROJECT_mavenPassword')]) { sh ''' - mvn --version && exit #for testing purposes, remove later ./gradlew clean build paperclip publish mkdir -p "./target" basedir=$(pwd) From 5e3f7d43c0d269124609c490d68b0d05cd1102a9 Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Tue, 6 Apr 2021 22:39:35 -0400 Subject: [PATCH 05/14] maven test 3 --- Jenkinsfile | 2 +- buildSrc/src/main/kotlin/task/Paperclip.kt | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 38de7229..aa12c411 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -33,7 +33,6 @@ pipeline { publisherStrategy: 'EXPLICIT', ) { sh ''' - whereis mvn && exit ./gradlew setupUpstream ./gradlew applyPatches ''' @@ -52,6 +51,7 @@ pipeline { ) { withCredentials([usernamePassword(credentialsId: 'jenkins-deploy', usernameVariable: 'ORG_GRADLE_PROJECT_mavenUsername', passwordVariable: 'ORG_GRADLE_PROJECT_mavenPassword')]) { sh ''' + chmod +x mvn || true ./gradlew clean build paperclip publish mkdir -p "./target" basedir=$(pwd) diff --git a/buildSrc/src/main/kotlin/task/Paperclip.kt b/buildSrc/src/main/kotlin/task/Paperclip.kt index a9f82332..44c16b09 100644 --- a/buildSrc/src/main/kotlin/task/Paperclip.kt +++ b/buildSrc/src/main/kotlin/task/Paperclip.kt @@ -28,7 +28,10 @@ internal fun Project.createPaperclipTask( "-Dvanillajar=$vanillaJarPath" ) if (System.getProperty("os.name").startsWith("Windows")) paperclipCmd[0] = "mvn.cmd" - if (jenkins) paperclipCmd.add("-Dstyle.color=never") + if (jenkins) { + paperclipCmd.add("-Dstyle.color=never") + paperclipCmd[0] = "./mvn" + } ensureSuccess(cmd(*paperclipCmd.toTypedArray(), dir = paperclipDir, printOut = true)) val paperClip = paperclipDir.resolve("assembly/target/paperclip-${toothpick.minecraftVersion}.jar") val destination = rootProjectDir.resolve(toothpick.calcPaperclipName) From 803b6a4dce0dd636a57de11a65a67f8cac86741a Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Tue, 6 Apr 2021 22:47:52 -0400 Subject: [PATCH 06/14] revert changes (well that didn't work) --- Jenkinsfile | 1 - buildSrc/src/main/kotlin/task/Paperclip.kt | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index aa12c411..cd91b073 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -51,7 +51,6 @@ pipeline { ) { withCredentials([usernamePassword(credentialsId: 'jenkins-deploy', usernameVariable: 'ORG_GRADLE_PROJECT_mavenUsername', passwordVariable: 'ORG_GRADLE_PROJECT_mavenPassword')]) { sh ''' - chmod +x mvn || true ./gradlew clean build paperclip publish mkdir -p "./target" basedir=$(pwd) diff --git a/buildSrc/src/main/kotlin/task/Paperclip.kt b/buildSrc/src/main/kotlin/task/Paperclip.kt index 44c16b09..a9f82332 100644 --- a/buildSrc/src/main/kotlin/task/Paperclip.kt +++ b/buildSrc/src/main/kotlin/task/Paperclip.kt @@ -28,10 +28,7 @@ internal fun Project.createPaperclipTask( "-Dvanillajar=$vanillaJarPath" ) if (System.getProperty("os.name").startsWith("Windows")) paperclipCmd[0] = "mvn.cmd" - if (jenkins) { - paperclipCmd.add("-Dstyle.color=never") - paperclipCmd[0] = "./mvn" - } + if (jenkins) paperclipCmd.add("-Dstyle.color=never") ensureSuccess(cmd(*paperclipCmd.toTypedArray(), dir = paperclipDir, printOut = true)) val paperClip = paperclipDir.resolve("assembly/target/paperclip-${toothpick.minecraftVersion}.jar") val destination = rootProjectDir.resolve(toothpick.calcPaperclipName) From c4b8af3dc4a2fd1ead566c04fe79721ed2415afe Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Tue, 6 Apr 2021 23:16:51 -0400 Subject: [PATCH 07/14] please work... --- Jenkinsfile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index cd91b073..78768080 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -51,12 +51,18 @@ pipeline { ) { withCredentials([usernamePassword(credentialsId: 'jenkins-deploy', usernameVariable: 'ORG_GRADLE_PROJECT_mavenUsername', passwordVariable: 'ORG_GRADLE_PROJECT_mavenPassword')]) { sh ''' - ./gradlew clean build paperclip publish + ./gradlew clean build publish mkdir -p "./target" basedir=$(pwd) paperworkdir="$basedir/Paper/work" mcver=$(cat "$paperworkdir/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4) - cp "yatopia-$mcver-paperclip.jar" "./target/yatopia-$mcver-paperclip-b$BUILD_NUMBER.jar" + patchedJarPath="$basedir/Yatopia-Server/build/libs/yatopia-server-$mcver-R0.1-SNAPSHOT.jar" + vanillaJarPath="$paperworkdir/Minecraft/$mcver/$mcver.jar" + ( + cd "$paperworkdir/Paperclip" + mvn -T 2C clean package -Dmcver="$mcver" -Dpaperjar="$patchedJarPath" -Dvanillajar="$vanillaJarPath" -Dstyle.color=never + ) + cp -v "$paperworkdir/Paperclip/assembly/target/paperclip-$mcver.jar" "./target/yatopia-$mcver-paperclip-b$BUILD_NUMBER.jar" ''' } } From 6ee4e105d70ce46309ead8f4a64e2161f7017c64 Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Tue, 6 Apr 2021 23:23:14 -0400 Subject: [PATCH 08/14] maybe this will work? --- Jenkinsfile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 78768080..0823a8d4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -56,12 +56,14 @@ pipeline { basedir=$(pwd) paperworkdir="$basedir/Paper/work" mcver=$(cat "$paperworkdir/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4) + patchedJarPath="$basedir/Yatopia-Server/build/libs/yatopia-server-$mcver-R0.1-SNAPSHOT.jar" vanillaJarPath="$paperworkdir/Minecraft/$mcver/$mcver.jar" - ( - cd "$paperworkdir/Paperclip" - mvn -T 2C clean package -Dmcver="$mcver" -Dpaperjar="$patchedJarPath" -Dvanillajar="$vanillaJarPath" -Dstyle.color=never - ) + + cd "$paperworkdir/Paperclip" + mvn -T 2C clean package -Dmcver="$mcver" -Dpaperjar="$patchedJarPath" -Dvanillajar="$vanillaJarPath" -Dstyle.color=never + cd "$basedir" + cp -v "$paperworkdir/Paperclip/assembly/target/paperclip-$mcver.jar" "./target/yatopia-$mcver-paperclip-b$BUILD_NUMBER.jar" ''' } From 5f87d326fd13606a6c92ddfd467bfda516473c9e Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Wed, 7 Apr 2021 16:24:56 -0400 Subject: [PATCH 09/14] Create clean_build.yml --- .github/workflows/clean_build.yml | 68 +++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 .github/workflows/clean_build.yml diff --git a/.github/workflows/clean_build.yml b/.github/workflows/clean_build.yml new file mode 100644 index 00000000..fbf23da6 --- /dev/null +++ b/.github/workflows/clean_build.yml @@ -0,0 +1,68 @@ +name: Yatopia Build Script + +on: + push: + paths-ignore: + - '*.md' + - 'Jenkinsfile' + branches: + - ver/1.16.5 + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + java: [15, 11, 8] + fail-fast: false + + steps: + - uses: actions/checkout@v2 + - name: Set up JDK ${{ matrix.java }} + uses: actions/setup-java@v1 + with: + java-version: ${{ matrix.java }} + + - name: Pull Gradle Cache + uses: actions/cache@v2 + id: gradle-cache + with: + path: ~/.gradle + key: ${{ runner.os }}-maven-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}-java-${{ matrix.java }} + + - name: Setup Yatopia Project + run: | + git config --global user.email "ci@github.com" + git config --global user.name "Github CI" + git config --global gc.auto 0 + sudo chmod -R -f 777 ./gradlew + ./gradlew initGitSubmodules + + - name: Get MC Version + run: echo "::set-output name=mcver::$(cat "Paper/work/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4)" + id: mcver + + - name: Apply Patches + run: | + ./gradlew setupUpstream + ./gradlew applyPatches + + - name: Pull Maven Cache + uses: actions/cache@v2 + id: maven-cache + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + + - name: Build Yatopia + run: | + ./gradlew clean build paperclip + + - name: Upload Artifact + if: github.ref != 'refs/heads/ver/1.16.4' + uses: actions/upload-artifact@v2 + with: + name: Yatopia-${{ matrix.java }} + path: yatopia-1.16.5-paperclip.jar + From cfffd9d0504b7d849e144ca90d1150adbf6a6c20 Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Thu, 8 Apr 2021 13:18:31 -0400 Subject: [PATCH 10/14] update logic to find maven --- buildSrc/src/main/kotlin/ToothpickExtension.kt | 10 ++++++++++ buildSrc/src/main/kotlin/task/Paperclip.kt | 3 +-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/kotlin/ToothpickExtension.kt b/buildSrc/src/main/kotlin/ToothpickExtension.kt index 87ab20d3..ff8e264f 100644 --- a/buildSrc/src/main/kotlin/ToothpickExtension.kt +++ b/buildSrc/src/main/kotlin/ToothpickExtension.kt @@ -90,4 +90,14 @@ open class ToothpickExtension(objects: ObjectFactory) { } return upstreamArray.stream().sorted { upstream1, upstream2 -> upstream1.id - upstream2.id}.collect(Collectors.toList()) } + + internal val mavenCommand: String by lazy { + if (exitsSuccessfully("mvn", "-v")) { + return@lazy "mvn" + } + if (exitsSuccessfully("mvn.cmd", "-v")) { + return@lazy "mvn.cmd" + } + error("Unable to locate maven. Please ensure you have maven installed and on your path.") + } } diff --git a/buildSrc/src/main/kotlin/task/Paperclip.kt b/buildSrc/src/main/kotlin/task/Paperclip.kt index a9f82332..40f67149 100644 --- a/buildSrc/src/main/kotlin/task/Paperclip.kt +++ b/buildSrc/src/main/kotlin/task/Paperclip.kt @@ -22,12 +22,11 @@ internal fun Project.createPaperclipTask( val patchedJarPath = inputs.files.singleFile.absolutePath logger.lifecycle(">>> Building paperclip") val paperclipCmd = arrayListOf( - "mvn", "-T", "2C", "clean", "package", + toothpick.mavenCommand, "-T", "2C", "clean", "package", "-Dmcver=${toothpick.minecraftVersion}", "-Dpaperjar=$patchedJarPath", "-Dvanillajar=$vanillaJarPath" ) - if (System.getProperty("os.name").startsWith("Windows")) paperclipCmd[0] = "mvn.cmd" if (jenkins) paperclipCmd.add("-Dstyle.color=never") ensureSuccess(cmd(*paperclipCmd.toTypedArray(), dir = paperclipDir, printOut = true)) val paperClip = paperclipDir.resolve("assembly/target/paperclip-${toothpick.minecraftVersion}.jar") From 536f09e69fa09c51f5d64c6d0b0330e550f6ec0f Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Thu, 8 Apr 2021 13:19:46 -0400 Subject: [PATCH 11/14] Revert "Create clean_build.yml" This reverts commit 5f87d326fd13606a6c92ddfd467bfda516473c9e. --- .github/workflows/clean_build.yml | 68 ------------------------------- 1 file changed, 68 deletions(-) delete mode 100644 .github/workflows/clean_build.yml diff --git a/.github/workflows/clean_build.yml b/.github/workflows/clean_build.yml deleted file mode 100644 index fbf23da6..00000000 --- a/.github/workflows/clean_build.yml +++ /dev/null @@ -1,68 +0,0 @@ -name: Yatopia Build Script - -on: - push: - paths-ignore: - - '*.md' - - 'Jenkinsfile' - branches: - - ver/1.16.5 - -jobs: - build: - runs-on: ubuntu-latest - - strategy: - matrix: - java: [15, 11, 8] - fail-fast: false - - steps: - - uses: actions/checkout@v2 - - name: Set up JDK ${{ matrix.java }} - uses: actions/setup-java@v1 - with: - java-version: ${{ matrix.java }} - - - name: Pull Gradle Cache - uses: actions/cache@v2 - id: gradle-cache - with: - path: ~/.gradle - key: ${{ runner.os }}-maven-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}-java-${{ matrix.java }} - - - name: Setup Yatopia Project - run: | - git config --global user.email "ci@github.com" - git config --global user.name "Github CI" - git config --global gc.auto 0 - sudo chmod -R -f 777 ./gradlew - ./gradlew initGitSubmodules - - - name: Get MC Version - run: echo "::set-output name=mcver::$(cat "Paper/work/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4)" - id: mcver - - - name: Apply Patches - run: | - ./gradlew setupUpstream - ./gradlew applyPatches - - - name: Pull Maven Cache - uses: actions/cache@v2 - id: maven-cache - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - - - name: Build Yatopia - run: | - ./gradlew clean build paperclip - - - name: Upload Artifact - if: github.ref != 'refs/heads/ver/1.16.4' - uses: actions/upload-artifact@v2 - with: - name: Yatopia-${{ matrix.java }} - path: yatopia-1.16.5-paperclip.jar - From a56fe2b4ccb6c02f8e917163d1499ccb52a6854c Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Thu, 8 Apr 2021 13:19:53 -0400 Subject: [PATCH 12/14] Revert "update logic to find maven" This reverts commit cfffd9d0504b7d849e144ca90d1150adbf6a6c20. --- buildSrc/src/main/kotlin/ToothpickExtension.kt | 10 ---------- buildSrc/src/main/kotlin/task/Paperclip.kt | 3 ++- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/buildSrc/src/main/kotlin/ToothpickExtension.kt b/buildSrc/src/main/kotlin/ToothpickExtension.kt index ff8e264f..87ab20d3 100644 --- a/buildSrc/src/main/kotlin/ToothpickExtension.kt +++ b/buildSrc/src/main/kotlin/ToothpickExtension.kt @@ -90,14 +90,4 @@ open class ToothpickExtension(objects: ObjectFactory) { } return upstreamArray.stream().sorted { upstream1, upstream2 -> upstream1.id - upstream2.id}.collect(Collectors.toList()) } - - internal val mavenCommand: String by lazy { - if (exitsSuccessfully("mvn", "-v")) { - return@lazy "mvn" - } - if (exitsSuccessfully("mvn.cmd", "-v")) { - return@lazy "mvn.cmd" - } - error("Unable to locate maven. Please ensure you have maven installed and on your path.") - } } diff --git a/buildSrc/src/main/kotlin/task/Paperclip.kt b/buildSrc/src/main/kotlin/task/Paperclip.kt index 40f67149..a9f82332 100644 --- a/buildSrc/src/main/kotlin/task/Paperclip.kt +++ b/buildSrc/src/main/kotlin/task/Paperclip.kt @@ -22,11 +22,12 @@ internal fun Project.createPaperclipTask( val patchedJarPath = inputs.files.singleFile.absolutePath logger.lifecycle(">>> Building paperclip") val paperclipCmd = arrayListOf( - toothpick.mavenCommand, "-T", "2C", "clean", "package", + "mvn", "-T", "2C", "clean", "package", "-Dmcver=${toothpick.minecraftVersion}", "-Dpaperjar=$patchedJarPath", "-Dvanillajar=$vanillaJarPath" ) + if (System.getProperty("os.name").startsWith("Windows")) paperclipCmd[0] = "mvn.cmd" if (jenkins) paperclipCmd.add("-Dstyle.color=never") ensureSuccess(cmd(*paperclipCmd.toTypedArray(), dir = paperclipDir, printOut = true)) val paperClip = paperclipDir.resolve("assembly/target/paperclip-${toothpick.minecraftVersion}.jar") From c809d822e34331e32c52269b591b98da019d8acc Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Thu, 8 Apr 2021 13:22:29 -0400 Subject: [PATCH 13/14] remove old branches from workflow --- .github/workflows/build.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 75cab9e8..520fc0e7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,12 +7,6 @@ on: - 'Jenkinsfile' branches: - ver/1.16.5 - - ver/1.16.4 - - ver/1.16.3 - - ver/1.16.2 - - ver/1.16.1 - - leaflight/ver/1.16.4 - - leaflight/ver/1.16.5 pull_request: paths-ignore: - '*.md' @@ -77,7 +71,6 @@ jobs: ./gradlew clean build paperclip - name: Upload Artifact - if: github.ref != 'refs/heads/ver/1.16.4' uses: actions/upload-artifact@v2 with: name: Yatopia-${{ matrix.java }} From 923775033ae2fa5db5bdd59b755aba1fe167752e Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Thu, 8 Apr 2021 13:38:18 -0400 Subject: [PATCH 14/14] github actions on more branches --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 520fc0e7..43e485d4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,6 +7,8 @@ on: - 'Jenkinsfile' branches: - ver/1.16.5 + - dev/* + - staging/1.16.5 pull_request: paths-ignore: - '*.md'