From 38bdb929f463c08fcc0ac82faeba90980538a003 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Wed, 27 Nov 2019 23:33:42 +0100 Subject: [PATCH] Generate maven artifacts I'm not a kotlin dsl expert, but that seems to work. --- worldedit-bukkit/build.gradle.kts | 49 +++++++++++++++++++++++++++++-- worldedit-core/build.gradle.kts | 47 +++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+), 2 deletions(-) diff --git a/worldedit-bukkit/build.gradle.kts b/worldedit-bukkit/build.gradle.kts index 88b4bdb3e..2911a08d1 100644 --- a/worldedit-bukkit/build.gradle.kts +++ b/worldedit-bukkit/build.gradle.kts @@ -2,6 +2,9 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar plugins { `java-library` + maven + java + `maven-publish` } applyPlatformAndCoreConfiguration() @@ -20,8 +23,8 @@ repositories { maven { url = uri("https://repo.destroystokyo.com/repository/maven-public//") } maven { url = uri("http://repo.dmulloy2.net/content/groups/public/") } maven { url = uri("http://ci.ender.zone/plugin/repository/everything/") } - maven { url = uri("https://repo.inventivetalent.org/content/groups/public/")} - flatDir {dir(File("src/main/resources"))} + maven { url = uri("https://repo.inventivetalent.org/content/groups/public/") } + flatDir { dir(File("src/main/resources")) } } configurations.all { @@ -81,6 +84,44 @@ tasks.named("jar") { } } +val jar: Jar by tasks +jar.archiveName = "FAWE-Bukkit-API-${project.version}.jar" +jar.destinationDir = file("../mvn/com/boydti/FAWE-Bukkit-API/" + project.version) + +task("writeNewPom") { + doLast { + maven.pom { + withGroovyBuilder { + "project" { + groupId = "com.boydti" + artifactId = "FAWE-Bukkit-API" + version = "project.version" + } + } + }.writeTo("../mvn/com/boydti/FAWE-Bukkit-API/${project.version}/FAWE-Bukkit-API-${project.version}.pom") + maven.pom { + withGroovyBuilder { + "project" { + groupId = "com.boydti" + artifactId = "FAWE-Bukkit-API" + version = "latest" + } + } + }.writeTo("../mvn/com/boydti/FAWE-Bukkit-API/latest/FAWE-Bukkit-API-latest.pom") + } +} + +task("dataContent") { + doLast { + copySpec { + from("../mvn/com/boydti/FAWE-Bukkit-API/${project.version}/") + into("../mvn/com/boydti/FAWE-Bukkit-API/latest/") + include("*.jar") + rename("FAWE-Bukkit-API-${project.version}.jar", "FAWE-Bukkit-API-latest.jar") + } + } +} + tasks.named("shadowJar") { dependencies { relocate("org.slf4j", "com.sk89q.worldedit.slf4j") @@ -107,3 +148,7 @@ tasks.named("shadowJar") { tasks.named("assemble").configure { dependsOn("shadowJar") } + +tasks.named("dataContent").configure { + dependsOn("writeNewPom") +} diff --git a/worldedit-core/build.gradle.kts b/worldedit-core/build.gradle.kts index a3bb707d5..f4ec977e7 100644 --- a/worldedit-core/build.gradle.kts +++ b/worldedit-core/build.gradle.kts @@ -5,6 +5,9 @@ import com.mendhak.gradlecrowdin.UploadSourceFileTask plugins { id("java-library") + id("java") + id("maven") + id("maven-publish") id("net.ltgt.apt-eclipse") id("net.ltgt.apt-idea") id("antlr") @@ -98,6 +101,45 @@ tasks.named("processResources") { "date" to "${rootProject.ext["date"]}") } } + +val jar: Jar by tasks +jar.archiveName = "FAWE-API-${project.version}.jar" +jar.destinationDir = file("../mvn/com/boydti/FAWE-API/" + project.version) + +task("writeNewPom") { + doLast { + maven.pom { + withGroovyBuilder { + "project" { + groupId = "com.boydti" + artifactId = "FAWE-API" + version = "project.version" + } + } + }.writeTo("../mvn/com/boydti/FAWE-API/${project.version}/FAWE-API-${project.version}.pom") + maven.pom { + withGroovyBuilder { + "project" { + groupId = "com.boydti" + artifactId = "FAWE-API" + version = "latest" + } + } + }.writeTo("../mvn/com/boydti/FAWE-API/latest/FAWE-API-latest.pom") + } +} + +task("dataContent") { + doLast { + copySpec { + from("../mvn/com/boydti/FAWE-API/${project.version}/") + into("../mvn/com/boydti/FAWE-API/latest/") + include("*.jar") + rename("FAWE-API-${project.version}.jar", "FAWE-API-latest.jar") + } + } +} + tasks.named("shadowJar") { dependencies { include(dependency("com.github.luben:zstd-jni:1.4.3-1")) @@ -129,3 +171,8 @@ if (project.hasProperty(crowdinApiKey)) { dependsOn("crowdinDownload") } } + +tasks.named("dataContent").configure { + dependsOn("writeNewPom") +} +