[Fabric, Forge] Update build files for 1.16.3

No actual changes, beta 4 is functional, but this was to ensure it
compiled.
Dieser Commit ist enthalten in:
Octavia Togami 2020-09-10 16:14:09 -07:00 committet von Aurora
Ursprung 13b89900ab
Commit 95640fe44f
2 geänderte Dateien mit 81 neuen und 23 gelöschten Zeilen

Datei anzeigen

@ -1,15 +1,33 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import net.fabricmc.loom.LoomGradleExtension
import net.fabricmc.loom.task.RemapJarTask
buildscript {
repositories {
mavenCentral()
maven {
name = "Fabric"
url = uri("https://maven.fabricmc.net/")
}
}
dependencies {
classpath("net.fabricmc:fabric-loom:${versions.loom}")
}
}
applyPlatformAndCoreConfiguration()
applyShadowConfiguration()
apply(plugin = "fabric-loom")
apply(plugin = "java-library")
val minecraftVersion = "1.15.2"
val yarnMappings = "1.15.2+build.14:v2"
val loaderVersion = "0.7.8+build.189"
configure<LoomGradleExtension> {
accessWidener("src/main/resources/worldedit.accesswidener")
}
val minecraftVersion = "1.16.3"
val yarnMappings = "1.16.3+build.1:v2"
val loaderVersion = "0.9.3+build.207"
configurations.all {
resolutionStrategy {
@ -17,30 +35,74 @@ configurations.all {
}
}
val fabricApiConfiguration: Configuration = configurations.create("fabricApi")
repositories {
maven {
name = "Fabric"
url = uri("https://maven.fabricmc.net/")
}
}
dependencies {
"compile"(project(":worldedit-core"))
"compile"("org.apache.logging.log4j:log4j-slf4j-impl:2.8.1")
"api"(project(":worldedit-core"))
"implementation"("org.apache.logging.log4j:log4j-slf4j-impl:2.8.1")
"minecraft"("com.mojang:minecraft:$minecraftVersion")
"mappings"("net.fabricmc:yarn:$yarnMappings")
"modCompile"("net.fabricmc:fabric-loader:$loaderVersion")
"modImplementation"("net.fabricmc:fabric-loader:$loaderVersion")
listOf(
"net.fabricmc.fabric-api:fabric-api-base:0.1.2+28f8190f42",
"net.fabricmc.fabric-api:fabric-events-interaction-v0:0.2.6+12515ed975",
"net.fabricmc.fabric-api:fabric-events-lifecycle-v0:0.1.2+b7f9825de8",
"net.fabricmc.fabric-api:fabric-networking-v0:0.1.7+12515ed975"
).forEach {
// [1] declare fabric-api dependency...
"fabricApi"("net.fabricmc.fabric-api:fabric-api:0.20.2+build.402-1.16")
// [2] Load the API dependencies from the fabric mod json...
@Suppress("UNCHECKED_CAST")
val fabricModJson = file("src/main/resources/fabric.mod.json").bufferedReader().use {
groovy.json.JsonSlurper().parse(it) as Map<String, Map<String, *>>
}
val wantedDependencies = (fabricModJson["depends"] ?: error("no depends in fabric.mod.json")).keys
.filter { it == "fabric-api-base" || it.contains(Regex("v\\d$")) }
.map { "net.fabricmc.fabric-api:$it" }
logger.lifecycle("Looking for these dependencies:")
for (wantedDependency in wantedDependencies) {
logger.lifecycle(wantedDependency)
}
// [3] and now we resolve it to pick out what we want :D
val fabricApiDependencies = fabricApiConfiguration.incoming.resolutionResult.allDependencies
.onEach {
if (it is UnresolvedDependencyResult) {
throw kotlin.IllegalStateException("Failed to resolve Fabric API", it.failure)
}
}
.filterIsInstance<ResolvedDependencyResult>()
// pick out transitive dependencies
.flatMap {
it.selected.dependencies
}
// grab the requested versions
.map { it.requested }
.filterIsInstance<ModuleComponentSelector>()
// map to standard notation
.associateByTo(
mutableMapOf(),
keySelector = { "${it.group}:${it.module}" },
valueTransform = { "${it.group}:${it.module}:${it.version}" }
)
fabricApiDependencies.keys.retainAll(wantedDependencies)
// sanity check
for (wantedDep in wantedDependencies) {
check(wantedDep in fabricApiDependencies) { "Fabric API library $wantedDep is missing!" }
}
fabricApiDependencies.values.forEach {
"include"(it)
"modImplementation"(it)
}
// Hook these up manually, because Fabric doesn't seem to quite do it properly.
"compileClasspath"("net.fabricmc:sponge-mixin:${project.versions.mixin}")
"compileOnly"("net.fabricmc:sponge-mixin:${project.versions.mixin}")
"annotationProcessor"("net.fabricmc:sponge-mixin:${project.versions.mixin}")
"annotationProcessor"("net.fabricmc:fabric-loom:${project.versions.loom}")
"testCompile"("org.mockito:mockito-core:1.9.0-rc1")
}
configure<BasePluginConvention> {
@ -62,12 +124,7 @@ tasks.named<Copy>("processResources") {
}
}
tasks.named<Jar>("jar") {
manifest {
attributes("Class-Path" to CLASSPATH,
"WorldEdit-Version" to project.version)
}
}
addJarManifest(includeClasspath = true)
tasks.named<ShadowJar>("shadowJar") {
archiveClassifier.set("dist-dev")
@ -97,6 +154,7 @@ tasks.register<RemapJarTask>("remapShadowJar") {
input.set(shadowJar.archiveFile)
archiveFileName.set(shadowJar.archiveFileName.get().replace(Regex("-dev\\.jar$"), ".jar"))
addNestedDependencies.set(true)
remapAccessWidener.set(true)
}
tasks.named("assemble").configure {

Datei anzeigen

@ -12,12 +12,12 @@ plugins {
applyPlatformAndCoreConfiguration()
applyShadowConfiguration()
val minecraftVersion = "1.16.2"
val minecraftVersion = "1.16.3"
val nextMajorMinecraftVersion: String = minecraftVersion.split('.').let { (useless, major) ->
"$useless.${major.toInt() + 1}"
}
val mappingsMinecraftVersion = "1.16"
val forgeVersion = "32.0.92"
val forgeVersion = "34.0.0"
configurations.all {
resolutionStrategy {