diff --git a/config/gradle/publish.gradle b/config/gradle/publish.gradle index 8d9d4c1fd38..c05a18e8da8 100644 --- a/config/gradle/publish.gradle +++ b/config/gradle/publish.gradle @@ -22,38 +22,21 @@ publishing { url = "http://artifactory.terasology.org/artifactory/$publishRepo" println "Changing PUBLISH repoKey set via Gradle property to $publishRepo" } else { - // In this case we are going to fletch the publish repo together from a few things - // First if we have an override from the environment to use a different target publish org + // Support override from the environment to use a different target publish org String deducedPublishRepo = System.getenv()["PUBLISH_ORG"] if (deducedPublishRepo == null || deducedPublishRepo == "") { // If not then default deducedPublishRepo = "terasology" } - String releaseRepoFragment = "-release-local" - String snapshotRepoFragment = "-snapshot-local" - // Secondly we're going to find out if we're doing a release or a snapshot - this gets a little more complicated + // Check the active Git branch and some module logic to see whether we're doing a release or snapshot String gitBranch = System.getenv()["BRANCH_NAME"] - if (gitBranch != null && gitBranch != "" && gitBranch.equals("master")) { - // Okay we're in an environment where a branch name is set to 'master' so we might be doing a release - // This is the funny part. Modules aren't ready globally to accept master branch == release, so check a prop that defaults to bypass - if (project.hasProperty("bypassModuleReleaseManagement")) { - if (bypassModuleReleaseManagement == "true") { - println "Release management not enabled for " + project.name + ", using snapshot repo despite building 'master' branch" - deducedPublishRepo += snapshotRepoFragment - } else { - println "Release management *is* enabled for " + project.name + ", using release repo since building 'master' branch" - deducedPublishRepo += releaseRepoFragment - } - } else { - println "We're working on a 'master' branch with defaults so using the release publish repo" - deducedPublishRepo += releaseRepoFragment - } + if (isMaster(gitBranch) && !shouldBypassModuleRelease()) { + deducedPublishRepo += "-release-local" } else { - // No master branch so we for sure are just doing snapshots - println "We're not working with a branch name set that's 'master' so assuming we're publishing snapshots" deducedPublishRepo += "-snapshot-local" } + println "The final deduced publish repo is $deducedPublishRepo" url = "http://artifactory.terasology.org/artifactory/$deducedPublishRepo" } @@ -73,3 +56,11 @@ publishing { } } +def isMaster(gitBranch) { + return gitBranch != null && gitBranch != "" && gitBranch.equals("master"); +} + +// Mildly awkward: Modules aren't ready globally to accept master branch == release, so make it opt-in by checking a prop that defaults to bypass +def shouldBypassModuleRelease() { + return project.hasProperty("bypassModuleReleaseManagement") && bypassModuleReleaseManagement == "true"; +} diff --git a/modules/BiomesAPI/build.gradle b/modules/BiomesAPI/build.gradle index a477f5784b3..8d74639c437 100644 --- a/modules/BiomesAPI/build.gradle +++ b/modules/BiomesAPI/build.gradle @@ -70,22 +70,23 @@ version = moduleConfig.version import org.gradle.internal.logging.text.StyledTextOutputFactory import static org.gradle.internal.logging.text.StyledTextOutput.Style +// Check for an outright -SNAPSHOT in the loaded version - for ease of use we want to get rid of that everywhere, so warn about it and remove for the variable +def undesiredSnapshotTag = version.endsWith("-SNAPSHOT") +println "BiomesAPI version before the snapshot check: " + version +if (undesiredSnapshotTag) { + println "Taking off undesired -SNAPSHOT" + version -= "-SNAPSHOT" + def out = services.get(StyledTextOutputFactory).create("an-ouput") + out.withStyle(Style.FailureHeader).println("WARNING: Module " + project.name + " is explicitly versioned as a snapshot in module.txt, please remove '-SNAPSHOT'") +} + // The only case in which we make module non-snapshots is if release management is enabled and BRANCH_NAME is "master" if (moduleConfig.isReleaseManaged && env.BRANCH_NAME == "master") { // This is mildly awkward since we need to bypass by default, yet if release management is on (true) then we set the bypass to false .. ext.bypassModuleReleaseManagement = false - if (version.contains("-SNAPSHOT")) { - version -= "-SNAPSHOT" - def out = services.get(StyledTextOutputFactory).create("an-ouput") - out.withStyle(Style.FailureHeader).println("WARNING: Module " + project.name + " is explicitly versioned as a snapshot in module.txt, please remove '-SNAPSHOT'") - } } else { - if (!version.contains("-SNAPSHOT")) { - version += "-SNAPSHOT" - } else { - def out = services.get(StyledTextOutputFactory).create("an-ouput") - out.withStyle(Style.FailureHeader).println("WARNING: Module " + project.name + " is explicitly versioned as a snapshot in module.txt, please remove '-SNAPSHOT'") - } + // In the case where we actually are building a snapshot we load -SNAPSHOT into the version variable, even if it wasn't there in module.txt + version += "-SNAPSHOT" } // Jenkins-Artifactory integration catches on to this as part of the Maven-type descriptor diff --git a/modules/BuilderSampleGameplay/build.gradle b/modules/BuilderSampleGameplay/build.gradle index a477f5784b3..8d74639c437 100644 --- a/modules/BuilderSampleGameplay/build.gradle +++ b/modules/BuilderSampleGameplay/build.gradle @@ -70,22 +70,23 @@ version = moduleConfig.version import org.gradle.internal.logging.text.StyledTextOutputFactory import static org.gradle.internal.logging.text.StyledTextOutput.Style +// Check for an outright -SNAPSHOT in the loaded version - for ease of use we want to get rid of that everywhere, so warn about it and remove for the variable +def undesiredSnapshotTag = version.endsWith("-SNAPSHOT") +println "BiomesAPI version before the snapshot check: " + version +if (undesiredSnapshotTag) { + println "Taking off undesired -SNAPSHOT" + version -= "-SNAPSHOT" + def out = services.get(StyledTextOutputFactory).create("an-ouput") + out.withStyle(Style.FailureHeader).println("WARNING: Module " + project.name + " is explicitly versioned as a snapshot in module.txt, please remove '-SNAPSHOT'") +} + // The only case in which we make module non-snapshots is if release management is enabled and BRANCH_NAME is "master" if (moduleConfig.isReleaseManaged && env.BRANCH_NAME == "master") { // This is mildly awkward since we need to bypass by default, yet if release management is on (true) then we set the bypass to false .. ext.bypassModuleReleaseManagement = false - if (version.contains("-SNAPSHOT")) { - version -= "-SNAPSHOT" - def out = services.get(StyledTextOutputFactory).create("an-ouput") - out.withStyle(Style.FailureHeader).println("WARNING: Module " + project.name + " is explicitly versioned as a snapshot in module.txt, please remove '-SNAPSHOT'") - } } else { - if (!version.contains("-SNAPSHOT")) { - version += "-SNAPSHOT" - } else { - def out = services.get(StyledTextOutputFactory).create("an-ouput") - out.withStyle(Style.FailureHeader).println("WARNING: Module " + project.name + " is explicitly versioned as a snapshot in module.txt, please remove '-SNAPSHOT'") - } + // In the case where we actually are building a snapshot we load -SNAPSHOT into the version variable, even if it wasn't there in module.txt + version += "-SNAPSHOT" } // Jenkins-Artifactory integration catches on to this as part of the Maven-type descriptor diff --git a/modules/Core/build.gradle b/modules/Core/build.gradle index a477f5784b3..8d74639c437 100644 --- a/modules/Core/build.gradle +++ b/modules/Core/build.gradle @@ -70,22 +70,23 @@ version = moduleConfig.version import org.gradle.internal.logging.text.StyledTextOutputFactory import static org.gradle.internal.logging.text.StyledTextOutput.Style +// Check for an outright -SNAPSHOT in the loaded version - for ease of use we want to get rid of that everywhere, so warn about it and remove for the variable +def undesiredSnapshotTag = version.endsWith("-SNAPSHOT") +println "BiomesAPI version before the snapshot check: " + version +if (undesiredSnapshotTag) { + println "Taking off undesired -SNAPSHOT" + version -= "-SNAPSHOT" + def out = services.get(StyledTextOutputFactory).create("an-ouput") + out.withStyle(Style.FailureHeader).println("WARNING: Module " + project.name + " is explicitly versioned as a snapshot in module.txt, please remove '-SNAPSHOT'") +} + // The only case in which we make module non-snapshots is if release management is enabled and BRANCH_NAME is "master" if (moduleConfig.isReleaseManaged && env.BRANCH_NAME == "master") { // This is mildly awkward since we need to bypass by default, yet if release management is on (true) then we set the bypass to false .. ext.bypassModuleReleaseManagement = false - if (version.contains("-SNAPSHOT")) { - version -= "-SNAPSHOT" - def out = services.get(StyledTextOutputFactory).create("an-ouput") - out.withStyle(Style.FailureHeader).println("WARNING: Module " + project.name + " is explicitly versioned as a snapshot in module.txt, please remove '-SNAPSHOT'") - } } else { - if (!version.contains("-SNAPSHOT")) { - version += "-SNAPSHOT" - } else { - def out = services.get(StyledTextOutputFactory).create("an-ouput") - out.withStyle(Style.FailureHeader).println("WARNING: Module " + project.name + " is explicitly versioned as a snapshot in module.txt, please remove '-SNAPSHOT'") - } + // In the case where we actually are building a snapshot we load -SNAPSHOT into the version variable, even if it wasn't there in module.txt + version += "-SNAPSHOT" } // Jenkins-Artifactory integration catches on to this as part of the Maven-type descriptor diff --git a/modules/CoreSampleGameplay/build.gradle b/modules/CoreSampleGameplay/build.gradle index a477f5784b3..8d74639c437 100644 --- a/modules/CoreSampleGameplay/build.gradle +++ b/modules/CoreSampleGameplay/build.gradle @@ -70,22 +70,23 @@ version = moduleConfig.version import org.gradle.internal.logging.text.StyledTextOutputFactory import static org.gradle.internal.logging.text.StyledTextOutput.Style +// Check for an outright -SNAPSHOT in the loaded version - for ease of use we want to get rid of that everywhere, so warn about it and remove for the variable +def undesiredSnapshotTag = version.endsWith("-SNAPSHOT") +println "BiomesAPI version before the snapshot check: " + version +if (undesiredSnapshotTag) { + println "Taking off undesired -SNAPSHOT" + version -= "-SNAPSHOT" + def out = services.get(StyledTextOutputFactory).create("an-ouput") + out.withStyle(Style.FailureHeader).println("WARNING: Module " + project.name + " is explicitly versioned as a snapshot in module.txt, please remove '-SNAPSHOT'") +} + // The only case in which we make module non-snapshots is if release management is enabled and BRANCH_NAME is "master" if (moduleConfig.isReleaseManaged && env.BRANCH_NAME == "master") { // This is mildly awkward since we need to bypass by default, yet if release management is on (true) then we set the bypass to false .. ext.bypassModuleReleaseManagement = false - if (version.contains("-SNAPSHOT")) { - version -= "-SNAPSHOT" - def out = services.get(StyledTextOutputFactory).create("an-ouput") - out.withStyle(Style.FailureHeader).println("WARNING: Module " + project.name + " is explicitly versioned as a snapshot in module.txt, please remove '-SNAPSHOT'") - } } else { - if (!version.contains("-SNAPSHOT")) { - version += "-SNAPSHOT" - } else { - def out = services.get(StyledTextOutputFactory).create("an-ouput") - out.withStyle(Style.FailureHeader).println("WARNING: Module " + project.name + " is explicitly versioned as a snapshot in module.txt, please remove '-SNAPSHOT'") - } + // In the case where we actually are building a snapshot we load -SNAPSHOT into the version variable, even if it wasn't there in module.txt + version += "-SNAPSHOT" } // Jenkins-Artifactory integration catches on to this as part of the Maven-type descriptor diff --git a/templates/build.gradle b/templates/build.gradle index a477f5784b3..8d74639c437 100644 --- a/templates/build.gradle +++ b/templates/build.gradle @@ -70,22 +70,23 @@ version = moduleConfig.version import org.gradle.internal.logging.text.StyledTextOutputFactory import static org.gradle.internal.logging.text.StyledTextOutput.Style +// Check for an outright -SNAPSHOT in the loaded version - for ease of use we want to get rid of that everywhere, so warn about it and remove for the variable +def undesiredSnapshotTag = version.endsWith("-SNAPSHOT") +println "BiomesAPI version before the snapshot check: " + version +if (undesiredSnapshotTag) { + println "Taking off undesired -SNAPSHOT" + version -= "-SNAPSHOT" + def out = services.get(StyledTextOutputFactory).create("an-ouput") + out.withStyle(Style.FailureHeader).println("WARNING: Module " + project.name + " is explicitly versioned as a snapshot in module.txt, please remove '-SNAPSHOT'") +} + // The only case in which we make module non-snapshots is if release management is enabled and BRANCH_NAME is "master" if (moduleConfig.isReleaseManaged && env.BRANCH_NAME == "master") { // This is mildly awkward since we need to bypass by default, yet if release management is on (true) then we set the bypass to false .. ext.bypassModuleReleaseManagement = false - if (version.contains("-SNAPSHOT")) { - version -= "-SNAPSHOT" - def out = services.get(StyledTextOutputFactory).create("an-ouput") - out.withStyle(Style.FailureHeader).println("WARNING: Module " + project.name + " is explicitly versioned as a snapshot in module.txt, please remove '-SNAPSHOT'") - } } else { - if (!version.contains("-SNAPSHOT")) { - version += "-SNAPSHOT" - } else { - def out = services.get(StyledTextOutputFactory).create("an-ouput") - out.withStyle(Style.FailureHeader).println("WARNING: Module " + project.name + " is explicitly versioned as a snapshot in module.txt, please remove '-SNAPSHOT'") - } + // In the case where we actually are building a snapshot we load -SNAPSHOT into the version variable, even if it wasn't there in module.txt + version += "-SNAPSHOT" } // Jenkins-Artifactory integration catches on to this as part of the Maven-type descriptor