From 0a07599abff186b05f676c5078407793297721ef Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Fri, 14 Aug 2020 15:29:15 -0400 Subject: [PATCH] Update build files and NOTICE.txt --- NOTICE.txt | 31 +++++++++++++++ build.gradle.kts | 15 ++++--- buildSrc/build.gradle.kts | 10 ++--- buildSrc/src/main/kotlin/LibsConfig.kt | 16 +++++++- buildSrc/src/main/kotlin/PlatformConfig.kt | 34 ++++++++++------ buildSrc/src/main/kotlin/Versions.kt | 5 ++- worldedit-bukkit/build.gradle.kts | 22 +++++++---- worldedit-cli/build.gradle.kts | 14 +++++-- worldedit-core/build.gradle.kts | 25 ++++++------ worldedit-core/doctools/build.gradle.kts | 1 + worldedit-fabric/build.gradle.kts | 1 + worldedit-forge/build.gradle.kts | 46 +++++++++++++--------- worldedit-libs/bukkit/build.gradle.kts | 2 + worldedit-libs/sponge/build.gradle.kts | 3 +- 14 files changed, 155 insertions(+), 70 deletions(-) diff --git a/NOTICE.txt b/NOTICE.txt index f6ad72628..2b6a731c1 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -16,3 +16,34 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. +Unknown LZ4 Java code + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +BufferedRandomAccessFile.java + +Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. +See the NOTICE file distributed with this work for additional information regarding +copyright ownership. The ASF licenses this file to you under the Apache License, +Version 2.0 ("License"); you may not use this file except in compliance with the License. +You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and limitations under the License. + +SimplexNoise.java + +Version 2012-03-09 +This code was placed in the public domain by its original author, Stefan Gustavson. You may use it +as you see fit, but attribution is appreciated. diff --git a/build.gradle.kts b/build.gradle.kts index 1c05b06ab..b601906f1 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -14,17 +14,18 @@ logger.lifecycle(""" Output files will be in [subproject]/build/libs ******************************************* """) + //TODO FIX THIS WHEN I FEEL LIKE IT -var rootVersion = "1.16" -var revision: String = "" -var buildNumber = "" -var date: String = "" +var rootVersion by extra("1.16") +var revision: String by extra("") +var buildNumber by extra("") +var date: String by extra("") ext { val git: Grgit = Grgit.open { dir = File("$rootDir/.git"); } - ext["date"] = git.head().dateTime.format(DateTimeFormatter.ofPattern("yy.MM.dd")); - ext["revision"] = "-${git.head().abbreviatedId}"; + date = git.head().dateTime.format(DateTimeFormatter.ofPattern("yy.MM.dd")); + revision = "-${git.head().abbreviatedId}"; var parents: MutableList? = git.head().parentIds; if (project.hasProperty("buildnumber")) { buildNumber = project.properties["buildnumber"] as String; @@ -48,6 +49,8 @@ allprojects { version = String.format("%s-%s", rootVersion, buildNumber) +applyCommonConfiguration() + if (!project.hasProperty("gitCommitHash")) { apply(plugin = "org.ajoberstar.grgit") ext["gitCommitHash"] = try { diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 60f5ff779..00f810b1c 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -52,11 +52,11 @@ dependencies { implementation("com.github.jengelman.gradle.plugins:shadow:5.2.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.16.0") - implementation("gradle.plugin.org.spongepowered:spongegradle:0.9.0") - implementation("net.minecraftforge.gradle:ForgeGradle:3.0.179") - implementation("net.fabricmc:fabric-loom:$loomVersion") - implementation("net.fabricmc:sponge-mixin:$mixinVersion") + //implementation("org.jfrog.buildinfo:build-info-extractor-gradle:4.16.0") + //implementation("gradle.plugin.org.spongepowered:spongegradle:0.9.0") + //implementation("net.minecraftforge.gradle:ForgeGradle:3.0.181") + //implementation("net.fabricmc:fabric-loom:$loomVersion") + //implementation("net.fabricmc:sponge-mixin:$mixinVersion") implementation("gradle.plugin.com.mendhak.gradlecrowdin:plugin:0.1.0") implementation("org.enginehub.gradle:gradle-codecov-plugin:0.1.0") } diff --git a/buildSrc/src/main/kotlin/LibsConfig.kt b/buildSrc/src/main/kotlin/LibsConfig.kt index 11e8ecd2b..172be5d39 100644 --- a/buildSrc/src/main/kotlin/LibsConfig.kt +++ b/buildSrc/src/main/kotlin/LibsConfig.kt @@ -1,5 +1,6 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar import org.gradle.api.Project +import org.gradle.api.artifacts.ExternalModuleDependency import org.gradle.api.artifacts.ModuleDependency import org.gradle.api.internal.HasConvention import org.gradle.api.plugins.MavenRepositoryHandlerConvention @@ -41,7 +42,7 @@ fun Project.applyLibrariesConfiguration() { val deps = configurations["shade"].incoming.dependencies .filterIsInstance() .map { it.copy() } - .map { dependency -> + .map { dependency: ModuleDependency -> dependency.artifact { name = dependency.name type = artifactType @@ -95,3 +96,16 @@ fun Project.applyLibrariesConfiguration() { } } + +fun Project.constrainDependenciesToLibsCore() { + evaluationDependsOn(":worldedit-libs:core") + val coreDeps = project(":worldedit-libs:core").configurations["shade"].dependencies + .filterIsInstance() + dependencies.constraints { + for (coreDep in coreDeps) { + add("shade", "${coreDep.group}:${coreDep.name}:${coreDep.version}") { + because("libs should align with libs:core") + } + } + } +} diff --git a/buildSrc/src/main/kotlin/PlatformConfig.kt b/buildSrc/src/main/kotlin/PlatformConfig.kt index da14d923c..adf6e1577 100644 --- a/buildSrc/src/main/kotlin/PlatformConfig.kt +++ b/buildSrc/src/main/kotlin/PlatformConfig.kt @@ -4,6 +4,7 @@ import org.gradle.api.Project import org.gradle.api.plugins.JavaPluginConvention import org.gradle.api.plugins.quality.CheckstyleExtension import org.gradle.api.tasks.bundling.Jar +import org.gradle.api.tasks.compile.JavaCompile import org.gradle.api.tasks.javadoc.Javadoc import org.gradle.api.tasks.testing.Test import org.gradle.external.javadoc.CoreJavadocOptions @@ -32,6 +33,18 @@ fun Project.applyPlatformAndCoreConfiguration() { targetCompatibility = JavaVersion.VERSION_1_8 } + tasks + .withType() + .matching { it.name == "compileJava" || it.name == "compileTestJava" } + .configureEach { + val disabledLint = listOf( + "processing", "path", "fallthrough", "serial" + ) + //options.compilerArgs.addAll(listOf("-Xlint:all") + disabledLint.map { "-Xlint:-$it" }) + options.isDeprecation = false + options.encoding = "UTF-8" + } + // configure { // configFile = rootProject.file("config/checkstyle/checkstyle.xml") // toolVersion = "8.34" @@ -52,19 +65,14 @@ fun Project.applyPlatformAndCoreConfiguration() { // Java 8 turns on doclint which we fail tasks.withType().configureEach { - //delete("docs/javadoc") - //setDestinationDir(file("docs/javadoc")) - //title = "${project.name} ${project.version} API" - //(options as StandardJavadocDocletOptions).addStringOption("author", "true") - (options as CoreJavadocOptions).addStringOption("Xdoclint:none", "-quiet") -// subprojects.forEach { proj -> -// proj.tasks.withType().forEach { javadocTask -> -// source += javadocTask.source -// classpath += javadocTask.classpath -// excludes += javadocTask.excludes -// includes += javadocTask.includes -// } -// } + (options as StandardJavadocDocletOptions).apply { + addStringOption("Xdoclint:none", "-quiet") + tags( + "apiNote:a:API Note:", + "implSpec:a:Implementation Requirements:", + "implNote:a:Implementation Note:" + ) + } } tasks.register("javadocJar") { diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index 3985105db..14054d450 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -2,12 +2,15 @@ import org.gradle.api.Project object Versions { const val TEXT = "3.0.4" - const val TEXT_EXTRAS = "3.0.5" + const val TEXT_EXTRAS = "3.0.6" const val PISTON = "0.5.6" const val AUTO_VALUE = "1.7" const val JUNIT = "5.6.1" const val MOCKITO = "3.3.3" const val LOGBACK = "1.2.3" + const val FAST_UTIL = "8.2.1" + const val GUAVA = "21.0" + const val GSON = "2.8.0" } // Properties that need a project reference to resolve: diff --git a/worldedit-bukkit/build.gradle.kts b/worldedit-bukkit/build.gradle.kts index 793153489..fe5bf18a2 100644 --- a/worldedit-bukkit/build.gradle.kts +++ b/worldedit-bukkit/build.gradle.kts @@ -14,7 +14,10 @@ repositories { maven { url = uri("https://maven.enginehub.org/repo/") } maven { url = uri("http://ci.emc.gs/nexus/content/groups/aikar/") } maven { url = uri("https://ci.athion.net/plugin/repository/tools/") } - maven { url = uri("https://jitpack.io")} + maven { + this.name = "JitPack" + this.url = uri("https://jitpack.io") + } maven { url = uri("https://repo.destroystokyo.com/repository/maven-public/") } maven { name = "ProtocolLib Repo" @@ -30,24 +33,29 @@ configurations.all { } dependencies { - compile("com.github.MilkBowl:VaultAPI:1.7") { isTransitive = false } + compileOnly("com.github.MilkBowl:VaultAPI:1.7") { + isTransitive = false + } "api"(project(":worldedit-core")) "api"(project(":worldedit-libs:bukkit")) "compile"(":worldedit-adapters:") "compile"("org.spigotmcv1_14_r1:spigotmcv1_14_r1:1_14_r1") "compile"("org.spigotmcv1_15_r1:spigotmcv1_15_r1:1_15_r1") - "compile"("it.unimi.dsi:fastutil:8.2.1") + "implementation"("it.unimi.dsi:fastutil:${Versions.FAST_UTIL}") "api"("com.destroystokyo.paper:paper-api:1.16.1-R0.1-SNAPSHOT") { exclude("junit", "junit") isTransitive = false } + "compileOnly"("org.jetbrains:annotations:20.0.0") "compileOnly"("org.spigotmc:spigot:1.14.4-R0.1-SNAPSHOT") "compileOnly"("org.spigotmc:spigot:1.15.2-R0.1-SNAPSHOT") "compileOnly"("org.spigotmc:spigot:1.16.1-R0.1-SNAPSHOT") - "implementation"("io.papermc:paperlib:1.0.2") - "compileOnly"("com.sk89q:dummypermscompat:1.10") + "implementation"("io.papermc:paperlib:1.0.+") + "compileOnly"("com.sk89q:dummypermscompat:1.10") { + exclude("com.github.MilkBowl", "VaultAPI") + } "implementation"("org.apache.logging.log4j:log4j-slf4j-impl:2.8.1") - "testCompile"("org.mockito:mockito-core:1.9.0-rc1") + "testImplementation"("org.mockito:mockito-core:1.9.0-rc1") "compileOnly"("com.sk89q.worldguard:worldguard-bukkit:7.+") { exclude("com.sk89q.worldedit", "worldedit-bukkit") exclude("com.sk89q.worldedit", "worldedit-core") @@ -95,7 +103,7 @@ tasks.named("shadowJar") { include(dependency("org.bstats:bstats-bukkit:1.7")) } relocate("io.papermc.lib", "com.sk89q.worldedit.bukkit.paperlib") { - include(dependency("io.papermc:paperlib:1.0.2")) + include(dependency("io.papermc:paperlib:1.+")) } relocate("it.unimi.dsi.fastutil", "com.sk89q.worldedit.bukkit.fastutil") { include(dependency("it.unimi.dsi:fastutil")) diff --git a/worldedit-cli/build.gradle.kts b/worldedit-cli/build.gradle.kts index ab563127c..a655b4b9a 100644 --- a/worldedit-cli/build.gradle.kts +++ b/worldedit-cli/build.gradle.kts @@ -1,13 +1,19 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar +plugins { + `java-library` +} + applyPlatformAndCoreConfiguration() applyShadowConfiguration() dependencies { - "compile"(project(":worldedit-core")) - "compile"("org.apache.logging.log4j:log4j-core:2.8.1") - "compile"("org.apache.logging.log4j:log4j-slf4j-impl:2.8.1") - "compile"("commons-cli:commons-cli:1.4") + "api"(project(":worldedit-core")) + "implementation"("org.apache.logging.log4j:log4j-core:2.8.1") + "implementation"("org.apache.logging.log4j:log4j-slf4j-impl:2.8.1") + "implementation"("commons-cli:commons-cli:1.4") + "implementation"("com.google.guava:guava:${Versions.GUAVA}") + "implementation"("com.google.code.gson:gson:${Versions.GSON}") } tasks.named("jar") { diff --git a/worldedit-core/build.gradle.kts b/worldedit-core/build.gradle.kts index 5c6242641..2ce72497e 100644 --- a/worldedit-core/build.gradle.kts +++ b/worldedit-core/build.gradle.kts @@ -29,22 +29,22 @@ configurations.all { } dependencies { - "compile"(project(":worldedit-libs:core")) - "compile"("de.schlichtherle:truezip:6.8.3") - "compile"("net.java.truevfs:truevfs-profile-default_2.13:0.12.1") - "compile"("org.mozilla:rhino-runtime:1.7.12") - "compile"("org.yaml:snakeyaml:1.23") - "compile"("com.google.guava:guava:21.0") - "compile"("com.google.code.findbugs:jsr305:3.0.2") - "compile"("com.google.code.gson:gson:2.8.0") - "compile"("org.slf4j:slf4j-api:1.7.26") - "compile"("it.unimi.dsi:fastutil:8.2.1") + "api"(project(":worldedit-libs:core")) + "implementation"("de.schlichtherle:truezip:6.8.3") + "implementation"("net.java.truevfs:truevfs-profile-default_2.13:0.12.1") + "implementation"("org.mozilla:rhino-runtime:1.7.12") + "implementation"("org.yaml:snakeyaml:1.23") + "implementation"("com.google.guava:guava:${Versions.GUAVA}") + "implementation"("com.google.code.findbugs:jsr305:3.0.2") + "implementation"("com.google.code.gson:gson:${Versions.GSON}") + "implementation"("org.slf4j:slf4j-api:1.7.26") + "implementation"("it.unimi.dsi:fastutil:${Versions.FAST_UTIL}") val antlrVersion = "4.7.2" "antlr"("org.antlr:antlr4:$antlrVersion") "implementation"("org.antlr:antlr4-runtime:$antlrVersion") - "compile"("com.googlecode.json-simple:json-simple:1.1.1") { isTransitive = false } + "implementation"("com.googlecode.json-simple:json-simple:1.1.1") { isTransitive = false } "compileOnly"(project(":worldedit-libs:core:ap")) "annotationProcessor"(project(":worldedit-libs:core:ap")) // ensure this is on the classpath for the AP @@ -53,7 +53,6 @@ dependencies { "annotationProcessor"("com.google.auto.value:auto-value:${Versions.AUTO_VALUE}") "testImplementation"("ch.qos.logback:logback-core:${Versions.LOGBACK}") "testImplementation"("ch.qos.logback:logback-classic:${Versions.LOGBACK}") - "compile"("co.aikar:fastutil-lite:1.0") "compile"("com.github.luben:zstd-jni:1.4.3-1") "compileOnly"("net.fabiozumbi12:redprotect:1.9.6") "compile"("com.github.intellectualsites.plotsquared:PlotSquared-API:latest") { @@ -62,7 +61,7 @@ dependencies { "compile"("com.plotsquared:PlotSquared-Core:5.12.2") { isTransitive = false } - implementation(kotlin("stdlib-jdk8", "1.3.61")) + implementation(kotlin("stdlib-jdk8", "1.3.72")) } tasks.named("test") { diff --git a/worldedit-core/doctools/build.gradle.kts b/worldedit-core/doctools/build.gradle.kts index a9b2a7439..dc2a11caf 100644 --- a/worldedit-core/doctools/build.gradle.kts +++ b/worldedit-core/doctools/build.gradle.kts @@ -21,4 +21,5 @@ dependencies { "implementation"(project(":worldedit-core")) "implementation"(kotlin("stdlib-jdk8")) "implementation"(kotlin("reflect")) + "implementation"("com.google.guava:guava:${Versions.GUAVA}") } diff --git a/worldedit-fabric/build.gradle.kts b/worldedit-fabric/build.gradle.kts index 4b7a7b079..0a4cff4e6 100644 --- a/worldedit-fabric/build.gradle.kts +++ b/worldedit-fabric/build.gradle.kts @@ -5,6 +5,7 @@ applyPlatformAndCoreConfiguration() applyShadowConfiguration() apply(plugin = "fabric-loom") +apply(plugin = "java-library") val minecraftVersion = "1.15.2" val yarnMappings = "1.15.2+build.14:v2" diff --git a/worldedit-forge/build.gradle.kts b/worldedit-forge/build.gradle.kts index f3b938ca7..973488f39 100644 --- a/worldedit-forge/build.gradle.kts +++ b/worldedit-forge/build.gradle.kts @@ -1,19 +1,23 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar import net.minecraftforge.gradle.common.util.RunConfig -import net.minecraftforge.gradle.userdev.UserDevExtension import net.minecraftforge.gradle.mcp.task.GenerateSRG +import net.minecraftforge.gradle.userdev.UserDevExtension import net.minecraftforge.gradle.userdev.tasks.RenameJarInPlace plugins { id("net.minecraftforge.gradle") + `java-library` } applyPlatformAndCoreConfiguration() applyShadowConfiguration() -val minecraftVersion = "1.14.4" -val mappingsMinecraftVersion = "1.14.3" -val forgeVersion = "28.1.0" +val minecraftVersion = "1.16.1" +val nextMajorMinecraftVersion: String = minecraftVersion.split('.').let { (useless, major) -> + "$useless.${major.toInt() + 1}" +} +val mappingsMinecraftVersion = "1.16" +val forgeVersion = "32.0.92" configurations.all { resolutionStrategy { @@ -22,8 +26,8 @@ configurations.all { } dependencies { - "compile"(project(":worldedit-core")) - "compile"("org.apache.logging.log4j:log4j-slf4j-impl:2.11.2") + "api"(project(":worldedit-core")) + "implementation"("org.apache.logging.log4j:log4j-slf4j-impl:2.11.2") "minecraft"("net.minecraftforge:forge:$minecraftVersion-$forgeVersion") } @@ -31,7 +35,7 @@ dependencies { configure { mappings(mapOf( "channel" to "snapshot", - "version" to "20190913-$mappingsMinecraftVersion" + "version" to "20200514-$mappingsMinecraftVersion" )) accessTransformer(file("src/main/resources/META-INF/accesstransformer.cfg")) @@ -57,40 +61,44 @@ configure { tasks.named("processResources") { // this will ensure that this task is redone when the versions change. - inputs.property("version", project.ext["internalVersion"]) - inputs.property("forgeVersion", forgeVersion) + val properties = mapOf( + "version" to project.ext["internalVersion"], + "forgeVersion" to forgeVersion, + "minecraftVersion" to minecraftVersion, + "nextMajorMinecraftVersion" to nextMajorMinecraftVersion + ) + properties.forEach { (key, value) -> + 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 - expand( - "version" to project.ext["internalVersion"], - "forgeVersion" to forgeVersion - ) + 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")) } -tasks.named("jar") { - manifest { - attributes("Class-Path" to CLASSPATH, - "WorldEdit-Version" to project.version) - } -} +addJarManifest(includeClasspath = false) tasks.named("shadowJar") { dependencies { relocate("org.slf4j", "com.sk89q.worldedit.slf4j") relocate("org.apache.logging.slf4j", "com.sk89q.worldedit.log4jbridge") + relocate("org.antlr.v4", "com.sk89q.worldedit.antlr4") include(dependency("org.slf4j:slf4j-api")) include(dependency("org.apache.logging.log4j:log4j-slf4j-impl")) + include(dependency("org.antlr:antlr4-runtime")) include(dependency("de.schlichtherle:truezip")) include(dependency("net.java.truevfs:truevfs-profile-default_2.13")) include(dependency("org.mozilla:rhino-runtime")) diff --git a/worldedit-libs/bukkit/build.gradle.kts b/worldedit-libs/bukkit/build.gradle.kts index 247fd9219..a9d1c255e 100644 --- a/worldedit-libs/bukkit/build.gradle.kts +++ b/worldedit-libs/bukkit/build.gradle.kts @@ -1,4 +1,5 @@ applyLibrariesConfiguration() +constrainDependenciesToLibsCore() repositories { maven { @@ -6,6 +7,7 @@ repositories { url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") } } + dependencies { "shade"("net.kyori:text-adapter-bukkit:${Versions.TEXT_EXTRAS}") } diff --git a/worldedit-libs/sponge/build.gradle.kts b/worldedit-libs/sponge/build.gradle.kts index 5854dd616..47bd7e59c 100644 --- a/worldedit-libs/sponge/build.gradle.kts +++ b/worldedit-libs/sponge/build.gradle.kts @@ -1,4 +1,5 @@ applyLibrariesConfiguration() +constrainDependenciesToLibsCore() repositories { maven { @@ -8,4 +9,4 @@ repositories { } dependencies { "shade"("net.kyori:text-adapter-spongeapi:${Versions.TEXT_EXTRAS}") -} \ No newline at end of file +}