Skip to content
This repository was archived by the owner on Mar 21, 2019. It is now read-only.

How To: Create a Build Script

HoBoS_TaCo edited this page Oct 23, 2013 · 1 revision

The first step in setting up a GMCP build script is getting GMCP. Obvious right?

import com.github.abrarsyed.gmcp.GMCP

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
                classpath 'com.github.abrarsyed.gmcp:GMCP:latest.integration'
    }
}

There is no point downloading GMCP if you aren't going to use it:

apply plugin: "gmcp"

Now to set the Minecraft version:

minecraft { minecraftVersion = "1.6.4" }

Now to set the group, version and base archive name. The group is used when releasing to maven. If you are unsure and not using maven, you might as well use the package to you @Mod file such as com.hobostaco.testmod. The version is the current mod version. archivesBaseName is appended to the beginning of your release file name.

group = 'com.hobostaco.testmod'
version = "1.0"
archivesBaseName = 'Test-Mod'

If you with to replace the mod version and minecraft version Strings in your resources such as the mcmod.info file you can use the following code:

processResources
{
    from(sourceSets.main.resources.srcDirs) {
        include '**/*.lang'
        include '**/*.info'
        expand 'version':project.version, 'mcversion':project.minecraft.minecraftVersion
    }
        
    from(sourceSets.main.resources.srcDirs) {
        exclude '**/*.lang'
        exclude '**/*.info'
    }
}

It will replace ${version} and ${mcversion} in your resources with the variables given in this file.

The finished script should look something like this:

import com.github.abrarsyed.gmcp.GMCP

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
                classpath 'com.github.abrarsyed.gmcp:GMCP:latest.integration'
    }
}

apply plugin: "gmcp"

minecraft { minecraftVersion = "1.6.4" }
group = 'com.hobostaco.testmod'
version = "1.0"
archivesBaseName = 'Test-Mod'

processResources
{
    from(sourceSets.main.resources.srcDirs) {
        include '**/*.lang'
        include '**/*.info'
        expand 'version':project.version, 'mcversion':project.minecraft.minecraftVersion
    }
        
    from(sourceSets.main.resources.srcDirs) {
        exclude '**/*.lang'
        exclude '**/*.info'
    }
}

Clone this wiki locally