Skip to content

Commit

Permalink
Generate version.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
LunNova committed Feb 2, 2016
1 parent 9c5a895 commit a250f59
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,20 @@ ext.buildNumber = System.getenv("BUILD_NUMBER") ?: 0
ext.ciSystem = System.getenv("JENKINS_URL") ? 'Jenkins' : 'unknown'
ext.commit = System.getenv("GIT_COMMIT") ?: 'unknown'

// version information
version = mcVersion + '-SNAPSHOT'

ext.versionWithBuildNumber = project.buildNumber != 0 ? project.version.replace("-SNAPSHOT", "") + "." + project.buildNumber : project.version
ext.versionPath = "./build/version.txt"

def versionFile = file(versionPath);
versionFile.getParentFile().mkdir()

minecraft {
version = fullForgeVersion
mappings = "stable_20"

replace "@VERSION@", project.buildNumber != 0 ? (project.version.replace("-SNAPSHOT", "") + '.' + project.buildNumber) : project.version
replace "@VERSION@", project.versionWithBuildNumber
replace "@MC_VERSION@", version
}

Expand All @@ -54,8 +63,6 @@ modpatcher {
sourceCompatibility = 1.8
targetCompatibility = 1.8

version = mcVersion + '-SNAPSHOT'

repositories {
mavenCentral()
maven { url 'http://repo.nallar.me/' }
Expand Down Expand Up @@ -98,6 +105,8 @@ processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
println(project.versionWithBuildNumber)
versionFile.text = project.versionWithBuildNumber

filesMatching("mcmod.info") {
expand 'version': project.version, 'mcversion': project.minecraft.version, 'name': project.projectName
Expand Down Expand Up @@ -148,6 +157,7 @@ artifacts {
archives apiJar
archives coremodJar
archives jar
archives file(versionPath)
}

tasks.withType(Jar) {
Expand Down

0 comments on commit a250f59

Please sign in to comment.