Files
Botania/build.gradle
T
Hubry 29686ede7b Put curio integration back
Curio rendering is handled by Curios again, gives us support for
hiding them for free. The method is a little bit ugly but I'd rather
avoid copying the logic that Curios has every time it changes
2020-07-02 23:56:08 +02:00

277 lines
7.5 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.+'
}
}
plugins {
id 'org.hidetake.ssh' version '2.10.1'
id "com.diffplug.gradle.spotless" version "3.27.2"
}
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
apply plugin: 'pmd'
ext.configFile = file('build.properties')
ext.config = parseConfig(configFile)
ext.priv = parseConfig(file('private.properties'))
def mc_version = "1.16.1"
version = "${config.version}-${config.build_number}"
if (System.getenv().RELEASE_MODE == null) {
version += '-SNAPSHOT'
}
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: "20200514-1.16"
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
runs {
client {
properties 'forge.logging.console.level': 'debug'
properties 'fml.earlyprogresswindow': 'false'
workingDirectory project.file('run')
mods {
botania {
source sourceSets.main
}
}
}
server {
properties 'forge.logging.console.level': 'debug'
workingDirectory project.file('run')
mods {
botania {
source sourceSets.main
}
}
}
data {
properties 'fml.earlyprogresswindow': 'false'
workingDirectory project.file('run')
mods {
botania {
source sourceSets.main
}
}
args '--mod', 'botania', '--all',
'--existing', '"' + file('src/main/resources/') + '"',
'--existing', '"' + file('src/generated/resources/') + '"',
'--output', '"' + file('src/generated/resources/') + '"'
}
}
}
sourceSets.main.resources {
srcDir 'src/generated/resources'
}
repositories {
mavenCentral()
maven {
url "https://maven.blamejared.com"
}
maven {
url "https://dvs1.progwml6.com/files/maven"
}
maven {
url "https://minecraft.curseforge.com/api/maven/"
}
maven {
name "curios"
url "https://maven.theillusivec4.top/"
}
}
test {
useJUnitPlatform()
}
dependencies {
minecraft "net.minecraftforge:forge:${mc_version}-32.0.32"
compileOnly fg.deobf("vazkii.patchouli:Patchouli:1.16-37:api")
runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:1.16-37")
compileOnly fg.deobf("mezz.jei:jei-1.16.1:7.0.0.2:api")
runtimeOnly fg.deobf("mezz.jei:jei-1.16.1:7.0.0.2")
compileOnly fg.deobf("top.theillusivec4.curios:curios:FORGE-1.16.1-3.0-beta2:api")
runtimeOnly fg.deobf("top.theillusivec4.curios:curios:FORGE-1.16.1-3.0-beta2")
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.6.1'
}
spotless {
enforceCheck = false // workaround around jenkins having wrong line endings in some files
// we explicitly check in github actions builds
java {
target '**/vazkii/botania/**/*.java'
targetExclude '**/buildcraft/*.java', '**/thaumcraft/*.java'
indentWithTabs()
licenseHeaderFile( 'spotless/license_template.txt')
eclipse().configFile 'spotless/eclipseformat.xml'
importOrderFile 'spotless/eclipse.importorder'
}
}
pmd {
ruleSets = ["java-braces"]
}
task checkSyntax {
dependsOn spotlessJavaCheck, pmdMain
}
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")],)
}
exclude "**/*.bat"
exclude "**/*.psd"
exclude "**/*.exe"
}
processResources {
// Exclude datagenerator .cache directory
exclude '.cache'
filesMatching('data/botania/patchouli_books/lexicon/book.json') {
filter {
it.replaceAll("buildNumber", config.build_number)
}
}
}
task srcJar(type: Jar) {
from(sourceSets.main.java)
classifier = 'sources'
}
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'
}
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${project.version}=${mc_version}")
file("${config.dir_repo}/version/${mc_version}.txt").write("${project.version}")
}
}
// SCP servers
remotes {
if (priv != null)
web {
host = 'botaniamod.net'
user = priv.scp_user
password = priv.scp_pass
knownHosts = allowAnyHosts
}
}
task upload {
doLast {
ssh.run {
session(remotes.web) {
put from: 'web/changelog.txt', into: priv.scp_dir + "/changelog.txt"
put from: 'web/versions.ini', into: priv.scp_dir + "/versions.ini"
}
}
}
}
task deployWeb {
doLast {
ssh.run {
session(remotes.web) {
def parent = file('web').toPath()
for (f in fileTree(dir: 'web')) {
def rel = parent.relativize(f.toPath()).toString().replace(File.separator, '/')
def dest = priv.scp_dir + rel
put from: f, into: dest
}
}
}
}
}
def parseConfig(File config) {
if(config.exists()){
config.withReader {
def prop = new Properties()
prop.load(it)
return (new ConfigSlurper().parse(prop))
}
} else {
return null
}
}
publishing {
tasks.publish.dependsOn build
publications {
mavenJava(MavenPublication) {
groupId project.group
artifactId project.archivesBaseName
version project.version
from components.java
artifact srcJar
artifact apiJar
pom.withXml {
def node = asNode()
if(node.dependencies.size() > 0)
node.remove(node.dependencies) // Remove deps, as they are all mappings-dependent and/or forge
}
}
}
repositories {
maven {
url "file://" + System.getenv("local_maven")
}
}
}
defaultTasks 'clean', 'checkSyntax', 'build'