mirror of
https://github.com/chylex/Hardcore-Ender-Expansion-2.git
synced 2025-01-22 04:45:59 +01:00
243 lines
6.2 KiB
Groovy
243 lines
6.2 KiB
Groovy
ext {
|
|
mc_version = "1.16.5"
|
|
forge_version = "36.1.32"
|
|
mixin_version = "0.8.2"
|
|
kotlin_mod_version = "1.13.0"
|
|
mapping_version = "20210309-1.16.5"
|
|
|
|
access_transformers = [
|
|
new File(rootProject.projectDir, "src/main/resources/META-INF/accesstransformer_main.cfg"),
|
|
new File(project(":system").projectDir, "src/main/resources/META-INF/accesstransformer_system.cfg"),
|
|
new File(project(":util").projectDir, "src/main/resources/META-INF/accesstransformer_util.cfg"),
|
|
]
|
|
}
|
|
|
|
buildscript {
|
|
ext {
|
|
forge_gradle_version = "4.1.+"
|
|
mixin_gradle_version = "0.7-SNAPSHOT"
|
|
kotlin_version = "1.7.0"
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
maven { url = "https://files.minecraftforge.net/maven" }
|
|
maven { url = "https://repo.spongepowered.org/maven" }
|
|
}
|
|
|
|
dependencies {
|
|
classpath group: "net.minecraftforge.gradle", name: "ForgeGradle", version: forge_gradle_version, changing: true
|
|
classpath group: "org.spongepowered", name: "mixingradle", version: mixin_gradle_version
|
|
classpath group: "org.jetbrains.kotlin", name: "kotlin-gradle-plugin", version: kotlin_version
|
|
}
|
|
}
|
|
|
|
apply plugin: "net.minecraftforge.gradle"
|
|
apply plugin: "org.spongepowered.mixin"
|
|
apply plugin: "eclipse"
|
|
apply plugin: "idea"
|
|
|
|
if (file("run/mods_deobf.gradle").exists()) {
|
|
apply from: "run/mods_deobf.gradle"
|
|
}
|
|
|
|
def prefixName = "displayName = "
|
|
def prefixVersion = "version = "
|
|
|
|
def metaLines = file("src/main/resources/META-INF/mods.toml").readLines()
|
|
def metaName = metaLines.find { line -> line.startsWith(prefixName) }.substring(prefixName.length())[1..-2]
|
|
def metaVersion = metaLines.find { line -> line.startsWith(prefixVersion) }.substring(prefixVersion.length())[1..-2]
|
|
|
|
group = "chylex.hee"
|
|
version = metaVersion
|
|
archivesBaseName = metaName.replaceAll("\\s", "")
|
|
|
|
idea {
|
|
module {
|
|
[".idea", ".settings", ".gradle", "build", "gradle", "run"].each {
|
|
excludeDirs += file(it)
|
|
}
|
|
|
|
["out", "src/main/kotlin", "src/test/kotlin"].each {
|
|
excludeDirs += file(it)
|
|
excludeDirs += file("modules/debug/" + it)
|
|
excludeDirs += file("modules/system/" + it)
|
|
excludeDirs += file("modules/util/" + it)
|
|
}
|
|
|
|
["src/main/kotlin", "src/test/kotlin"].each {
|
|
excludeDirs += file("data/" + it)
|
|
}
|
|
}
|
|
}
|
|
|
|
allprojects {
|
|
apply plugin: "kotlin"
|
|
|
|
sourceCompatibility = targetCompatibility = "1.8"
|
|
|
|
tasks.withType(JavaCompile) {
|
|
sourceCompatibility = targetCompatibility = "1.8"
|
|
}
|
|
|
|
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
|
|
kotlinOptions {
|
|
jvmTarget = "1.8"
|
|
apiVersion = "1.7"
|
|
languageVersion = "1.7"
|
|
freeCompilerArgs = [
|
|
"-Xno-call-assertions",
|
|
"-Xno-param-assertions",
|
|
"-Xno-receiver-assertions",
|
|
"-XXLanguage:+InlineClasses",
|
|
]
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
maven { url = "https://files.minecraftforge.net/maven" }
|
|
maven { url = "https://thedarkcolour.github.io/KotlinForForge" }
|
|
}
|
|
|
|
dependencies {
|
|
implementation "org.jetbrains.kotlin:kotlin-stdlib"
|
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
|
implementation "org.jetbrains.kotlin:kotlin-reflect"
|
|
}
|
|
|
|
if (file("$buildDir/classes").exists()) {
|
|
file("$buildDir/classes/java/main").mkdirs() // Forge complains when the java folder is missing
|
|
}
|
|
}
|
|
|
|
sourceSets {
|
|
main {
|
|
resources {
|
|
srcDirs += file("data/gen")
|
|
exclude ".cache"
|
|
}
|
|
}
|
|
}
|
|
|
|
minecraft {
|
|
mappings channel: "snapshot", version: rootProject.mapping_version
|
|
setAccessTransformers(rootProject.access_transformers)
|
|
|
|
runs {
|
|
client {
|
|
property "mixin.env.remapRefMap", "true"
|
|
property "mixin.env.refMapRemappingFile", "${projectDir}/build/createSrgToMcp/output.srg"
|
|
arg "-mixin.config=hee.mixins.json"
|
|
|
|
workingDirectory file("run")
|
|
|
|
mods {
|
|
hee {
|
|
source sourceSets.main
|
|
source project(":debug").sourceSets.main
|
|
source project(":system").sourceSets.main
|
|
source project(":util").sourceSets.main
|
|
}
|
|
}
|
|
}
|
|
|
|
server {
|
|
property "mixin.env.remapRefMap", "true"
|
|
property "mixin.env.refMapRemappingFile", "${projectDir}/build/createSrgToMcp/output.srg"
|
|
arg "-mixin.config=hee.mixins.json"
|
|
|
|
workingDirectory file("run")
|
|
|
|
mods {
|
|
hee {
|
|
source sourceSets.main
|
|
source project(":debug").sourceSets.main
|
|
source project(":system").sourceSets.main
|
|
source project(":util").sourceSets.main
|
|
}
|
|
}
|
|
}
|
|
|
|
data {
|
|
args "--mod", "hee"
|
|
args "--all"
|
|
args "--output", file("data/gen")
|
|
args "--existing", sourceSets.main.resources.srcDirs.first().toString()
|
|
|
|
workingDirectory file("run")
|
|
ideaModule project.name + "." + project(":datagen").name + ".main"
|
|
|
|
mods {
|
|
hee {
|
|
source sourceSets.main
|
|
source project(":debug").sourceSets.main
|
|
source project(":system").sourceSets.main
|
|
source project(":util").sourceSets.main
|
|
source project(":datagen").sourceSets.main
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
mixin {
|
|
add sourceSets.main, "hee.refmap.json"
|
|
}
|
|
|
|
dependencies {
|
|
minecraft "net.minecraftforge:forge:" + mc_version + "-" + forge_version
|
|
|
|
implementation project(":util")
|
|
implementation project(":system")
|
|
implementation "thedarkcolour:kotlinforforge:" + kotlin_mod_version
|
|
|
|
testImplementation project(":util")
|
|
testImplementation project(":system")
|
|
testImplementation "org.junit.jupiter:junit-jupiter-api:5.3.0-RC1"
|
|
|
|
if (System.getProperty("idea.sync.active") != "true") {
|
|
annotationProcessor "org.spongepowered:mixin:" + mixin_version + ":processor"
|
|
testAnnotationProcessor "org.spongepowered:mixin:" + mixin_version + ":processor"
|
|
}
|
|
}
|
|
|
|
test {
|
|
systemProperty "junit.jupiter.testinstance.lifecycle.default", "per_class"
|
|
}
|
|
|
|
jar {
|
|
archiveName = archivesBaseName + "-" + mc_version + "-v" + version + ".jar"
|
|
|
|
["system", "util"].each {
|
|
from(project(":" + it).sourceSets.main.output) {
|
|
exclude "pack.mcmeta"
|
|
exclude "META-INF/*.kotlin_module"
|
|
}
|
|
}
|
|
|
|
from("./data/gen") {
|
|
exclude ".cache"
|
|
}
|
|
|
|
from("./") {
|
|
include "LICENSE"
|
|
}
|
|
|
|
manifest {
|
|
attributes([
|
|
"Specification-Title" : "hee",
|
|
"Specification-Version" : "1",
|
|
"Specification-Vendor" : "chylex",
|
|
|
|
"Implementation-Title" : metaName,
|
|
"Implementation-Version" : metaVersion,
|
|
"Implementation-Vendor" : "chylex",
|
|
|
|
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
|
|
|
|
"MixinConfigs" : "hee.mixins.json"
|
|
])
|
|
}
|
|
}
|