Skip to content

Instantly share code, notes, and snippets.

@marchermans
Created December 5, 2015 20:45
Show Gist options
  • Save marchermans/4c1df2b57afcc315773c to your computer and use it in GitHub Desktop.
Save marchermans/4c1df2b57afcc315773c to your computer and use it in GitHub Desktop.
Dependency
// For those who want the bleeding edge
buildscript{
repositories {
jcenter()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
maven {
name = "SmithsCore"
url = "http://mavenrepo.smithscore.orionminecraft.com/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT'
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'maven'
//Buildscript: Armory
// Load the properties of this project.
ext.configFile = file "build.properties"
//Reference the properties inside the project:
configFile.withReader {
def prop = new Properties()
prop.load(it)
project.ext.config = new ConfigSlurper().parse prop
}
//Date formatting helper function
def getDate() {
def date = new Date()
def formattedDate = date.format('dd-MM-yyyy : hh:mm:ss')
return formattedDate
}
def build_mode = config.build_mode
//These configurations are needed for uploading to a MavenRepo:
configurations {
deployerJars
}
//Initializing the mod environment
version = config.mod_version.toString() + "-" + System.getenv().TRAVIS_BUILD_NUMBER.toString()
def apiversion = config.api_version.toString() + "-" + System.getenv().TRAVIS_BUILD_NUMBER.toString()
if(System.getenv().TRAVIS_BRANCH.toString().contains("Development"))
{
version = version + "-SNAPSHOT"
apiversion = apiversion + "-SNAPSHOT"
}
group = "com.SmithsModding.Armory"
archivesBaseName = "Armory"
minecraft {
version = config.minecraft_version+ "-" + config.forge_version
runDir = "run/assets"
mappings = "snapshot_20151129"
//Replacing stuff inside the code:
replace "@VERSION@", project.version
replace "@MCVERSION@", config.minecraft_version
replace "@APIVERSION@", apiversion
}
dependencies {
//Mod dependencies
compile group: 'com.SmithsModding.SmithsCore', name: 'SmithsCore', version: config.smithscore_version
//Maven uploader
deployerJars 'org.apache.maven.wagon:wagon-ftp:2.8'
}
sourceSets {
main {
resources {
srcDir 'resources'
}
}
}
//This will process all the resources used during build, and needed for running the project
processResources
{
//Replaces stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand 'version':project.version, 'mcversion':project.minecraft.version
}
//Copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
exclude '**/Thumbs.db'
}
jar {
manifest {
attributes 'FMLAT': 'Armory_at.cfg'
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment