Jump to content

build script that increments the build number after being built


Fergoman007

Recommended Posts

i am having trouble try to get my mod to export mod files with different build number

 

This is my current build script

buildscript {
    repositories {
        mavenCentral()
        maven {
            name = "forge"
            url = "http://files.minecraftforge.net/maven"
        }
        maven {
            name = "sonatype"
            url = "https://oss.sonatype.org/content/repositories/snapshots/"
        }
    }
    dependencies {
        classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
    }
}

apply plugin: 'forge'

ext.configFile = file "build.properties"
configFile.withReader{
    def prop = new Properties()
    prop.load(it)
    ext.config = new ConfigSlurper().parse prop
}

ext.buildnumber = 0
if (System.getenv().BUILD_NUMBER)
    project.buildnumber = System.getenv().BUILD_NUMBER
logger.lifecycle "Building Version: " + project.config.buildnumber
project.buildnumber += 1


version = config.mod_version
group= "fergoman123.mods.fergoutil" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "FergoUtil"

minecraft {
    version = config.minecraft_version + "-" + config.forge_version
    assetDir = "eclipse/assets"

    replaceIn "fergoman123/mods/fergoutil/lib/ModInfo.java"
    replace "@mod_version@", project.version
    replace "@mcVersion@", project.config.minecraft_version
    replace "@forge_version@", project.config.forge_version
    replace "@buildNum@", project.buildnumber
}

version = "${config.minecraft_version}-${config.mod_version}-${buildnumber}"

dependencies {
    // you may put jars on which you depend on in ./libs
    // or you may define them like so..
    //compile "some.group:artifact:version:classifier"
    //compile "some.group:artifact:version"
      
    // real examples
    //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev'  // adds buildcraft to the dev env
    //compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env

    // for more info...
    // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
    // http://www.gradle.org/docs/current/userguide/dependency_management.html

}

processResources
{
    // this will ensure that this task is redone when the versions change.
    inputs.property "version", project.version
    inputs.property "mcversion", project.minecraft.version

    // replace stuff in mcmod.info, nothing else
    from(sourceSets.main.resources.srcDirs) {
        include 'mcmod.info'
                
        // replace version and mcversion
        expand 'version':project.config.mod_version, 'mcversion':project.config.mcVersion
    }
        
    // copy everything else, thats not the mcmod.info
    from(sourceSets.main.resources.srcDirs) {
        exclude 'mcmod.info'
    }
}

 

Any Help is appreciated

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.