diff --git a/build.gradle.kts b/build.gradle.kts index 140e4ea92..9b6696b5a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -23,33 +23,53 @@ dependencies { paperclip("io.papermc:paperclip:3.0.3") } -subprojects { +allprojects { apply(plugin = "java") + apply(plugin = "maven-publish") + + java.toolchain.languageVersion.set(JavaLanguageVersion.of(17)) + + publishing { + repositories { + maven { + name = "githubPackage" + url = uri("https://maven.pkg.github.com/PlazmaMC/Plazma") + + credentials { + username = System.getenv("GITHUB_USERNAME") + password = System.getenv("GITHUB_TOKEN") + } + } - java { - toolchain { - languageVersion.set(JavaLanguageVersion.of(17)) + publications.register("gpr") { + from(components["java"]) + } } } } subprojects { - tasks.withType().configureEach { - options.encoding = "UTF-8" - options.release.set(17) - } + apply(plugin = "java") - tasks.withType { - options.encoding = Charsets.UTF_8.name() - } + tasks { + withType().configureEach { + options.compilerArgs.add("--add-modules=jdk.incubator.vector") + options.encoding = Charsets.UTF_8.name() + options.release.set(17) + } - tasks.withType { - filteringCharset = Charsets.UTF_8.name() - } + withType { + options.encoding = Charsets.UTF_8.name() + } - tasks.withType { - minHeapSize = "2g" - maxHeapSize = "2g" + withType { + filteringCharset = Charsets.UTF_8.name() + } + + withType { + minHeapSize = "2g" + maxHeapSize = "2g" + } } repositories { @@ -83,28 +103,39 @@ paperweight { } } -val upstreamTask = tasks.register("updateUpstream") { - val tempDir = layout.cacheDir("updateUpstream"); - val file = "gradle.properties"; - - doFirst { - val apiResponse = layout.cache.resolve("apiResponse.json"); - download.get().download("https://api.github.com/repos/PaperMC/Paper/commits/master", apiResponse); - val latestCommit = gson.fromJson(apiResponse)["sha"].asString; +tasks { + generateDevelopmentBundle { + apiCoordinates.set("org.plazmamc.plazma:plazma-api") + mojangApiCoordinates.set("io.papermc.paper:paper-mojangapi") + libraryRepositories.addAll( + "https://repo.maven.apache.org/maven2/", + "https://papermc.io/repo/repository/maven-public/" + ) + } - copy { - from(file) - into(tempDir) - filter { line: String -> - line.replace("paperCommit = .*".toRegex(), "paperCommit = $latestCommit") + register("updateUpstream") { + val tempDir = layout.cacheDir("updateUpstream"); + val file = "gradle.properties"; + + doFirst { + val apiResponse = layout.cache.resolve("apiResponse.json"); + download.get().download("https://api.github.com/repos/PaperMC/Paper/commits/master", apiResponse); + val latestCommit = gson.fromJson(apiResponse)["sha"].asString; + + copy { + from(file) + into(tempDir) + filter { line: String -> + line.replace("paperCommit = .*".toRegex(), "paperCommit = $latestCommit") + } } } - } - doLast { - copy { - from(tempDir.file("gradle.properties")) - into(project.file(file).parent) + doLast { + copy { + from(tempDir.file("gradle.properties")) + into(project.file(file).parent) + } } } }