diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 41c60758c..79e63d175 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -33,9 +33,9 @@ build: - MC_VER: ["1.16.5", "1.17.1", "1.18.2", "1.19.2", "1.19.4", "1.20.1"] script: # this both runs the unit tests and assembles the code - - ./gradlew clean -PmcVer="${MC_VER}" --gradle-user-home cache/; - - ./gradlew build -PmcVer="${MC_VER}" --gradle-user-home cache/; - - ./gradlew mergeJars -PmcVer="${MC_VER}" --gradle-user-home cache/; + - ./gradlew clean -PmcVer="${MC_VER}" -PgitMainBranch="${CI_COMMIT_BRANCH}" -PgitMainCommit="${CI_COMMIT_SHA}" -PgitCoreCommit="None(ran through Gitlab CI)" --gradle-user-home cache/; + - ./gradlew build -PmcVer="${MC_VER}" -PgitMainBranch="${CI_COMMIT_BRANCH}" -PgitMainCommit="${CI_COMMIT_SHA}" -PgitCoreCommit="None(ran through Gitlab CI)" --gradle-user-home cache/; + - ./gradlew mergeJars -PmcVer="${MC_VER}" -PgitMainBranch="${CI_COMMIT_BRANCH}" -PgitMainCommit="${CI_COMMIT_SHA}" -PgitCoreCommit="None(ran through Gitlab CI)" --gradle-user-home cache/; artifacts: name: "NightlyBuild_${MC_VER}-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}" paths: diff --git a/build.gradle b/build.gradle index 42edd49ad..f40fda823 100644 --- a/build.gradle +++ b/build.gradle @@ -363,11 +363,23 @@ subprojects { p -> def git_main_commit = "Git_not_found" def git_core_commit = "Git_not_found" def git_main_branch = "Git_not_found" + // These "hasProperty"'s are so that they can be passed through the cli (ie in the CI) try { - "git rev-parse --is-inside-work-tree".execute() // If git doesnt exist, or this isnt cloned from git, then this wont work - git_main_commit = 'git rev-parse --verify HEAD'.execute().text.trim() - git_core_commit = 'git ls-tree --object-only HEAD ../coreSubProjects'.execute().text.trim() // TODO: is there a way to do this universally - git_main_branch = 'git symbolic-ref --short HEAD'.execute().text.trim() +// "git rev-parse --is-inside-work-tree".execute() // If git doesnt exist, or this isnt cloned from git, then this wont work + if (gitMainCommit != "null") + git_main_commit = gitMainCommit + else + git_main_commit = 'git rev-parse --verify HEAD'.execute().text.trim() + + if (gitCoreCommit != "null") + git_core_commit = gitCoreCommit + else + git_core_commit = 'git ls-tree --object-only HEAD ../coreSubProjects'.execute().text.trim() // TODO: is there a way to do this universally + + if (gitMainBranch != "null") + git_main_branch = gitMainBranch + else + git_main_branch = 'git symbolic-ref --short HEAD'.execute().text.trim() } catch (Exception e) { println "Git or Git project not found" } diff --git a/gradle.properties b/gradle.properties index 3516d29bd..1eb3e376a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -30,6 +30,14 @@ netty_version=4.1.94.Final lwjgl_version=3.2.3 joml_version=1.10.2 + +# These are here so they can be changed with cmd arguments +# If they are null, they would be automatically set +# (This is mainly used for the CI) +gitMainCommit=null +gitCoreCommit=null +gitMainBranch=null + # Internal Properties (These are set at runtime for Forgix to merge jar's) versionStr=