From ab8397e517eeab1e34f37b38772cc5b50a5ad871 Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Wed, 10 Jul 2019 16:45:12 -0700 Subject: [PATCH] Migrate Bukkit to Kotlin DSL --- buildSrc/src/main/kotlin/PlatformConfig.kt | 2 + worldedit-bukkit/build.gradle | 65 -------------------- worldedit-bukkit/build.gradle.kts | 69 ++++++++++++++++++++++ 3 files changed, 71 insertions(+), 65 deletions(-) delete mode 100644 worldedit-bukkit/build.gradle create mode 100644 worldedit-bukkit/build.gradle.kts diff --git a/buildSrc/src/main/kotlin/PlatformConfig.kt b/buildSrc/src/main/kotlin/PlatformConfig.kt index 85042cc9f..faf7a785a 100644 --- a/buildSrc/src/main/kotlin/PlatformConfig.kt +++ b/buildSrc/src/main/kotlin/PlatformConfig.kt @@ -20,6 +20,8 @@ import org.gradle.kotlin.dsl.named fun Project.applyPlatformAndCoreConfiguration() { applyCommonConfiguration() apply(plugin = "java") + apply(plugin = "eclipse") + apply(plugin = "idea") apply(plugin = "maven") apply(plugin = "checkstyle") apply(plugin = "com.github.johnrengelman.shadow") diff --git a/worldedit-bukkit/build.gradle b/worldedit-bukkit/build.gradle deleted file mode 100644 index b81612b0c..000000000 --- a/worldedit-bukkit/build.gradle +++ /dev/null @@ -1,65 +0,0 @@ -PlatformConfigKt.applyPlatformAndCoreConfiguration(project) -PlatformConfigKt.applyShadowConfiguration(project) -apply plugin: 'eclipse' -apply plugin: 'idea' -apply plugin: 'maven' -apply plugin: 'java-library' - -repositories { - maven { url "https://hub.spigotmc.org/nexus/content/groups/public" } - maven { url "https://repo.codemc.org/repository/maven-public" } - maven { url "https://papermc.io/repo/repository/maven-public/" } -} - -configurations.all { Configuration it -> - it.resolutionStrategy { ResolutionStrategy rs -> - rs.force("com.google.guava:guava:21.0") - } -} - -dependencies { - api project(':worldedit-core') - api project(':worldedit-libs:bukkit') - api 'org.bukkit:bukkit:1.13.2-R0.1-SNAPSHOT' // zzz - compileOnly 'com.destroystokyo.paper:paper-api:1.13.2-R0.1-SNAPSHOT' - implementation 'io.papermc:paperlib:1.0.2' - compileOnly 'com.sk89q:dummypermscompat:1.10' - implementation 'org.apache.logging.log4j:log4j-slf4j-impl:2.8.1' - implementation 'org.bstats:bstats-bukkit:1.5' - testCompile 'org.mockito:mockito-core:1.9.0-rc1' -} - -processResources { - filesMatching('plugin.yml') { - expand 'internalVersion': project.internalVersion - } - from (zipTree('src/main/resources/worldedit-adapters.jar').matching { - exclude 'META-INF/' - }) - exclude '**/worldedit-adapters.jar' -} - -jar { - manifest { - attributes("Class-Path": "truezip.jar WorldEdit/truezip.jar js.jar WorldEdit/js.jar", - "WorldEdit-Version": version) - } -} - -shadowJar { - dependencies { - relocate "org.slf4j", "com.sk89q.worldedit.slf4j" - relocate "org.apache.logging.slf4j", "com.sk89q.worldedit.log4jbridge" - include(dependency(':worldedit-core')) - include(dependency('org.slf4j:slf4j-api')) - include(dependency("org.apache.logging.log4j:log4j-slf4j-impl")) - relocate ("org.bstats", "com.sk89q.worldedit.bukkit.bstats") { - include(dependency("org.bstats:bstats-bukkit:1.5")) - } - relocate ("io.papermc.lib", "com.sk89q.worldedit.bukkit.paperlib") { - include(dependency("io.papermc:paperlib:1.0.2")) - } - } -} - -build.dependsOn(shadowJar) diff --git a/worldedit-bukkit/build.gradle.kts b/worldedit-bukkit/build.gradle.kts new file mode 100644 index 000000000..ee1b94c27 --- /dev/null +++ b/worldedit-bukkit/build.gradle.kts @@ -0,0 +1,69 @@ +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar + +plugins { + `java-library` +} + +applyPlatformAndCoreConfiguration() +applyShadowConfiguration() + +repositories { + maven { url = uri("https://hub.spigotmc.org/nexus/content/groups/public") } + maven { url = uri("https://repo.codemc.org/repository/maven-public") } + maven { url = uri("https://papermc.io/repo/repository/maven-public/") } +} + +configurations.all { + resolutionStrategy { + force("com.google.guava:guava:21.0") + } +} + +dependencies { + "api"(project(":worldedit-core")) + "api"(project(":worldedit-libs:bukkit")) + "api"("org.bukkit:bukkit:1.13.2-R0.1-SNAPSHOT") + "compileOnly"("com.destroystokyo.paper:paper-api:1.13.2-R0.1-SNAPSHOT") + "implementation"("io.papermc:paperlib:1.0.2") + "compileOnly"("com.sk89q:dummypermscompat:1.10") + "implementation"("org.apache.logging.log4j:log4j-slf4j-impl:2.8.1") + "implementation"("org.bstats:bstats-bukkit:1.5") + "testCompile"("org.mockito:mockito-core:1.9.0-rc1") +} + +tasks.named("processResources") { + filesMatching("plugin.yml") { + expand("internalVersion" to project.ext["internalVersion"]) + } + from(zipTree("src/main/resources/worldedit-adapters.jar").matching { + exclude("META-INF/") + }) + exclude("**/worldedit-adapters.jar") +} + +tasks.named("jar") { + manifest { + attributes("Class-Path" to "truezip.jar WorldEdit/truezip.jar js.jar WorldEdit/js.jar", + "WorldEdit-Version" to project.version) + } +} + +tasks.named("shadowJar") { + dependencies { + relocate("org.slf4j", "com.sk89q.worldedit.slf4j") + relocate("org.apache.logging.slf4j", "com.sk89q.worldedit.log4jbridge") + include(dependency(":worldedit-core")) + include(dependency("org.slf4j:slf4j-api")) + include(dependency("org.apache.logging.log4j:log4j-slf4j-impl")) + relocate("org.bstats", "com.sk89q.worldedit.bukkit.bstats") { + include(dependency("org.bstats:bstats-bukkit:1.5")) + } + relocate("io.papermc.lib", "com.sk89q.worldedit.bukkit.paperlib") { + include(dependency("io.papermc:paperlib:1.0.2")) + } + } +} + +tasks.named("assemble").configure { + dependsOn("shadowJar") +}