BiomesOPlenty/build.gradle

243 lines
7.7 KiB
Groovy
Raw Normal View History

2014-10-04 14:37:48 +00:00
buildscript {
repositories {
mavenCentral()
maven {
name = 'sonatype-nexus-public'
url = 'https://oss.sonatype.org/content/repositories/public/'
2014-10-04 14:37:48 +00:00
}
maven {
name = 'forge-repo'
url = 'http://files.minecraftforge.net/maven/'
2014-10-04 14:37:48 +00:00
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
}
}
2014-11-27 06:42:50 +00:00
apply plugin: "forge"
2015-02-15 22:14:11 +00:00
apply plugin: "curseforge"
2014-10-04 14:37:48 +00:00
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
}
2014-10-05 01:07:24 +00:00
group = "com.github.glitchfiend.biomesoplenty"
2014-10-04 14:37:48 +00:00
version = config.mod_version
archivesBaseName = "BiomesOPlenty"
minecraft {
version = config.minecraft_version + "-" + config.forge_version // grab latest forge
2015-02-15 22:06:47 +00:00
mappings = "snapshot_nodoc_20150214"
2014-10-04 14:37:48 +00:00
}
// add some stuff to the version
version = "${config.minecraft_version}-${config.mod_version}.${System.getenv().BUILD_NUMBER}"
jenkins {
job = 'BiomesOPlenty'
}
// Source compiler configuration
tasks.withType(JavaCompile) {
2015-03-08 03:59:07 +00:00
//options.compilerArgs += [ '-Xlint:all', '-Xlint:-path', '-Xlint:-processing' ]
2015-02-15 22:40:13 +00:00
//options.deprecation = true
options.encoding = 'utf8'
}
def commonManifest = {
attributes 'FMLCorePlugin': 'biomesoplenty.common.asm.BOPLoadingPlugin'
attributes 'FMLCorePluginContainsFMLMod': 'true'
attributes 'ForceLoadAsMod': true
attributes 'FMLAT': 'biomesoplenty_at.cfg'
}
jar {
2015-03-10 05:33:46 +00:00
manifest commonManifest
classifier = 'universal'
}
2014-10-04 14:37:48 +00:00
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
2014-10-04 14:37:48 +00:00
])
}
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()});
2015-02-16 00:45:49 +00:00
setOutput(new DelayedFile(project, 'build/libs/' + project.getName() + '-' + project.version + '-changelog.txt'));
}
def curseChangelog
task createCurseChangelog {
2015-02-16 00:45:49 +00:00
def env = System.getenv()
def jenkinsUrl = env.JENKINS_URL
def jenkinsJob = env.JOB_NAME
def buildNumber = env.BUILD_NUMBER
if (jenkinsUrl != null && jenkinsJob != null && buildNumber != null) {
2015-02-16 00:56:14 +00:00
def auth = "console_script:dc6d48ca20a474beeac280a9a16a926e".getBytes().encodeBase64().toString()
2015-02-16 00:45:49 +00:00
def url = new URL("$jenkinsUrl/job/$jenkinsJob/$buildNumber/api/xml?depth=20").openConnection()
2015-02-16 00:56:14 +00:00
url.setRequestProperty("Authorization", "Basic " + auth)
2015-02-16 00:45:49 +00:00
String data = url.getInputStream().text
def xml = new XmlSlurper().parseText(data)
xml.changeSet.item.each { change ->
curseChangelog += "$change.author.fullName: $change.msg" + '\n'
2015-02-16 00:45:49 +00:00
}
}
}
2014-10-04 14:37:48 +00:00
tasks.build.dependsOn('createChangelog')
task sourceJar(type: Jar) {
from sourceSets.main.allJava
from (sourceSets.main.output) {
include 'LICENSE.txt'
}
2014-10-04 14:37:48 +00:00
classifier = 'sources'
}
task deobfJar(type: Jar) {
from sourceSets.main.output
manifest commonManifest
2014-10-04 14:37:48 +00:00
classifier = 'deobf'
}
artifacts {
archives sourceJar
archives deobfJar
}
2015-02-15 22:06:47 +00:00
curse {
dependsOn "createCurseChangelog"
2015-02-16 00:45:49 +00:00
2015-02-15 22:06:47 +00:00
projectId = project.config.curse_project_id
apiKey = "$System.env.curse_api_key"
changelog = curseChangelog
2015-02-15 22:06:47 +00:00
releaseType = project.config.curse_release_type
2015-02-15 22:58:20 +00:00
additionalArtifact deobfJar
additionalArtifact sourceJar
2015-02-15 22:06:47 +00:00
}
2015-01-12 01:06:26 +00:00
uploadArchives {
dependsOn 'reobf'
2014-10-04 14:37:48 +00:00
repositories {
if (project.hasProperty("filesmaven")) {
2015-01-12 01:06:26 +00:00
logger.info('Publishing to files server')
2014-10-04 14:37:48 +00:00
2015-01-12 01:06:26 +00:00
mavenDeployer {
configuration = configurations.deployJars
2014-10-04 14:37:48 +00:00
repository(url: project.filesmaven.url) {
authentication(userName: project.filesmaven.username, privateKey: project.filesmaven.key)
}
2014-10-04 14:37:48 +00:00
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' }
}
}
}
2014-10-04 14:37:48 +00:00
}
}
} else {
logger.info('Publishing to repo folder')
2014-10-04 14:37:48 +00:00
mavenDeployer {
pom.version = "${project.minecraft.version}-${project.version}"
repository(url: 'file://localhost/' + project.file('repo').getAbsolutePath())
2014-10-04 14:37:48 +00:00
}
}
}
}