BiomesOPlenty/build.gradle

225 lines
7.4 KiB
Groovy

buildscript {
repositories {
mavenCentral()
maven {
name = 'sonatype-nexus-public'
url = 'https://oss.sonatype.org/content/repositories/public/'
}
maven {
name = 'forge-repo'
url = 'http://files.minecraftforge.net/maven/'
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
}
}
evaluationDependsOn('Mixin')
apply plugin: "forge"
repositories {
flatDir {
name "fileRepo"
dirs "repo"
}
}
// 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)
project.ext.config = new ConfigSlurper().parse prop
}
group = "com.github.glitchfiend.biomesoplenty"
version = config.mod_version
archivesBaseName = "BiomesOPlenty"
minecraft {
version = config.minecraft_version + "-" + config.forge_version // grab latest forge
}
// add some stuff to the version
version = "${config.minecraft_version}-${config.mod_version}.${System.getenv().BUILD_NUMBER}"
dependencies {
compile project('Mixin')
}
jenkins {
job = 'BiomesOPlenty'
}
if (!minecraft.mappingsSet && minecraft.version.startsWith("1.8")) {
// Default mappings, normally if mappings are not specified then the plugin will set this
// default value internally, unfortunately this happens too late for the compile step below
// which needs the correct value to pass to the annotation processor.
minecraft.mappings = "snapshot_20141001"
}
def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + 'mixins.srg'
reobf.addExtraSrgFile mixinSrg
// Source compiler configuration
tasks.withType(JavaCompile) {
options.compilerArgs += [ '-Xlint:all', '-Xlint:-path', '-Xlint:-processing', "-AreobfSrgFile=${tasks.reobf.srg}", "-AoutSrgFile=${mixinSrg}" ]
options.deprecation = true
options.encoding = 'utf8'
}
jar {
from(project("Mixin").sourceSets.main.output) {
exclude 'LICENSE.txt'
}
manifest {
attributes 'FMLCorePlugin': 'biomesoplenty.common.asm.BOPLoadingPlugin'
attributes 'FMLCorePluginContainsFMLMod': 'true'
attributes 'TweakClass': "org.spongepowered.asm.launch.MixinTweaker"
attributes 'TweakOrder': "10000"
}
classifier = 'universal'
}
processResources {
from(sourceSets.main.resources.srcDirs) {
include '**/*.info'
include '**/*.properties'
// replaces
expand ([
'modid': project.archivesBaseName,
'mod_version': project.config.mod_version,
'minecraft_version': project.config.minecraft_version,
'build_number': project.config.build_number
])
}
from(sourceSets.main.resources.srcDirs) {
exclude '**/*.info'
exclude '**/*.properties'
}
}
import net.minecraftforge.gradle.tasks.dev.ChangelogTask
import net.minecraftforge.gradle.common.Constants
import net.minecraftforge.gradle.delayed.*
task createChangelog(type: ChangelogTask) {
def jobName = "${System.getenv().JOB_NAME}"
def buildNumber = "${System.getenv().BUILD_NUMBER}"
setServerRoot(new DelayedString(project, 'http://ci.jenkins.minecraftforge.net/'))
setJobName(new DelayedString(project, jobName.toString()));
setAuthName(new DelayedString(project, 'console_script'));
setAuthPassword(new DelayedString(project, 'dc6d48ca20a474beeac280a9a16a926e'));
setTargetBuild({buildNumber.toString()});
setOutput(new DelayedFile(project, 'build/distributions/' + project.getName() + '-' + project.version + '-changelog.txt'));
}
tasks.build.dependsOn('createChangelog')
task sourceJar(type: Jar) {
from sourceSets.main.allJava
from project("Mixin").sourceSets.main.allJava
from (sourceSets.main.output) {
include 'LICENSE.txt'
}
classifier = 'sources'
}
task deobfJar(type: Jar) {
from sourceSets.main.output
from project("Mixin").sourceSets.main.output
classifier = 'deobf'
}
artifacts {
archives sourceJar
archives deobfJar
}
uploadArchives {
dependsOn 'reobf'
repositories {
if (project.hasProperty("filesmaven")) {
logger.info('Publishing to files server')
mavenDeployer {
configuration = configurations.deployJars
repository(url: project.filesmaven.url) {
authentication(userName: project.filesmaven.username, privateKey: project.filesmaven.key)
}
pom {
groupId = project.group
version = project.version
artifactId = project.archivesBaseName
project {
name project.archivesBaseName
packaging 'jar'
description 'Biomes O Plenty'
url 'https://github.com/Glitchfiend/BiomesOPlenty'
scm {
url 'https://github.com/Glitchfiend/BiomesOPlenty'
connection 'scm:git:git://github.com/Glitchfiend/BiomesOPlenty.git'
developerConnection 'scm:git:git@github.com:Glitchfiend/BiomesOPlenty.git'
}
issueManagement {
system 'github'
url 'https://github.com/Glitchfiend/BiomesOPlenty/issues'
}
licenses {
license {
name 'Creative Commons Attribution-NonCommercial-NoDerivs 4.0 International Public License'
url 'http://creativecommons.org/licenses/by-nc-nd/4.0/'
distribution 'repo'
}
}
developers {
developer {
id 'Adubbz'
name 'Adubbz'
roles { role 'developer' }
}
developer {
id 'Amnet'
name 'Amnet'
roles { role 'developer' }
}
developer {
id 'Forstride'
name 'Forstride'
roles { role 'developer' }
}
developer {
id 'ted80'
name 'ted80'
roles { role 'developer' }
}
}
}
}
}
} else {
logger.info('Publishing to repo folder')
mavenDeployer {
pom.version = "${project.minecraft.version}-${project.version}"
repository(url: 'file://localhost/' + project.file('repo').getAbsolutePath())
}
}
}
}