BiomesOPlenty/build.gradle

238 lines
7.1 KiB
Groovy
Raw Normal View History

buildscript {
repositories {
jcenter()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
}
dependencies {
2016-05-20 23:23:08 +00:00
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
}
}
plugins {
id "com.matthewprenger.cursegradle" version "1.0.5"
}
2015-12-17 11:17:18 +00:00
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'maven'
2014-10-04 14:37:48 +00:00
// 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"
// why set the version twice?
2014-10-04 14:37:48 +00:00
version = config.mod_version
2015-06-19 09:58:24 +00:00
archivesBaseName = "BiomesOPlenty"
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}"
// set this for the version.properties file, or was this broken on purpose?
config.build_number = (System.getenv().BUILD_NUMBER) ? System.getenv().BUILD_NUMBER : ""
2014-10-04 14:37:48 +00:00
minecraft {
version = config.minecraft_version + "-" + config.forge_version // grab latest forge
useDepAts = true
2016-01-05 14:49:13 +00:00
mappings = project.config.mappings_version
//gradle complains if this isn't set when setting up/using IDEA workspace
runDir = "run"
//set a full version string with appended build number to be used in mod registration
def buildnum = (config.build_number!="") ? '.' + config.build_number : ""
replace '@MOD_VERSION@', config.mod_version + buildnum
replaceIn 'BiomesOPlenty.java'
2014-10-04 14:37:48 +00:00
}
def commonManifest = {
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'
}
}
2015-12-16 15:16:35 +00:00
2015-12-15 08:36:54 +00:00
import net.minecraftforge.gradle.tasks.JenkinsChangelog
2014-10-04 14:37:48 +00:00
import net.minecraftforge.gradle.common.Constants
2015-12-16 15:16:35 +00:00
task changelog(type: JenkinsChangelog) {
2014-10-04 14:37:48 +00:00
def buildNumber = "${System.getenv().BUILD_NUMBER}"
2015-12-15 08:36:54 +00:00
serverRoot = 'http://ci.jenkins.minecraftforge.net/'
jobName = 'BiomesOPlenty'
authName = 'console_script';
authPassword = 'dc6d48ca20a474beeac280a9a16a926e';
targetBuild = buildNumber.toString();
output = 'build/libs/' + project.getName() + '-' + project.version + '-changelog.txt';
}
2014-10-04 14:37:48 +00:00
2015-12-16 15:16:35 +00:00
tasks.build.dependsOn('changelog')
2014-10-04 14:37:48 +00:00
2015-12-15 08:36:54 +00:00
task sourcesJar(type: Jar) {
2014-10-04 14:37:48 +00:00
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'
}
2016-04-23 01:22:04 +00:00
task apiJar(type: Jar) {
from(sourceSets.main.allJava) {
include 'biomesoplenty/api/**'
}
from (sourceSets.main.output) {
include 'LICENSE.txt'
}
classifier = 'api'
}
2015-12-17 07:44:55 +00:00
task listOutputs << {
//This is needed by the Groovy Postbuild to append labels for each build used in the changelog.
println "Output files:"
println "--------------------"
def list = []
def dir = new File("build/libs/")
if (dir.exists()) {
dir.eachFileRecurse (FileType.FILES) { file ->
//Add each file to the list
list << file
}
//Print the names of all of the output files
list.each {
println it.getName()
}
}
println "--------------------"
2015-12-17 07:44:55 +00:00
}
tasks.build.finalizedBy('listOutputs')
2015-12-17 07:44:55 +00:00
2014-10-04 14:37:48 +00:00
artifacts {
archives changelog.output
2015-12-15 08:36:54 +00:00
archives sourcesJar
2014-10-04 14:37:48 +00:00
archives deobfJar
2016-04-23 01:22:04 +00:00
archives apiJar
2014-10-04 14:37:48 +00:00
}
curseforge {
apiKey = "$System.env.curse_api_key"
project {
id = '220318'
changelog = file('build/libs/' + project.getName() + '-' + project.version + '-changelog.txt');
releaseType = 'beta'
}
}
2015-12-17 06:31:18 +00:00
import groovy.io.FileType
2015-01-12 01:06:26 +00:00
uploadArchives {
repositories {
mavenDeployer {
2016-01-01 02:19:16 +00:00
if (project.hasProperty('forgeMavenPassword'))
2016-01-01 01:45:34 +00:00
{
2016-01-01 02:19:16 +00:00
repository(url: "http://files.minecraftforge.net/maven/manage/upload") {
2016-01-01 02:39:38 +00:00
authentication(userName: project.getProperty('forgeMavenUsername'), password: project.getProperty('forgeMavenPassword'))
2016-01-01 01:45:34 +00:00
}
}
else
{
// local repo folder. Might wanna juset use gradle install if you wanans end it to maven-local
repository(url: 'file://localhost/' + project.file('repo').getAbsolutePath())
}
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' }
}
}
}
}
}
}
}