Fixed up git on ci (well, kinda)

This commit is contained in:
coolGi
2023-08-24 23:30:25 +09:30
parent 9297ac4c35
commit d9b969e7a7
3 changed files with 27 additions and 7 deletions
+3 -3
View File
@@ -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:
+16 -4
View File
@@ -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"
}
+8
View File
@@ -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=