electrodynamics/build.gradle

187 lines
5.7 KiB
Groovy
Raw Normal View History

2013-12-26 16:16:28 +01:00
buildscript {
repositories {
mavenCentral()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
2013-12-26 16:16:28 +01:00
}
2014-02-26 09:04:18 +01:00
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
2014-02-26 09:04:18 +01:00
}
}
2014-02-26 09:54:42 +01:00
apply plugin: 'scala'
apply plugin: 'forge'
2014-02-26 09:04:18 +01:00
apply plugin: 'maven-publish'
ext.buildProps = file "build.properties"
2014-09-07 05:27:23 +02:00
2014-02-26 09:04:18 +01:00
buildProps.withReader {
def prop = new Properties()
prop.load(it)
ext.config = new ConfigSlurper().parse prop
}
2014-09-07 05:27:23 +02:00
version = "${config.version.mod.major}.${config.version.mod.minor}.${config.version.mod.revis}"
if (System.getenv("TEAMCITY_BUILDCONF_NAME").equalsIgnoreCase("Production")) {
group = "com.calclavia.resonantinduction"
archivesBaseName = System.getenv("TEAMCITY_PROJECT_NAME").replaceAll(" ", "-")
} else {
group = "dev.calclavia.resonantinduction"
archivesBaseName = System.getenv("TEAMCITY_PROJECT_NAME").replaceAll(" ", "-") + "-" + System.getenv("TEAMCITY_BUILDCONF_NAME")
}
2014-02-26 09:04:18 +01:00
minecraft {
2014-09-07 05:27:23 +02:00
version = "${config.version.minecraft}-${config.version.forge}"
replaceIn "References.java"
replace "@MAJOR@", config.version.mod.major
replace "@MINOR@", config.version.mod.minor
replace "@REVIS@", config.version.mod.revis
replace "@BUILD@", System.getenv("BUILD_NUMBER")
2014-02-26 09:04:18 +01:00
}
2014-09-07 05:27:23 +02:00
if (System.getenv("BUILD_NUMBER") != null)
version += ".${System.getenv("BUILD_NUMBER")}"
2014-02-26 09:04:18 +01:00
2014-09-07 05:27:23 +02:00
processResources {
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
2014-08-18 06:11:26 +02:00
2014-09-07 05:27:23 +02:00
// replace stuff in text files, not binary ones.
from(sourceSets.main.resources.srcDirs) {
include '**/*.info'
2014-09-07 05:27:23 +02:00
// replace version and MCVersion
// forge version is also accessible via project.minecraftforgeVersion
// it contains the full minecraft version, including buildNumber
expand 'version': project.version, 'mcversion': project.minecraft.version
2014-03-12 10:26:06 +01:00
}
2014-02-26 09:04:18 +01:00
2014-09-07 05:27:23 +02:00
// copy everything else, thats not text
from 'build.properties'
2014-01-05 10:47:35 +01:00
}
2014-09-07 05:27:23 +02:00
2013-12-26 16:16:28 +01:00
task copyBuildXml(type: Copy) {
from 'build.properties'
into 'output'
}
2014-09-07 05:27:23 +02:00
/**
* Generates a TeamCity XML changelog via the REST API.
*/
task("createChangelog").doLast {
def teamCityURL = "http://ci.calclavia.com/"
/**
* Create a new file
*/
def file = new FileOutputStream("output/changelog.xml")
def out = new BufferedOutputStream(file)
/**
* Grab the build first, parse the XML to find the changelog XML URL
*/
def changesXML = new XmlSlurper().parse(teamCityURL + "guestAuth/app/rest/changes?locator=build:(id:" + teamcity["teamcity.build.id"] + ")")
def changes = changesXML.change
/**
* Add the XML definition header in the front of the file and remove all other occurrences of the XML header
*/
out << ("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><changes>")
println("createChangelog: Identified " + changes.size() + " changes to be written into the changelog.")
for (int i = 0; i < changes.size(); i++) {
/**
* Write each changelog XML into the URL
*/
def changelogURL = teamCityURL + "guestAuth/app/rest/changes/id:" + changes[i].@id.text()
out << new URL(changelogURL).getText().replaceAll("<\\?xml version=\"1\\.0\" encoding=\"UTF-8\" standalone=\"yes\"\\?>", "")
}
out << "</changes>"
out.close()
}
jar {
dependsOn copyBuildXml, createChangelog
classifier = 'core'
2014-01-06 15:25:27 +01:00
destinationDir = file 'output'
}
2014-09-07 05:27:23 +02:00
publishing {
publications {
mavenJava(MavenPublication) {
artifact jar
artifact("output/changelog.xml") {
classifier "changelog"
extension "xml"
}
artifact("output/build.properties") {
classifier "build"
extension "properties"
}
}
}
repositories {
maven {
url "file://var/www/maven"
}
}
2014-01-06 15:25:27 +01:00
}
2014-09-07 05:27:23 +02:00
repositories {
maven {
name "Calclavia Maven"
url "http://calclavia.com/maven"
2014-09-07 05:27:23 +02:00
}
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name "Mobius Repo"
url "http://mobiusstrip.eu/maven"
}
maven {
2014-09-07 06:01:22 +02:00
name "chickenbones"
url "http://chickenbones.net/maven"
2014-09-07 05:27:23 +02:00
}
2014-09-07 07:05:39 +02:00
maven {
name 'OC Maven'
url = "http://maven.cil.li/"
}
2014-09-07 05:27:23 +02:00
mavenCentral()
}
2014-09-07 05:27:23 +02:00
dependencies {
2014-09-07 05:33:37 +02:00
if (System.getenv("TEAMCITY_BUILDCONF_NAME") == "Development")
2014-09-07 05:27:23 +02:00
{
2014-09-07 05:39:23 +02:00
compile group: 'dev.calclavia.universalelectricity', name: 'universal-electricity', version: "${rootProject.config.version.universalelectricity}", classifier: "dev"
compile group: 'dev.calclavia.resonantengine', name: 'resonant-engine', version: "${config.version.resonantengine}", classifier: "dev"
2014-09-07 07:05:39 +02:00
compile "li.cil.oc:OpenComputers:MC1.7.10-1.3.4.+:dev"
2014-09-07 05:27:23 +02:00
}
else
{
2014-09-07 05:39:23 +02:00
compile group: 'com.calclavia.universalelectricity', name: 'universal-electricity', version: "${rootProject.config.version.universalelectricity}", classifier: "dev"
compile group: 'com.calclavia.resonantengine', name: 'resonant-engine', version: "${config.version.resonantengine}", classifier: "dev"
2014-09-07 07:05:39 +02:00
compile "li.cil.oc:OpenComputers:MC1.7.10-1.3.4.+:dev"
2014-09-07 05:27:23 +02:00
}
2014-09-07 06:01:22 +02:00
compile "codechicken:CodeChickenLib:${config.version.minecraft}-${config.version.cclib}:dev"
compile "codechicken:ForgeMultipart:${config.version.minecraft}-${config.version.fmp}:dev"
compile "codechicken:CodeChickenCore:${config.version.minecraft}-${config.version.cccore}:dev"
compile "codechicken:NotEnoughItems:${config.version.minecraft}-${config.version.nei}:dev"
2014-09-07 05:27:23 +02:00
}