From 19802e478ce3e9c08c500076041f4c75d5820825 Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Wed, 10 Jul 2019 16:33:21 -0700 Subject: [PATCH] Re-write root and libs to Kotlin DSL --- build.gradle | 141 ----------------- build.gradle.kts | 28 ++++ buildSrc/src/main/kotlin/ArtifactoryConfig.kt | 40 +++++ buildSrc/src/main/kotlin/CommonConfig.kt | 18 +++ buildSrc/src/main/kotlin/GradleExtras.kt | 6 + buildSrc/src/main/kotlin/LibsConfig.kt | 98 ++++++++++++ buildSrc/src/main/kotlin/PlatformConfig.kt | 101 ++++++++++++ buildSrc/src/main/kotlin/Versions.kt | 5 + gradle.properties | 3 + worldedit-bukkit/build.gradle | 2 + worldedit-core/build.gradle | 2 + worldedit-fabric/build.gradle | 3 + worldedit-forge/build.gradle | 14 +- worldedit-libs/README.md | 9 ++ worldedit-libs/build.gradle | 145 ------------------ worldedit-libs/bukkit/build.gradle.kts | 11 ++ worldedit-libs/core/ap/build.gradle.kts | 6 + worldedit-libs/core/build.gradle.kts | 16 ++ worldedit-libs/fabric/build.gradle.kts | 1 + worldedit-libs/forge/build.gradle.kts | 1 + worldedit-libs/sponge/build.gradle.kts | 11 ++ worldedit-sponge/build.gradle | 3 + 22 files changed, 366 insertions(+), 298 deletions(-) delete mode 100644 build.gradle create mode 100644 build.gradle.kts create mode 100644 buildSrc/src/main/kotlin/ArtifactoryConfig.kt create mode 100644 buildSrc/src/main/kotlin/CommonConfig.kt create mode 100644 buildSrc/src/main/kotlin/GradleExtras.kt create mode 100644 buildSrc/src/main/kotlin/LibsConfig.kt create mode 100644 buildSrc/src/main/kotlin/PlatformConfig.kt create mode 100644 buildSrc/src/main/kotlin/Versions.kt create mode 100644 worldedit-libs/README.md create mode 100644 worldedit-libs/bukkit/build.gradle.kts create mode 100644 worldedit-libs/core/ap/build.gradle.kts create mode 100644 worldedit-libs/core/build.gradle.kts create mode 100644 worldedit-libs/fabric/build.gradle.kts create mode 100644 worldedit-libs/forge/build.gradle.kts create mode 100644 worldedit-libs/sponge/build.gradle.kts diff --git a/build.gradle b/build.gradle deleted file mode 100644 index b39e4ebb3..000000000 --- a/build.gradle +++ /dev/null @@ -1,141 +0,0 @@ -plugins { - id "org.ajoberstar.grgit" - id "com.github.johnrengelman.shadow" - id "com.jfrog.artifactory" -} - -println """ -******************************************* - You are building WorldEdit! - - If you encounter trouble: - 1) Read COMPILING.md if you haven't yet - 2) Try running 'build' in a separate Gradle run - 3) Use gradlew and not gradle - 4) If you still need help, ask on Discord! https://discord.gg/enginehub - - Output files will be in [subproject]/build/libs -******************************************* -""" - -allprojects { - group = 'com.sk89q.worldedit' - version = '7.0.1-SNAPSHOT' -} - -if (!project.hasProperty("artifactory_contextUrl")) ext.artifactory_contextUrl = "http://localhost" -if (!project.hasProperty("artifactory_user")) ext.artifactory_user = "guest" -if (!project.hasProperty("artifactory_password")) ext.artifactory_password = "" - -if (!project.hasProperty("gitCommitHash") && !JavaVersion.current().isJava6()) { - try { - def repo = grgit.open() - ext.gitCommitHash = repo.head().abbreviatedId - } catch (Exception e) { - println "Error getting commit hash: " + e.getMessage() - } -} -if (!project.hasProperty("gitCommitHash")) { - ext.gitCommitHash = "no_git_id" -} - -apply plugin: 'com.jfrog.artifactory' -artifactory { - contextUrl = "${artifactory_contextUrl}" - publish { - repository { - repoKey = project.version.contains("SNAPSHOT") ? 'libs-snapshot-local' : 'libs-release-local' - username = "${artifactory_user}" - password = "${artifactory_password}" - maven = true - ivy = false - } - } -} -artifactoryPublish.skip = true - -subprojects { - repositories { - mavenCentral() - maven { url "http://maven.sk89q.com/repo/" } - maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } - } - configurations.all { - resolutionStrategy { - cacheChangingModulesFor 5, 'minutes' - } - } -} - -configure(['core', 'bukkit', 'forge', 'sponge', 'fabric'].collect { project(":worldedit-$it") }) { - apply plugin: 'java' - apply plugin: 'maven' - apply plugin: 'checkstyle' - apply plugin: 'com.github.johnrengelman.shadow' - apply plugin: 'com.jfrog.artifactory' - apply plugin: 'net.minecrell.licenser' - - ext.internalVersion = version + ";" + gitCommitHash - - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - - checkstyle.configFile = new File(rootProject.projectDir, "config/checkstyle/checkstyle.xml") - checkstyle.toolVersion = '7.6.1' - - if (JavaVersion.current().isJava8Compatible()) { - // Java 8 turns on doclint which we fail - tasks.withType(Javadoc) { - options.addStringOption('Xdoclint:none', '-quiet') - } - } - - task javadocJar(type: Jar, dependsOn: javadoc) { - getArchiveClassifier().set('javadoc') - from javadoc.destinationDir - } - - artifacts { - archives jar - archives javadocJar - } - - if (name == "worldedit-core" || name == "worldedit-bukkit") { - task sourcesJar(type: Jar, dependsOn: classes) { - getArchiveClassifier().set('sources') - from sourceSets.main.allSource - } - - artifacts { - archives sourcesJar - } - build.dependsOn(sourcesJar) - } - - build.dependsOn(checkstyleMain) - build.dependsOn(checkstyleTest) - build.dependsOn(javadocJar) - - artifactoryPublish { - publishConfigs('archives') - } - - license { - header = rootProject.file("HEADER.txt") - include '**/*.java' - } -} - -configure(['bukkit', 'forge', 'sponge', 'fabric'].collect { project(":worldedit-$it") }) { - shadowJar { - getArchiveClassifier().set('dist') - dependencies { - include(project(":worldedit-libs:core")) - include(project(":worldedit-libs:${project.name.replace("worldedit-", "")}")) - include(project(":worldedit-core")) - } - exclude 'GradleStart**' - exclude '.cache' - exclude 'LICENSE*' - } -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 000000000..7088d0893 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,28 @@ +import org.ajoberstar.grgit.Grgit + +println(""" +******************************************* + You are building WorldEdit! + + If you encounter trouble: + 1) Read COMPILING.md if you haven't yet + 2) Try running 'build' in a separate Gradle run + 3) Use gradlew and not gradle + 4) If you still need help, ask on Discord! https://discord.gg/enginehub + + Output files will be in [subproject]/build/libs +******************************************* +""") + +applyRootArtifactoryConfig() + +if (!project.hasProperty("gitCommitHash")) { + apply(plugin = "org.ajoberstar.grgit") + ext["gitCommitHash"] = try { + (ext["grgit"] as Grgit).head().abbreviatedId + } catch (e: Exception) { + println("Error getting commit hash: " + e.message) + + "no_git_id" + } +} diff --git a/buildSrc/src/main/kotlin/ArtifactoryConfig.kt b/buildSrc/src/main/kotlin/ArtifactoryConfig.kt new file mode 100644 index 000000000..d19f35238 --- /dev/null +++ b/buildSrc/src/main/kotlin/ArtifactoryConfig.kt @@ -0,0 +1,40 @@ +import org.gradle.api.Project +import org.gradle.kotlin.dsl.apply +import org.gradle.kotlin.dsl.configure +import org.gradle.kotlin.dsl.named +import org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention +import org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask + +private const val ARTIFACTORY_CONTEXT_URL = "artifactory_contextUrl" +private const val ARTIFACTORY_USER = "artifactory_user" +private const val ARTIFACTORY_PASSWORD = "artifactory_password" + +fun Project.applyRootArtifactoryConfig() { + if (!project.hasProperty(ARTIFACTORY_CONTEXT_URL)) ext[ARTIFACTORY_CONTEXT_URL] = "http://localhost" + if (!project.hasProperty(ARTIFACTORY_USER)) ext[ARTIFACTORY_USER] = "guest" + if (!project.hasProperty(ARTIFACTORY_PASSWORD)) ext[ARTIFACTORY_PASSWORD] = "" + + apply(plugin = "com.jfrog.artifactory") + configure { + setContextUrl("${project.property(ARTIFACTORY_CONTEXT_URL)}") + clientConfig.publisher.run { + repoKey = when { + "${project.version}".contains("SNAPSHOT") -> "libs-snapshot-local" + else -> "libs-release-local" + } + username = "${project.property(ARTIFACTORY_USER)}" + password = "${project.property(ARTIFACTORY_PASSWORD)}" + isMaven = true + isIvy = false + } + } + tasks.named("artifactoryPublish") { + isSkip = true + } +} + +fun Project.applyCommonArtifactoryConfig() { + tasks.named("artifactoryPublish") { + publishConfigs("archives") + } +} diff --git a/buildSrc/src/main/kotlin/CommonConfig.kt b/buildSrc/src/main/kotlin/CommonConfig.kt new file mode 100644 index 000000000..e93f4a2dd --- /dev/null +++ b/buildSrc/src/main/kotlin/CommonConfig.kt @@ -0,0 +1,18 @@ +import org.gradle.api.Project +import org.gradle.kotlin.dsl.repositories + +fun Project.applyCommonConfiguration() { + group = rootProject.group + version = rootProject.version + + repositories { + mavenCentral() + maven { url = uri("https://maven.sk89q.com/repo/") } + maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") } + } + configurations.all { + resolutionStrategy { + cacheChangingModulesFor(5, "minutes") + } + } +} diff --git a/buildSrc/src/main/kotlin/GradleExtras.kt b/buildSrc/src/main/kotlin/GradleExtras.kt new file mode 100644 index 000000000..5358f6b37 --- /dev/null +++ b/buildSrc/src/main/kotlin/GradleExtras.kt @@ -0,0 +1,6 @@ +import org.gradle.api.Project +import org.gradle.api.plugins.ExtraPropertiesExtension +import org.gradle.kotlin.dsl.getByType + +val Project.ext: ExtraPropertiesExtension + get() = extensions.getByType() diff --git a/buildSrc/src/main/kotlin/LibsConfig.kt b/buildSrc/src/main/kotlin/LibsConfig.kt new file mode 100644 index 000000000..c2754d487 --- /dev/null +++ b/buildSrc/src/main/kotlin/LibsConfig.kt @@ -0,0 +1,98 @@ +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar +import org.gradle.api.Project +import org.gradle.api.artifacts.ModuleDependency +import org.gradle.api.internal.HasConvention +import org.gradle.api.plugins.MavenRepositoryHandlerConvention +import org.gradle.api.tasks.Upload +import org.gradle.api.tasks.bundling.Jar +import org.gradle.kotlin.dsl.apply +import org.gradle.kotlin.dsl.get +import org.gradle.kotlin.dsl.getPlugin +import org.gradle.kotlin.dsl.invoke +import org.gradle.kotlin.dsl.register + +fun Project.applyLibrariesConfiguration() { + applyCommonConfiguration() + apply(plugin = "java-base") + apply(plugin = "maven") + apply(plugin = "com.github.johnrengelman.shadow") + apply(plugin = "com.jfrog.artifactory") + + configurations { + create("shade") + getByName("archives").extendsFrom(getByName("default")) + } + + group = "${rootProject.group}.worldedit-libs" + + tasks.register("jar") { + configurations = listOf(project.configurations["shade"]) + archiveClassifier.set("") + + dependencies { + exclude(dependency("com.google.guava:guava")) + exclude(dependency("com.google.code.gson:gson")) + exclude(dependency("org.checkerframework:checker-qual")) + } + + relocate("net.kyori.text", "com.sk89q.worldedit.util.formatting.text") + } + val altConfigFiles = { artifactType: String -> + val deps = configurations["shade"].incoming.dependencies + .filterIsInstance() + .map { it.copy() } + .map { dependency -> + dependency.artifact { + name = dependency.name + type = artifactType + extension = "jar" + classifier = artifactType + } + dependency + } + + files(configurations.detachedConfiguration(*deps.toTypedArray()) + .resolvedConfiguration.lenientConfiguration.artifacts + .filter { it.classifier == artifactType } + .map { zipTree(it.file) }) + } + tasks.register("sourcesJar") { + from({ + altConfigFiles("sources") + }) + val filePattern = Regex("(.*)net/kyori/text((?:/|$).*)") + val textPattern = Regex("net\\.kyori\\.text") + eachFile { + filter { + it.replaceFirst(textPattern, "com.sk89q.worldedit.util.formatting.text") + } + path = path.replaceFirst(filePattern, "$1com/sk89q/worldedit/util/formatting/text$2") + } + archiveClassifier.set("sources") + } + + tasks.named("assemble").configure { + dependsOn("jar", "sourcesJar") + } + + artifacts { + val jar = tasks.named("jar") + add("default", jar) { + builtBy(jar) + } + val sourcesJar = tasks.named("sourcesJar") + add("archives", sourcesJar) { + builtBy(sourcesJar) + } + } + + tasks.register("install") { + configuration = configurations["archives"] + (repositories as HasConvention).convention.getPlugin().mavenInstaller { + pom.version = project.version.toString() + pom.artifactId = project.name + } + } + + applyCommonArtifactoryConfig() +} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/PlatformConfig.kt b/buildSrc/src/main/kotlin/PlatformConfig.kt new file mode 100644 index 000000000..85042cc9f --- /dev/null +++ b/buildSrc/src/main/kotlin/PlatformConfig.kt @@ -0,0 +1,101 @@ +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar +import net.minecrell.gradle.licenser.LicenseExtension +import org.gradle.api.JavaVersion +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.javadoc.Javadoc +import org.gradle.external.javadoc.CoreJavadocOptions +import org.gradle.kotlin.dsl.apply +import org.gradle.kotlin.dsl.configure +import org.gradle.kotlin.dsl.get +import org.gradle.kotlin.dsl.getByName +import org.gradle.kotlin.dsl.getPlugin +import org.gradle.kotlin.dsl.register +import org.gradle.kotlin.dsl.the +import org.gradle.kotlin.dsl.withType +import org.gradle.kotlin.dsl.named + +fun Project.applyPlatformAndCoreConfiguration() { + applyCommonConfiguration() + apply(plugin = "java") + apply(plugin = "maven") + apply(plugin = "checkstyle") + apply(plugin = "com.github.johnrengelman.shadow") + apply(plugin = "com.jfrog.artifactory") + apply(plugin = "net.minecrell.licenser") + + ext["internalVersion"] = "$version;${rootProject.ext["gitCommitHash"]}" + + configure { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + configure { + configFile = rootProject.file("config/checkstyle/checkstyle.xml") + toolVersion = "7.6.1" + } + + // Java 8 turns on doclint which we fail + tasks.withType().configureEach { + (options as CoreJavadocOptions).addStringOption("Xdoclint:none", "-quiet") + } + + tasks.register("javadocJar") { + dependsOn("javadoc") + archiveClassifier.set("javadoc") + from(tasks.getByName("javadoc").destinationDir) + } + + tasks.named("assemble").configure { + dependsOn("javadocJar") + } + + artifacts { + add("archives", tasks.named("jar")) + add("archives", tasks.named("javadocJar")) + } + + if (name == "worldedit-core" || name == "worldedit-bukkit") { + tasks.register("sourcesJar") { + dependsOn("classes") + archiveClassifier.set("sources") + from(project.the().sourceSets["main"].allSource) + } + + artifacts { + add("archives", tasks.named("sourcesJar")) + } + tasks.named("assemble").configure { + dependsOn("sourcesJar") + } + } + + tasks.named("check").configure { + dependsOn("checkstyleMain", "checkstyleTest") + } + + applyCommonArtifactoryConfig() + + configure { + header = rootProject.file("HEADER.txt") + include("**/*.java") + } +} + +fun Project.applyShadowConfiguration() { + tasks.named("shadowJar") { + archiveClassifier.set("dist") + dependencies { + include(project(":worldedit-libs:core")) + include(project(":worldedit-libs:${project.name.replace("worldedit-", "")}")) + include(project(":worldedit-core")) + } + exclude("GradleStart**") + exclude(".cache") + exclude("LICENSE*") + minimize() + } +} diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt new file mode 100644 index 000000000..fd61ee13b --- /dev/null +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -0,0 +1,5 @@ +object Versions { + const val TEXT = "3.0.1" + const val TEXT_EXTRAS = "3.0.2" + const val PISTON = "0.4.2" +} diff --git a/gradle.properties b/gradle.properties index f7c837830..a2cc53d8e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1 +1,4 @@ +group=com.sk89q.worldedit +version=7.0.1-SNAPSHOT + org.gradle.jvmargs=-Xmx1G diff --git a/worldedit-bukkit/build.gradle b/worldedit-bukkit/build.gradle index ba7a34f31..b81612b0c 100644 --- a/worldedit-bukkit/build.gradle +++ b/worldedit-bukkit/build.gradle @@ -1,3 +1,5 @@ +PlatformConfigKt.applyPlatformAndCoreConfiguration(project) +PlatformConfigKt.applyShadowConfiguration(project) apply plugin: 'eclipse' apply plugin: 'idea' apply plugin: 'maven' diff --git a/worldedit-core/build.gradle b/worldedit-core/build.gradle index 41efbff01..a5b3bba63 100644 --- a/worldedit-core/build.gradle +++ b/worldedit-core/build.gradle @@ -6,6 +6,8 @@ plugins { id("net.ltgt.apt-idea") } +PlatformConfigKt.applyPlatformAndCoreConfiguration(project) + configurations.all { Configuration it -> it.resolutionStrategy { ResolutionStrategy rs -> rs.force("com.google.guava:guava:21.0") diff --git a/worldedit-fabric/build.gradle b/worldedit-fabric/build.gradle index 6eee60e9e..70acc7a1d 100644 --- a/worldedit-fabric/build.gradle +++ b/worldedit-fabric/build.gradle @@ -19,6 +19,9 @@ buildscript { } } +PlatformConfigKt.applyPlatformAndCoreConfiguration(project) +PlatformConfigKt.applyShadowConfiguration(project) + apply plugin: 'eclipse' apply plugin: 'fabric-loom' diff --git a/worldedit-forge/build.gradle b/worldedit-forge/build.gradle index 0c389e66f..fc3dcaee8 100644 --- a/worldedit-forge/build.gradle +++ b/worldedit-forge/build.gradle @@ -1,15 +1,5 @@ -buildscript { - repositories { - mavenLocal() - mavenCentral() - maven { url = "https://files.minecraftforge.net/maven" } - jcenter() - } - - dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true - } -} +PlatformConfigKt.applyPlatformAndCoreConfiguration(project) +PlatformConfigKt.applyShadowConfiguration(project) apply plugin: 'eclipse' apply plugin: 'net.minecraftforge.gradle' diff --git a/worldedit-libs/README.md b/worldedit-libs/README.md new file mode 100644 index 000000000..6387fde12 --- /dev/null +++ b/worldedit-libs/README.md @@ -0,0 +1,9 @@ +This project shades _API_ libraries, i.e. those libraries +whose classes are publicly referenced from `-core` classes. + +This project _does not_ shade implementation libraries, i.e. +those libraries whose classes are internally depended on. + +This is because the main reason for shading those libraries is for +their internal usage in each platform, not because we need them available to +dependents of `-core` to compile and work with WorldEdit's API. diff --git a/worldedit-libs/build.gradle b/worldedit-libs/build.gradle index cc3c681a0..29c096e2d 100644 --- a/worldedit-libs/build.gradle +++ b/worldedit-libs/build.gradle @@ -1,148 +1,3 @@ -import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar -/* - -This project shades API libraries, i.e. those libraries -whose classes are publicly referenced from `-core` classes. - -This project does not shade implementation libraries, i.e. -those libraries whose classes are internally depended on. - -This is because the main reason for shading those libraries is for -their internal usage in each platform, not because we need them available to -dependents of `-core` to compile and work with WorldEdit's API. - - */ -configure(subprojects + project("core:ap")) { - apply plugin: 'java-base' - apply plugin: 'maven' - apply plugin: 'com.github.johnrengelman.shadow' - apply plugin: 'com.jfrog.artifactory' - configurations { - create("shade") - getByName("archives").extendsFrom(getByName("default")) - } - - group = rootProject.group + ".worldedit-libs" - - tasks.register("jar", ShadowJar) { - configurations = [project.configurations.shade] - classifier = "" - - dependencies { - exclude(dependency("com.google.guava:guava")) - exclude(dependency("com.google.code.gson:gson")) - exclude(dependency("org.checkerframework:checker-qual")) - } - - relocate('net.kyori.text', 'com.sk89q.worldedit.util.formatting.text') - } - def altConfigFiles = { String artifactType -> - def deps = configurations.shade.incoming.dependencies - .collect { it.copy() } - .collect { dependency -> - dependency.artifact { artifact -> - artifact.name = dependency.name - artifact.type = artifactType - artifact.extension = 'jar' - artifact.classifier = artifactType - } - dependency - } - - return files(configurations.detachedConfiguration(deps as Dependency[]) - .resolvedConfiguration.lenientConfiguration.getArtifacts() - .findAll { it.classifier == artifactType } - .collect { zipTree(it.file) }) - } - tasks.register("sourcesJar", Jar) { - from { - altConfigFiles('sources') - } - def filePattern = ~'(.*)net/kyori/text((?:/|$).*)' - def textPattern = ~/net\.kyori\.text/ - eachFile { - it.filter { String line -> - line.replaceFirst(textPattern, 'com.sk89q.worldedit.util.formatting.text') - } - it.path = it.path.replaceFirst(filePattern, '$1com/sk89q/worldedit/util/formatting/text$2') - } - classifier = "sources" - } - - artifacts { - add("default", jar) { - builtBy(jar) - } - add("archives", sourcesJar) { - builtBy(sourcesJar) - } - } - - tasks.register("install", Upload) { - configuration = configurations.archives - repositories.mavenInstaller { - pom.version = project.version - pom.artifactId = project.name - } - } - - artifactoryPublish { - publishConfigs('default') - } - - build.dependsOn(jar, sourcesJar) -} - -def textExtrasVersion = "3.0.2" -project("core") { - def textVersion = "3.0.1" - def pistonVersion = '0.4.2' - - dependencies { - shade "net.kyori:text-api:$textVersion" - shade "net.kyori:text-serializer-gson:$textVersion" - shade "net.kyori:text-serializer-legacy:$textVersion" - shade "net.kyori:text-serializer-plain:$textVersion" - shade('com.sk89q:jchronic:0.2.4a') { - exclude(group: "junit", module: "junit") - } - shade 'com.thoughtworks.paranamer:paranamer:2.6' - shade 'com.sk89q.lib:jlibnoise:1.0.0' - shade "org.enginehub.piston:core:$pistonVersion" - shade "org.enginehub.piston.core-ap:runtime:$pistonVersion" - shade "org.enginehub.piston:default-impl:$pistonVersion" - } - - project("ap") { - dependencies { - shade "org.enginehub.piston.core-ap:annotations:$pistonVersion" - shade "org.enginehub.piston.core-ap:processor:$pistonVersion" - } - } -} -project("bukkit") { - repositories { - maven { - name = "SpigotMC" - url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/" - } - } - dependencies { - shade "net.kyori:text-adapter-bukkit:$textExtrasVersion" - } -} -project("sponge") { - repositories { - maven { - name = "Sponge" - url = "https://repo.spongepowered.org/maven" - } - } - dependencies { - shade "net.kyori:text-adapter-spongeapi:$textExtrasVersion" - } -} - tasks.register("build") { dependsOn(subprojects.collect { it.tasks.named("build") }) } diff --git a/worldedit-libs/bukkit/build.gradle.kts b/worldedit-libs/bukkit/build.gradle.kts new file mode 100644 index 000000000..79734ff82 --- /dev/null +++ b/worldedit-libs/bukkit/build.gradle.kts @@ -0,0 +1,11 @@ +applyLibrariesConfiguration() + +repositories { + maven { + name = "SpigotMC" + url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") + } +} +dependencies { + "shade"("net.kyori:text-adapter-bukkit:${Versions.TEXT_EXTRAS}") +} \ No newline at end of file diff --git a/worldedit-libs/core/ap/build.gradle.kts b/worldedit-libs/core/ap/build.gradle.kts new file mode 100644 index 000000000..44374359b --- /dev/null +++ b/worldedit-libs/core/ap/build.gradle.kts @@ -0,0 +1,6 @@ +applyLibrariesConfiguration() + +dependencies { + "shade"("org.enginehub.piston.core-ap:annotations:${Versions.PISTON}") + "shade"("org.enginehub.piston.core-ap:processor:${Versions.PISTON}") +} diff --git a/worldedit-libs/core/build.gradle.kts b/worldedit-libs/core/build.gradle.kts new file mode 100644 index 000000000..d669216d6 --- /dev/null +++ b/worldedit-libs/core/build.gradle.kts @@ -0,0 +1,16 @@ +applyLibrariesConfiguration() + +dependencies { + "shade"("net.kyori:text-api:${Versions.TEXT}") + "shade"("net.kyori:text-serializer-gson:${Versions.TEXT}") + "shade"("net.kyori:text-serializer-legacy:${Versions.TEXT}") + "shade"("net.kyori:text-serializer-plain:${Versions.TEXT}") + "shade"("com.sk89q:jchronic:0.2.4a") { + exclude(group = "junit", module = "junit") + } + "shade"("com.thoughtworks.paranamer:paranamer:2.6") + "shade"("com.sk89q.lib:jlibnoise:1.0.0") + "shade"("org.enginehub.piston:core:${Versions.PISTON}") + "shade"("org.enginehub.piston.core-ap:runtime:${Versions.PISTON}") + "shade"("org.enginehub.piston:default-impl:${Versions.PISTON}") +} diff --git a/worldedit-libs/fabric/build.gradle.kts b/worldedit-libs/fabric/build.gradle.kts new file mode 100644 index 000000000..388618cea --- /dev/null +++ b/worldedit-libs/fabric/build.gradle.kts @@ -0,0 +1 @@ +applyLibrariesConfiguration() diff --git a/worldedit-libs/forge/build.gradle.kts b/worldedit-libs/forge/build.gradle.kts new file mode 100644 index 000000000..388618cea --- /dev/null +++ b/worldedit-libs/forge/build.gradle.kts @@ -0,0 +1 @@ +applyLibrariesConfiguration() diff --git a/worldedit-libs/sponge/build.gradle.kts b/worldedit-libs/sponge/build.gradle.kts new file mode 100644 index 000000000..5854dd616 --- /dev/null +++ b/worldedit-libs/sponge/build.gradle.kts @@ -0,0 +1,11 @@ +applyLibrariesConfiguration() + +repositories { + maven { + name = "Sponge" + url = uri("https://repo.spongepowered.org/maven") + } +} +dependencies { + "shade"("net.kyori:text-adapter-spongeapi:${Versions.TEXT_EXTRAS}") +} \ No newline at end of file diff --git a/worldedit-sponge/build.gradle b/worldedit-sponge/build.gradle index 8d6633de2..81d445a5d 100644 --- a/worldedit-sponge/build.gradle +++ b/worldedit-sponge/build.gradle @@ -2,6 +2,9 @@ plugins { id("org.spongepowered.plugin") } +PlatformConfigKt.applyPlatformAndCoreConfiguration(project) +PlatformConfigKt.applyShadowConfiguration(project) + repositories { maven { url "https://repo.codemc.org/repository/maven-public" } }