2013-12-13 10:45:03 +01:00
|
|
|
buildscript {
|
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
|
|
|
maven {
|
|
|
|
name = "forge"
|
|
|
|
url = "http://files.minecraftforge.net/maven"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
dependencies {
|
|
|
|
classpath 'net.minecraftforge.gradle:ForgeGradle:1.0-SNAPSHOT'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
apply plugin: "forge"
|
|
|
|
|
|
|
|
// define the properties file
|
|
|
|
ext.configFile = file "build.properties"
|
|
|
|
|
|
|
|
configFile.withReader {
|
|
|
|
// read config. it shall from now on be referenced as simply config or as project.config
|
|
|
|
def prop = new Properties()
|
|
|
|
prop.load(it)
|
2013-12-18 01:57:55 +01:00
|
|
|
ext.config = new ConfigSlurper().parse prop
|
2013-12-13 10:45:03 +01:00
|
|
|
}
|
|
|
|
|
2013-12-16 02:26:42 +01:00
|
|
|
group = "com.pahimar.ee3"
|
2013-12-15 02:04:17 +01:00
|
|
|
version = config.mod_version + "." + config.build_number
|
|
|
|
archivesBaseName = "EquivalentExchange3"
|
2013-12-13 10:45:03 +01:00
|
|
|
|
|
|
|
minecraft {
|
|
|
|
version = config.minecraft_version + "-" + config.forge_version
|
|
|
|
assetDir = "run/assets"
|
2013-12-16 02:26:42 +01:00
|
|
|
|
2013-12-13 10:45:03 +01:00
|
|
|
replaceIn "lib/Reference.java"
|
2013-12-15 02:04:17 +01:00
|
|
|
if (project.hasProperty("ee3_signature"))
|
|
|
|
replace "@FINGERPRINT@", project.ee3_signature
|
2013-12-13 10:45:03 +01:00
|
|
|
}
|
|
|
|
|
2013-12-18 01:57:55 +01:00
|
|
|
processResources {
|
|
|
|
// replace stuff in the files we want.
|
|
|
|
from(sourceSets.main.resources.srcDirs) {
|
|
|
|
include 'mcmod.info'
|
|
|
|
include 'version.properties'
|
|
|
|
|
|
|
|
// replaces
|
|
|
|
expand 'version': project.config.mod_version, 'buildnumber': project.config.build_number
|
|
|
|
}
|
|
|
|
|
|
|
|
// copy everything else, thats we didnt do before
|
|
|
|
from(sourceSets.main.resources.srcDirs) {
|
|
|
|
exclude 'mcmod.info'
|
|
|
|
exclude 'version.properties'
|
|
|
|
}
|
|
|
|
}
|
2013-12-13 10:45:03 +01:00
|
|
|
|
|
|
|
// BEYOND THIS POINT..
|
|
|
|
// IS STUFF THATS FOR RELEASING...
|
|
|
|
|
|
|
|
// verify the properties exist.. or initialize.
|
|
|
|
if (!project.hasProperty("keystore_location")) // keystore stuff
|
2013-12-18 01:57:55 +01:00
|
|
|
ext.keystore_location = "."
|
2013-12-16 02:26:42 +01:00
|
|
|
|
2013-12-15 02:04:17 +01:00
|
|
|
if (!project.hasProperty("ee3_keystore_alias")) // keystore stuff
|
2013-12-18 01:57:55 +01:00
|
|
|
ext.ee3_keystore_alias = ""
|
2013-12-16 02:26:42 +01:00
|
|
|
|
2013-12-15 02:04:17 +01:00
|
|
|
if (!project.hasProperty("keystore_password")) // keystore stuff
|
2013-12-18 01:57:55 +01:00
|
|
|
ext.keystore_password = ""
|
2013-12-13 10:45:03 +01:00
|
|
|
|
|
|
|
if (!project.hasProperty("ee3_release_loc")) // release loc
|
2013-12-18 01:57:55 +01:00
|
|
|
ext.ee3_release_loc = "."
|
2013-12-13 10:45:03 +01:00
|
|
|
else
|
|
|
|
ee3_release_loc = ee3_release_loc.replace('{MC}', minecraft.version).replace('{MODVER}', config.mod_version).replace('{BUILD}', config.build_number)
|
2013-12-16 02:26:42 +01:00
|
|
|
|
2013-12-18 01:57:55 +01:00
|
|
|
task signJar(dependsOn: "reobf") {
|
|
|
|
inputs.file jar.getArchivePath()
|
|
|
|
inputs.file keystore_location
|
|
|
|
inputs.property "ee3_keystore_alias", ee3_keystore_alias
|
|
|
|
inputs.property "keystore_password", keystore_password
|
|
|
|
outputs.file jar.getArchivePath()
|
2013-12-13 10:45:03 +01:00
|
|
|
|
2013-12-18 01:57:55 +01:00
|
|
|
// only sign if the keystore exists
|
|
|
|
onlyIf {
|
|
|
|
return keystore_location != "."
|
|
|
|
}
|
2013-12-13 10:45:03 +01:00
|
|
|
|
2013-12-18 01:57:55 +01:00
|
|
|
// the actual action.. sign the jar.
|
|
|
|
doLast {
|
|
|
|
ant.signjar(
|
|
|
|
destDir: jar.destinationDir,
|
|
|
|
jar: jar.getArchivePath(),
|
|
|
|
keystore: keystore_location,
|
|
|
|
alias: ee3_keystore_alias,
|
|
|
|
storepass: keystore_password
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task incrementBuildNumber() {
|
2013-12-18 02:01:23 +01:00
|
|
|
doLast {
|
|
|
|
// increment
|
|
|
|
config.build_number = (config.build_number.toString().toInteger()) + 1
|
2013-12-15 04:53:01 +01:00
|
|
|
|
2013-12-18 02:01:23 +01:00
|
|
|
// write back to the file
|
|
|
|
configFile.withWriter {
|
|
|
|
config.toProperties().store(it, "")
|
|
|
|
}
|
2013-12-18 01:57:55 +01:00
|
|
|
}
|
|
|
|
}
|
2013-12-16 02:26:42 +01:00
|
|
|
|
2013-12-29 00:41:08 +01:00
|
|
|
task ci_incrementBuildNumber() {
|
|
|
|
doLast {
|
|
|
|
// increment
|
|
|
|
config.build_number = $ { System.getenv().BUILD_NUMBER }
|
2013-12-29 00:37:25 +01:00
|
|
|
|
2013-12-29 00:41:08 +01:00
|
|
|
// write back to the file
|
|
|
|
configFile.withWriter {
|
|
|
|
config.toProperties().store(it, "")
|
|
|
|
}
|
2013-12-29 00:33:05 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-18 01:57:55 +01:00
|
|
|
task release(type: Copy) {
|
|
|
|
dependsOn "incrementBuildNumber"
|
|
|
|
dependsOn "signJar"
|
|
|
|
|
|
|
|
eachFile { file ->
|
|
|
|
logger.info "copying ${file}"
|
|
|
|
}
|
|
|
|
|
|
|
|
// only if the release location isn't empty.
|
|
|
|
onlyIf {
|
|
|
|
return project.ee3_release_loc != "."
|
|
|
|
}
|
2013-12-29 00:41:08 +01:00
|
|
|
}
|
|
|
|
task ci_release(type: Copy) {
|
|
|
|
dependsOn "ci_incrementBuildNumber"
|
|
|
|
dependsOn "signJar"
|
|
|
|
|
|
|
|
eachFile { file ->
|
|
|
|
logger.info "copying ${file}"
|
|
|
|
}
|
|
|
|
|
|
|
|
// only if the release location isn't empty.
|
|
|
|
onlyIf {
|
|
|
|
return project.ee3_release_loc != "."
|
|
|
|
}
|
|
|
|
}
|