BloodMagic/build.gradle

137 lines
3.8 KiB
Groovy
Raw Normal View History

2014-10-31 22:07:43 +00:00
buildscript {
repositories {
mavenCentral()
maven { url = "http://files.minecraftforge.net/maven" }
maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" }
2014-10-31 22:07:43 +00:00
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
2014-11-02 01:04:00 +00:00
classpath 'org.ajoberstar:gradle-git:0.10.1'
2014-10-31 22:07:43 +00:00
}
}
apply plugin: 'forge'
2014-10-31 22:07:43 +00:00
ext.configFile = file "build.properties"
configFile.withReader {
def prop = new Properties()
prop.load(it)
project.ext.config = new ConfigSlurper().parse prop
}
version = config.mc_version + "-" + config.mod_version + "-" + config.build_number
group= config.package_group
archivesBaseName = config.mod_name
2014-10-31 22:07:43 +00:00
2014-11-02 01:04:00 +00:00
import org.ajoberstar.grgit.Grgit
def gitHash = 'unknown'
if (new File(projectDir, '.git').exists()) {
def repo = Grgit.open(project.file('.'))
gitHash = repo.log().find().abbreviatedId
}
2014-10-31 22:07:43 +00:00
repositories {
maven {
name 'CB Maven FS'
url "http://chickenbones.net/maven/"
}
maven {
name 'DVS1 Maven FS'
url 'http://dvs1.progwml6.com/files/maven'
}
maven {
name 'TehNut Repo'
url 'http://tehnut.info/maven/'
}
ivy {
name "MineTweaker3"
artifactPattern "http://minetweaker3.powerofbytes.com/download/[module]-[revision].[ext]"
}
2014-10-31 22:07:43 +00:00
}
dependencies {
2015-07-31 16:11:44 +00:00
// compile "codechicken:CodeChickenLib:" + config.mc_version + "-" + config.cclib_version + ":dev"
// compile "codechicken:CodeChickenCore:" + config.mc_version + "-" + config.ccc_version + ":dev"
// compile "codechicken:NotEnoughItems:" + config.mc_version + "-" + config.nei_version + ":dev"
2015-07-29 12:23:01 +00:00
// compile name: 'MineTweaker3', version: config.minetweaker_version, ext: 'jar'
// compile "codechicken:ForgeMultipart:1.7.10-1.1.0.314:dev"
// compile "info.amerifrance.guideapi:Guide-API:" + config.mc_version + "-" + config.guideapi_version + ":deobf"
}
2014-10-31 22:07:43 +00:00
minecraft {
version = config.mc_version + "-" + config.forge_version
runDir = "run"
2015-06-13 22:35:48 +00:00
2015-06-22 16:57:41 +00:00
replaceIn "GAPIChecker.java"
2015-06-13 22:35:48 +00:00
replace "@VERSION@", config.guideapi_version
}
2014-10-31 22:07:43 +00:00
processResources {
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
2014-10-31 22:07:43 +00:00
from(sourceSets.main.resources.srcDirs) {
include '**/*.info'
include '**/*.properties'
2014-10-31 22:07:43 +00:00
expand 'version': project.version, 'mcversion': project.minecraft.version
}
from(sourceSets.main.resources.srcDirs) {
exclude '**/*.info'
exclude '**/*.properties'
exclude '**/*.db'
}
2014-10-31 22:07:43 +00:00
}
jar {
dependsOn "incrementBuildNumber"
classifier = ''
2014-11-02 01:04:00 +00:00
manifest.mainAttributes(
"Built-By": System.getProperty('user.name'),
"Created-By": "${System.getProperty('java.vm.version')} + (${System.getProperty('java.vm.vendor')})",
"Implementation-Title": project.name,
"Implementation-Version": project.version,
"Git-Hash": gitHash
)
2014-10-31 22:07:43 +00:00
}
// add a source jar
task sourceJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
2014-10-31 22:07:43 +00:00
// add a javadoc jar
task javadocJar(type: Jar, dependsOn: javadoc) {
from javadoc.destinationDir
classifier = 'javadoc'
2014-10-31 22:07:43 +00:00
}
// because the normal output has been made to be obfuscated
task deobfJar(type: Jar) {
from sourceSets.main.output
classifier = 'deobf'
}
2014-10-31 22:07:43 +00:00
tasks.build.dependsOn sourceJar, javadocJar, deobfJar
2014-10-31 22:07:43 +00:00
tasks.withType(JavaCompile) { task ->
task.options.encoding = 'UTF-8'
}
2014-10-31 22:07:43 +00:00
task("incrementBuildNumber") {
// increment build number
doFirst {
// increment
config.build_number = (config.build_number.toString().toInteger()) + 1
// write back to the file
configFile.withWriter {
config.toProperties().store(it, "")
}
}
}
2014-10-31 22:07:43 +00:00
// Uncomment this line if you want to auto-upload to CurseForge when you build. This requires you to setup curse.gradle yourself.
// fileTree('gradle').include('curse.gradle').collect().sort().each { apply from: it }