Skip to content

Commit

Permalink
changes: tweak artifact version order, make sure the artifact version…
Browse files Browse the repository at this point in the history
… follow maven's version syntax
  • Loading branch information
Fallen-Breath committed Jul 8, 2024
1 parent 08c4cc2 commit 0c39ffb
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,32 +80,33 @@ remapJar {

String modVersionSuffix = ''
String artifactVersion = project.mod_version
String artifactVersionSuffix = ''
// detect github action environment variables
// https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables
if (System.getenv("BUILD_RELEASE") != "true") {
String buildNumber = System.getenv("BUILD_ID")
modVersionSuffix += buildNumber != null ? ('+build.' + buildNumber) : '-SNAPSHOT'
artifactVersion += '-SNAPSHOT' // A non-release artifact is always a SNAPSHOT artifact
artifactVersionSuffix = '-SNAPSHOT' // A non-release artifact is always a SNAPSHOT artifact
}
String finalModVersion = project.mod_version + modVersionSuffix
String fullProjectVersion, fullArtifactVersion

// Example version values:
// project.mod_version 1.0.3 (the base mod version)
// finalModVersion 1.0.3+build.88 (the actual mod version to use)
// fullProjectVersion mc1.15.2-v1.0.3+build.88 (in build output jar name)
// fullArtifactVersion mc1.15.2-v1.0.3-SNAPSHOT (maven artifact version)
// finalModVersion 1.0.3+build.88 (the actual mod version to use in the mod)
// fullProjectVersion v1.0.3-mc1.15.2+build.88 (in build output jar name)
// fullArtifactVersion 1.0.3-mc1.15.2-SNAPSHOT (maven artifact version)

group = project.maven_group
if (System.getenv("JITPACK") == "true") {
// move mc version into archivesBaseName, so jitpack will be able to organize archives from multiple subprojects correctly
base.archivesName = project.archives_base_name + '-mc' + project.minecraft_version
fullProjectVersion = 'v' + finalModVersion
fullArtifactVersion = 'v' + artifactVersion
fullArtifactVersion = artifactVersion + artifactVersionSuffix
} else {
base.archivesName = project.archives_base_name
fullProjectVersion = 'mc' + project.minecraft_version + '-v' + finalModVersion
fullArtifactVersion = 'mc' + project.minecraft_version + '-v' + artifactVersion
fullProjectVersion = 'v' + finalModVersion + '-mc' + project.minecraft_version
fullArtifactVersion = artifactVersion + '-mc' + project.minecraft_version + artifactVersionSuffix
}
version = fullProjectVersion

Expand Down

0 comments on commit 0c39ffb

Please sign in to comment.