diff --git a/.gitignore b/.gitignore index 6722c133f..71dbf2226 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,7 @@ run/ out/ *.iml .gradle/ -.gradle-*/ +.gradle-cache/ output/ bin/ libs/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 303a2070e..540b56661 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,9 +15,14 @@ variables: # These can be extended so code is a bit less duplicated .build_java: - before_script: - - GRADLE_USER_HOME="$(pwd)/.gradle" - - export GRADLE_USER_HOME + #image: eclipse-temurin:17 + cache: + key: "gradleCache_$CI_JOB_NAME_SLUG" + policy: pull-push + paths: + - .gradle + - cache/ + allow_failure: true retry: max: 2 when: @@ -27,8 +32,6 @@ variables: build: stage: build - needs: [] - dependencies: [] parallel: matrix: - MC_VER: [ @@ -42,7 +45,8 @@ build: ] script: # this both runs the unit tests and assembles the code - - gradle build -PmcVer="${MC_VER}" -PinfoGitCommit="${CI_COMMIT_SHA}" -PinfoGitBranch="${CI_COMMIT_BRANCH}" -PinfoBuildSource="GitLab CI (${CI_PIPELINE_ID})" + - ./gradlew clean -PmcVer="${MC_VER}" -PinfoGitCommit="${CI_COMMIT_SHA}" -PinfoGitBranch="${CI_COMMIT_BRANCH}" -PinfoBuildSource="GitLab CI (${CI_PIPELINE_ID})" --gradle-user-home cache/; + - ./gradlew build -PmcVer="${MC_VER}" -PinfoGitCommit="${CI_COMMIT_SHA}" -PinfoGitBranch="${CI_COMMIT_BRANCH}" -PinfoBuildSource="GitLab CI (${CI_PIPELINE_ID})" --gradle-user-home cache/; - cp ./fabric/build/libs/* ./forge/build/libs/* ./neoforge/build/libs/* ./build/forgix/* . || true artifacts: name: "NightlyBuild_${MC_VER}-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}" @@ -54,27 +58,18 @@ build: - ./*-sources.jar expire_in: 14 days when: always - cache: - key: gradle-${MC_VER} - policy: pull-push - paths: - - .gradle/caches/ - - .gradle/notifications/ - - coreSubProjects/api/build - - coreSubProjects/core/build - - build - allow_failure: true - + extends: .build_java api: stage: api needs: [] - dependencies: [] script: + # this should only run for the API + - ./gradlew api:clean --gradle-user-home cache/; # this also runs unit tests - - gradle api:build - - gradle api:addSourcesToCompiledJar + - ./gradlew api:build --gradle-user-home cache/; + - ./gradlew api:addSourcesToCompiledJar --gradle-user-home cache/; - cp ./coreSubProjects/api/build/libs/merged/* . artifacts: name: "NightlyBuild_Api-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}" @@ -86,42 +81,23 @@ api: - ./*-sources.jar expire_in: 1 day when: always - cache: - key: gradle-api - policy: pull-push - paths: - - .gradle/caches/ - - .gradle/notifications/ - - coreSubProjects/api/build - - coreSubProjects/core/build - - build - allow_failure: true - + extends: .build_java # generate and publish API javadocs pages: stage: pages needs: [] - dependencies: [] script: + # this should only run for the API + - ./gradlew api:clean --gradle-user-home cache/; # this also runs unit tests - - gradle api:build - - gradle api:javadoc + - ./gradlew api:build --gradle-user-home cache/; + - ./gradlew api:javadoc --gradle-user-home cache/; - mkdir public - cp -r $CI_PROJECT_DIR/coreSubProjects/api/build/docs/javadoc/. public artifacts: paths: - public - # allow_failure: false - cache: - key: gradle-pages - policy: pull-push - paths: - - .gradle/caches/ - - .gradle/notifications/ - - coreSubProjects/api/build - - coreSubProjects/core/build - - build - allow_failure: true - + allow_failure: false + extends: .build_java diff --git a/coreSubProjects b/coreSubProjects index 726da953b..c4f4935fd 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 726da953bd75e5472339c5bc499975ed4f2bec2f +Subproject commit c4f4935fddb076296d9d30baaf0d5cec1e268090