mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-18 03:15:07 +00:00
292 lines
8.2 KiB
Groovy
292 lines
8.2 KiB
Groovy
buildscript {
|
|
repositories {
|
|
mavenCentral()
|
|
maven {
|
|
name = "forge"
|
|
url = "https://files.minecraftforge.net/maven"
|
|
}
|
|
}
|
|
dependencies {
|
|
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.0.+'
|
|
// classpath 'com.matthewprenger:CurseGradle:1.0-SNAPSHOT'
|
|
}
|
|
}
|
|
apply plugin: 'net.minecraftforge.gradle'
|
|
apply plugin: 'eclipse'
|
|
apply plugin: 'maven'
|
|
|
|
|
|
// apply plugin: 'com.matthewprenger.cursegradle'
|
|
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
|
|
|
|
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'
|
|
|
|
minecraft {
|
|
mappings channel: 'snapshot', version: "${config.mc_mappings}"
|
|
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
|
|
runs {
|
|
client {
|
|
properties 'forge.logging.markers': 'REGISTRIES,REGISTRYDUMP'
|
|
properties 'forge.logging.console.level': 'debug'
|
|
properties 'fml.earlyprogresswindow': 'false'
|
|
workingDirectory project.file('run')
|
|
mods {
|
|
botania {
|
|
source sourceSets.main
|
|
}
|
|
}
|
|
}
|
|
server {
|
|
properties 'forge.logging.markers': 'REGISTRIES,REGISTRYDUMP'
|
|
properties 'forge.logging.console.level': 'debug'
|
|
workingDirectory project.file('run')
|
|
mods {
|
|
botania {
|
|
source sourceSets.main
|
|
}
|
|
}
|
|
}
|
|
data {
|
|
properties 'forge.logging.markers': 'REGISTRIES,REGISTRYDUMP'
|
|
properties 'forge.logging.console.level': 'debug'
|
|
properties 'fml.earlyprogresswindow': 'false'
|
|
workingDirectory project.file('run')
|
|
mods {
|
|
botania {
|
|
source sourceSets.main
|
|
}
|
|
}
|
|
args '--mod', 'botania', '--all', '--output', file('src/generated/resources/')
|
|
}
|
|
}
|
|
// 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.
|
|
}
|
|
|
|
sourceSets.main.resources {
|
|
srcDir 'src/generated/resources'
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
maven {
|
|
name = "buildcraft"
|
|
url = "https://mod-buildcraft.com/maven"
|
|
}
|
|
maven {
|
|
name = "thiakil"
|
|
url = "http://maven.thiakil.com"
|
|
}
|
|
maven {
|
|
url = "http://dvs1.progwml6.com/files/maven"
|
|
}
|
|
maven {
|
|
url = "http://minecraft.curseforge.com/api/maven/"
|
|
}
|
|
maven {
|
|
name = "curios"
|
|
url = "https://maven.theillusivec4.top/"
|
|
}
|
|
flatDir {
|
|
dirs 'libs'
|
|
}
|
|
}
|
|
|
|
//This here is for SCP
|
|
configurations {
|
|
sshAntTask
|
|
}
|
|
//End of the SCP config
|
|
|
|
dependencies {
|
|
minecraft "net.minecraftforge:forge:${config.forge_version}"
|
|
compile fg.deobf("vazkii:patchouli:1.1-22")
|
|
|
|
compileOnly fg.deobf("mezz.jei:jei-1.14.4:6.0.0.11:api")
|
|
runtimeOnly fg.deobf("mezz.jei:jei-1.14.4:6.0.0.11")
|
|
|
|
compileOnly fg.deobf("top.theillusivec4.curios:curios:FORGE-1.14.4-1.0.2:api")
|
|
runtimeOnly fg.deobf("top.theillusivec4.curios:curios:FORGE-1.14.4-1.0.2")
|
|
|
|
//and a bit more for SCP
|
|
sshAntTask "org.apache.ant:ant-jsch:1.7.1", "jsch:jsch:0.1.29"
|
|
}
|
|
|
|
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}"
|
|
}
|
|
|
|
jar {
|
|
manifest {
|
|
attributes(["Specification-Title": "botania",
|
|
"Specification-Vendor": "botania",
|
|
"Specification-Version": "1",
|
|
"Implementation-Title": project.name,
|
|
"Implementation-Version": "${version}",
|
|
"Implementation-Vendor": "botania",
|
|
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")],)
|
|
}
|
|
|
|
//rename the default output, for some better... sanity with scipts
|
|
archiveName = "${baseName} ${version}.${extension}"
|
|
|
|
exclude "**/*.bat"
|
|
exclude "**/*.psd"
|
|
exclude "**/*.exe"
|
|
}
|
|
|
|
task srcJar(type: Jar) {
|
|
from(sourceSets.main.java)
|
|
classifier = 'sources'
|
|
archiveName = "${baseName} ${version}-sources.${extension}"
|
|
}
|
|
|
|
task apiJar(type: Jar) {
|
|
// Remove sources from the api jar when MinecraftForge/ForgeGradle#369 is fixed
|
|
from(sourceSets.main.allJava)
|
|
from(sourceSets.main.output)
|
|
include 'vazkii/botania/api/**'
|
|
|
|
classifier = 'api'
|
|
archiveName = "${baseName} ${version}-api.${extension}"
|
|
}
|
|
|
|
artifacts {
|
|
archives srcJar, apiJar
|
|
}
|
|
|
|
/**
|
|
* Increments the buildnumber in your config file, and saves it
|
|
* Note: The doFirst is important, without it the build number
|
|
* will be incremented every time tasks are configured, i.e every
|
|
* time gradle is run on this project.
|
|
*/
|
|
task incrementBuildNumber {
|
|
doFirst {
|
|
config.build_number = (config.build_number.toString().toInteger()) + 1
|
|
configFile.withWriter {
|
|
config.toProperties().store(it, "")
|
|
}
|
|
|
|
file('web/versions.ini').append("\n${version}=${minecraft.version}")
|
|
file("${config.dir_repo}/version/${minecraft.version}.txt").write("${version}")
|
|
}
|
|
}
|
|
|
|
|
|
import java.util.regex.Pattern
|
|
|
|
task sortArtifacts(type: Copy) {
|
|
from jar.destinationDir
|
|
into config.dir_output
|
|
//Put each jar with a classifier in a subfolder with the classifier as its name
|
|
eachFile {
|
|
//This matcher is used to get the classifier of the jar
|
|
def matcher = Pattern.compile("$config.mod_name $version-(?<classifier>\\w+).jar").matcher(it.name)
|
|
//Only change the destination for full matches, i.e jars with classifiers
|
|
if (matcher.matches())
|
|
{
|
|
def classifier = matcher.group('classifier')
|
|
/* Set the relative path to change the destination, since
|
|
* Gradle doesn't seem to like the absolute path being set*/
|
|
it.relativePath = it.relativePath.parent.append(false, classifier, it.name)
|
|
}
|
|
}
|
|
}
|
|
|
|
// This is the upload task from the build.xml
|
|
task upload {
|
|
doLast {
|
|
scp('/') {
|
|
fileset(file: 'web/changelog.txt')
|
|
fileset(file: 'web/versions.ini')
|
|
}
|
|
}
|
|
}
|
|
|
|
// This is deploy_web task
|
|
task deployWeb {
|
|
doLast {
|
|
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
|
|
}
|
|
}
|
|
|
|
/*
|
|
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 'curios'
|
|
optionalLibrary 'quark'
|
|
optionalLibrary 'albedo'
|
|
}
|
|
}
|
|
}
|
|
*/
|
|
|
|
uploadArchives {
|
|
repositories {
|
|
mavenDeployer {
|
|
repository(url: "file://" + (System.getenv("local_maven") != null ? System.getenv("local_maven") : System.getenv("bamboo_local_maven")))
|
|
}
|
|
}
|
|
}
|
|
// tasks.uploadArchives.dependsOn reobfJar
|
|
|
|
defaultTasks 'clean', 'runData', 'build', 'sortArtifacts', 'incrementBuildNumber', 'upload'
|