mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-16 10:34:40 +00:00
* Formatting fixes for my previous PRs * Bump Forge, JEI and Thaumcraft and specify some of them in mod deps Forge to latest recommended (TC requires it) Thaumcraft to Beta 21 (the new aspect registration) JEI to stable 4.10.0.198 (mostly for testing purposes like Thaumic JEI) * Move to the aspect event and tweak some item aspects
277 lines
6.6 KiB
Groovy
277 lines
6.6 KiB
Groovy
import groovy.json.JsonSlurper
|
|
import groovy.json.JsonOutput
|
|
|
|
buildscript {
|
|
repositories {
|
|
mavenCentral()
|
|
maven {
|
|
name = "forge"
|
|
url = "http://files.minecraftforge.net/maven"
|
|
}
|
|
maven {
|
|
name = "sonatype"
|
|
url = "https://oss.sonatype.org/content/repositories/snapshots/"
|
|
}
|
|
}
|
|
dependencies {
|
|
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
|
|
classpath 'com.matthewprenger:CurseGradle:1.0-SNAPSHOT'
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
maven {
|
|
name = "thiakil"
|
|
url = "http://maven.thiakil.com"
|
|
}
|
|
maven {
|
|
url = "http://dvs1.progwml6.com/files/maven"
|
|
}
|
|
maven {
|
|
url = "http://minecraft.curseforge.com/api/maven/"
|
|
}
|
|
}
|
|
|
|
apply plugin: 'net.minecraftforge.gradle.forge'
|
|
apply plugin: 'com.matthewprenger.cursegradle'
|
|
apply plugin: 'maven'
|
|
|
|
ext.configFile = file('build.properties')
|
|
|
|
ext.config = parseConfig(configFile)
|
|
ext.priv = parseConfig(file('private.properties'))
|
|
|
|
version = "${config.version}-${config.build_number}"
|
|
group = "vazkii.botania" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
|
archivesBaseName = config.mod_name
|
|
|
|
if (System.getenv().BUILD_NUMBER != null) {
|
|
//adds the build number to the end of the version string if on a build server
|
|
version += ".${System.getenv().BUILD_NUMBER}"
|
|
}
|
|
|
|
minecraft {
|
|
version = "${config.mc_version}-${config.forge_version}"
|
|
runDir = "eclipse/assets"
|
|
|
|
mappings = config.mc_mappings
|
|
//This, does the token replacement.
|
|
//Though, I reccomend this to be replaced with a token such as @VERSION@
|
|
replace 'GRADLE:BUILD', config.build_number
|
|
replace 'GRADLE:VERSION', config.version
|
|
|
|
replaceIn 'LibMisc.java' //I may have missed another file, though I can only find it in here.
|
|
useDepAts = true
|
|
makeObfSourceJar = false
|
|
}
|
|
|
|
//This here is for SCP
|
|
configurations {
|
|
sshAntTask
|
|
}
|
|
|
|
//End of the SCP config
|
|
|
|
jar {
|
|
classifier = 'universal'
|
|
manifest {
|
|
attributes 'FMLAT': 'botania_at.cfg'
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
deobfCompile "com.azanor.baubles:Baubles:1.12-1.5.2"
|
|
deobfCompile "mezz.jei:jei_1.12.2:4.10.0.198"
|
|
deobfCompile "thaumcraft:Thaumcraft:1.12.2:6.1.BETA21"
|
|
|
|
//and a bit more for SCP
|
|
sshAntTask "org.apache.ant:ant-jsch:1.7.1", "jsch:jsch:0.1.29"
|
|
}
|
|
|
|
compileJava {
|
|
sourceCompatibility = 1.8
|
|
targetCompatibility = 1.8
|
|
}
|
|
|
|
sourceCompatibility = 1.8
|
|
targetCompatibility = 1.8
|
|
|
|
processResources {
|
|
// replace stuff in mcmod.info, nothing else
|
|
from(sourceSets.main.resources.srcDirs) {
|
|
include 'mcmod.info'
|
|
|
|
// replace version and mcversion
|
|
expand 'version': project.version, 'mcversion': project.minecraft.version
|
|
}
|
|
|
|
// copy everything else, thats not the mcmod.info
|
|
from(sourceSets.main.resources.srcDirs) {
|
|
exclude 'mcmod.info'
|
|
}
|
|
}
|
|
|
|
/**
|
|
* These, go outside of the processResources {}* Though, this was added with the NEI intergation commit (8bf4680)
|
|
*/
|
|
task deobfJar(type: Jar) {
|
|
from(sourceSets.main.output)
|
|
archiveName = "${baseName} ${version}-deobf.${extension}"
|
|
}
|
|
|
|
artifacts {
|
|
archives deobfJar
|
|
}
|
|
/**
|
|
* Increments the buildnumber in your config file, and saves it
|
|
*/
|
|
task incrementBuildNumber(dependsOn: 'reobfJar') << {
|
|
config.build_number = (config.build_number.toString().toInteger()) + 1
|
|
configFile.withWriter {
|
|
config.toProperties().store(it, "")
|
|
}
|
|
|
|
// todo make this flexibile - collection of supported mc versions
|
|
|
|
file('web/versions.ini').append("\n${version}=${minecraft.version}")
|
|
file("${config.dir_repo}/version/${minecraft.version}.txt").write("${version}")
|
|
}
|
|
|
|
// I have no idea what I'm doing
|
|
task wtfGradle2(type: Copy) {
|
|
from(jar.destinationDir)
|
|
into file("${config.dir_output}/wtf")
|
|
}
|
|
|
|
// Seriously, I'm desperate to make this work
|
|
task wtfGradle1(type: Delete) {
|
|
dependsOn "wtfGradle2"
|
|
delete "${config.dir_output}/wtf/${deobfJar.archiveName}"
|
|
}
|
|
|
|
task output(type: Copy) {
|
|
dependsOn "wtfGradle1"
|
|
from(jar.destinationDir)
|
|
into file(config.dir_output)
|
|
}
|
|
|
|
task outputDeobf(type: Copy) {
|
|
dependsOn "output"
|
|
from(config.dir_output) {
|
|
include deobfJar.archiveName
|
|
}
|
|
into file("${config.dir_output}/deobf")
|
|
}
|
|
|
|
task forgecraft(type: Copy) {
|
|
if(priv == null){
|
|
return;
|
|
}
|
|
dependsOn "outputDeobf"
|
|
from "${config.dir_output}/wtf"
|
|
into file(priv.dir_forgecraft)
|
|
}
|
|
|
|
task sort(type: Delete) {
|
|
dependsOn "forgecraft"
|
|
delete "${config.dir_output}/${deobfJar.archiveName}", "${config.dir_output}/wtf"
|
|
}
|
|
|
|
// This is the upload task from the build.xml
|
|
task upload() << {
|
|
scp('/files') {
|
|
fileset(file: jar.archivePath)
|
|
}
|
|
|
|
scp('/files/deobf') {
|
|
fileset(file: deobfJar.archivePath)
|
|
}
|
|
|
|
scp('/') {
|
|
fileset(file: 'web/changelog.txt')
|
|
fileset(file: 'web/versions.ini')
|
|
}
|
|
}
|
|
|
|
// This is deploy_web task
|
|
task deployWeb << {
|
|
scp('/') {
|
|
fileset(dir: 'web') //everything from the web directory
|
|
}
|
|
}
|
|
|
|
def scp(String dir, Closure antFileset = {}) {
|
|
ant {
|
|
taskdef(
|
|
name: 'scp',
|
|
classname: 'org.apache.tools.ant.taskdefs.optional.ssh.Scp',
|
|
classpath: configurations.sshAntTask.asPath)
|
|
|
|
String dirstr = priv.scp_dir + dir
|
|
Map scpArgs = [
|
|
todir : dirstr,
|
|
password : priv.scp_pass,
|
|
sftp: true,
|
|
trust: 'yes'
|
|
]
|
|
|
|
delegate.scp(scpArgs) {
|
|
antFileset.delegate = delegate
|
|
antFileset()
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
def parseConfig(File config) {
|
|
if(config.exists()){
|
|
config.withReader {
|
|
def prop = new Properties()
|
|
prop.load(it)
|
|
return (new ConfigSlurper().parse(prop))
|
|
}
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
jar {
|
|
//rename the default output, for some better... sanity with scipts
|
|
archiveName = "${baseName} ${version}.${extension}"
|
|
|
|
exclude "**/*.bat"
|
|
exclude "**/*.psd"
|
|
exclude "**/*.exe"
|
|
}
|
|
|
|
curseforge {
|
|
if(priv == null){
|
|
return;
|
|
}
|
|
apiKey = priv.cfkey
|
|
project {
|
|
id = "225643"
|
|
changelog = """
|
|
See http://botaniamod.net/changelog.php#${version}
|
|
"""
|
|
releaseType = "release"
|
|
addGameVersion "${config.cf_meta_version}"
|
|
relations {
|
|
requiredLibrary 'baubles'
|
|
optionalLibrary 'quark'
|
|
optionalLibrary 'albedo'
|
|
}
|
|
}
|
|
}
|
|
|
|
uploadArchives {
|
|
repositories {
|
|
mavenDeployer {
|
|
repository(url: "file://" + (System.getenv("local_maven") != null ? System.getenv("local_maven") : System.getenv("bamboo_local_maven")))
|
|
}
|
|
}
|
|
}
|
|
|
|
defaultTasks 'clean', 'build', 'sort', 'forgecraft', 'incrementBuildNumber', 'curseforge', 'upload'
|