From 876108fdb3f2ac9ed3f23fce21e43cd8d86738de Mon Sep 17 00:00:00 2001 From: Octavia Togami Date: Thu, 13 May 2021 22:01:45 -0700 Subject: [PATCH] Prepare for Gradle 7, but due to FG only get to 6.9 Gradle 7 stuff requires FG 5. Phooey. --- buildSrc/build.gradle.kts | 6 ++---- buildSrc/src/main/kotlin/CommonConfig.kt | 19 +++++++++++-------- buildSrc/src/main/kotlin/PlatformConfig.kt | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- worldedit-core/build.gradle.kts | 16 +++++++--------- worldedit-fabric/build.gradle.kts | 11 ++--------- worldedit-forge/build.gradle.kts | 11 +---------- 7 files changed, 25 insertions(+), 42 deletions(-) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 3c22a8d95..2e1c4811d 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -36,14 +36,12 @@ dependencies { implementation(gradleApi()) - implementation("gradle.plugin.net.minecrell:licenser:0.4.1") + implementation("gradle.plugin.org.cadixdev.gradle:licenser:0.6.0") implementation("org.ajoberstar.grgit:grgit-gradle:4.1.0") implementation("com.github.jengelman.gradle.plugins:shadow:6.1.0") - implementation("net.ltgt.apt-eclipse:net.ltgt.apt-eclipse.gradle.plugin:0.21") - implementation("net.ltgt.apt-idea:net.ltgt.apt-idea.gradle.plugin:0.21") implementation("org.jfrog.buildinfo:build-info-extractor-gradle:4.21.0") implementation("org.spongepowered:SpongeGradle:0.11.5") - implementation("net.minecraftforge.gradle:ForgeGradle:4.1.7") + implementation("net.minecraftforge.gradle:ForgeGradle:4.1.12") implementation("net.fabricmc:fabric-loom:$loomVersion") implementation("net.fabricmc:sponge-mixin:$mixinVersion") implementation("org.enginehub.gradle:gradle-codecov-plugin:0.1.0") diff --git a/buildSrc/src/main/kotlin/CommonConfig.kt b/buildSrc/src/main/kotlin/CommonConfig.kt index 782ce8ef8..13179e17c 100644 --- a/buildSrc/src/main/kotlin/CommonConfig.kt +++ b/buildSrc/src/main/kotlin/CommonConfig.kt @@ -1,11 +1,10 @@ -import net.minecrell.gradle.licenser.LicenseExtension +import org.cadixdev.gradle.licenser.LicenseExtension import org.gradle.api.Project import org.gradle.api.plugins.JavaPluginExtension import org.gradle.jvm.toolchain.JavaLanguageVersion import org.gradle.kotlin.dsl.apply import org.gradle.kotlin.dsl.configure import org.gradle.kotlin.dsl.dependencies -import org.gradle.kotlin.dsl.get import org.gradle.kotlin.dsl.repositories import org.gradle.kotlin.dsl.the @@ -41,16 +40,20 @@ dependencies { constraints { - for (conf in configurations.names) { - add(conf, "com.google.guava:guava") { + for (conf in configurations) { + if (conf.isCanBeConsumed || conf.isCanBeResolved) { + // dependencies don't get declared in these + continue + } + add(conf.name, "com.google.guava:guava") { version { strictly(Versions.GUAVA) } because("Mojang provides Guava") } - add(conf, "com.google.code.gson:gson") { + add(conf.name, "com.google.code.gson:gson") { version { strictly(Versions.GSON) } because("Mojang provides Gson") } - add(conf, "it.unimi.dsi:fastutil") { + add(conf.name, "it.unimi.dsi:fastutil") { version { strictly(Versions.FAST_UTIL) } because("Mojang provides FastUtil") } @@ -58,9 +61,9 @@ } } - apply(plugin = "net.minecrell.licenser") + apply(plugin = "org.cadixdev.licenser") configure { - header = rootProject.file("HEADER.txt") + header(rootProject.file("HEADER.txt")) include("**/*.java") include("**/*.kt") } diff --git a/buildSrc/src/main/kotlin/PlatformConfig.kt b/buildSrc/src/main/kotlin/PlatformConfig.kt index 297eb8a32..94db0445d 100644 --- a/buildSrc/src/main/kotlin/PlatformConfig.kt +++ b/buildSrc/src/main/kotlin/PlatformConfig.kt @@ -64,7 +64,7 @@ "testImplementation"("org.junit.jupiter:junit-jupiter-params:${Versions.JUNIT}") "testImplementation"("org.mockito:mockito-core:${Versions.MOCKITO}") "testImplementation"("org.mockito:mockito-junit-jupiter:${Versions.MOCKITO}") - "testRuntime"("org.junit.jupiter:junit-jupiter-engine:${Versions.JUNIT}") + "testRuntimeOnly"("org.junit.jupiter:junit-jupiter-engine:${Versions.JUNIT}") } // Java 8 turns on doclint which we fail diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 442d9132e..549d84424 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/worldedit-core/build.gradle.kts b/worldedit-core/build.gradle.kts index 85397a907..5315dd7b5 100644 --- a/worldedit-core/build.gradle.kts +++ b/worldedit-core/build.gradle.kts @@ -1,11 +1,9 @@ -import net.minecrell.gradle.licenser.LicenseExtension +import org.cadixdev.gradle.licenser.LicenseExtension import org.gradle.plugins.ide.idea.model.IdeaModel plugins { - id("java-library") - id("net.ltgt.apt-eclipse") - id("net.ltgt.apt-idea") - id("antlr") + `java-library` + antlr } applyPlatformAndCoreConfiguration() @@ -84,6 +82,10 @@ ) } +tasks.named("sourcesJar") { + mustRunAfter("generateGrammarSource") +} + configure { exclude { it.file.startsWith(project.buildDir) @@ -106,12 +108,8 @@ sourceSets.named("main") { java { - srcDir("src/main/java") srcDir("src/legacy/java") } - resources { - srcDir("src/main/resources") - } } tasks.named("processResources") { diff --git a/worldedit-fabric/build.gradle.kts b/worldedit-fabric/build.gradle.kts index 789f8c0f6..ef6d130a5 100644 --- a/worldedit-fabric/build.gradle.kts +++ b/worldedit-fabric/build.gradle.kts @@ -122,15 +122,8 @@ tasks.named("processResources") { // this will ensure that this task is redone when the versions change. inputs.property("version", project.ext["internalVersion"]) - - from(sourceSets["main"].resources.srcDirs) { - include("fabric.mod.json") - expand("version" to project.ext["internalVersion"]) - } - - // copy everything else except the mod json - from(sourceSets["main"].resources.srcDirs) { - exclude("fabric.mod.json") + filesMatching("fabric.mod.json") { + this.expand("version" to project.ext["internalVersion"]) } } diff --git a/worldedit-forge/build.gradle.kts b/worldedit-forge/build.gradle.kts index 8fe001ac9..99a19f966 100644 --- a/worldedit-forge/build.gradle.kts +++ b/worldedit-forge/build.gradle.kts @@ -78,19 +78,10 @@ inputs.property(key, value) } - // replace stuff in mcmod.info, nothing else - from(sourceSets["main"].resources.srcDirs) { - include("META-INF/mods.toml") - - // replace version and mcversion + filesMatching("META-INF/mods.toml") { expand(properties) } - // copy everything else except the mcmod.info - from(sourceSets["main"].resources.srcDirs) { - exclude("META-INF/mods.toml") - } - // copy from -core resources as well from(project(":worldedit-core").tasks.named("processResources")) }