3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-16 16:10:07 +01:00

Messing around with the buildscripts

Dieser Commit ist enthalten in:
Matt 2023-09-15 21:24:25 -04:00
Ursprung 2f309ff22b
Commit 9393a96320
6 geänderte Dateien mit 37 neuen und 17 gelöschten Zeilen

Datei anzeigen

@ -3,12 +3,13 @@ import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.dependencies
// For specific version pinning, see
// https://papermc.io/repo/service/rest/repository/browse/maven-public/io/papermc/paper/dev-bundle/
fun Project.applyPaperweightAdapterConfiguration() {
// https://repo.papermc.io/service/rest/repository/browse/maven-public/io/papermc/paper/dev-bundle/
fun Project.applyPaperweightAdapterConfiguration(javaRelease: Int = 17) {
applyCommonConfiguration()
apply(plugin = "java-library")
applyCommonJavaConfiguration(
sourcesJar = true,
javaRelease = javaRelease,
banSlf4j = false,
)
apply(plugin = "io.papermc.paperweight.userdev")

Datei anzeigen

@ -11,9 +11,8 @@ import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.get
import org.gradle.kotlin.dsl.withType
fun Project.applyCommonJavaConfiguration(sourcesJar: Boolean, banSlf4j: Boolean = true) {
fun Project.applyCommonJavaConfiguration(sourcesJar: Boolean, javaRelease: Int = 17, banSlf4j: Boolean = true) {
applyCommonConfiguration()
apply(plugin = "eclipse")
apply(plugin = "idea")
tasks
@ -23,7 +22,7 @@ fun Project.applyCommonJavaConfiguration(sourcesJar: Boolean, banSlf4j: Boolean
val disabledLint = listOf(
"processing", "path", "fallthrough", "serial"
)
options.release.set(17)
options.release.set(javaRelease)
options.compilerArgs.addAll(listOf("-Xlint:all") + disabledLint.map { "-Xlint:-$it" })
options.isDeprecation = true
options.encoding = "UTF-8"
@ -49,6 +48,7 @@ fun Project.applyCommonJavaConfiguration(sourcesJar: Boolean, banSlf4j: Boolean
// Java 8 turns on doclint which we fail
tasks.withType<Javadoc>().configureEach {
options.encoding = "UTF-8"
(options as StandardJavadocDocletOptions).apply {
addStringOption("Xdoclint:none", "-quiet")
tags(
@ -56,7 +56,6 @@ fun Project.applyCommonJavaConfiguration(sourcesJar: Boolean, banSlf4j: Boolean
"implSpec:a:Implementation Requirements:",
"implNote:a:Implementation Note:"
)
options.encoding = "UTF-8"
links(
"https://jd.advntr.dev/api/latest/",
"https://logging.apache.org/log4j/2.x/log4j-api/apidocs/",

Datei anzeigen

@ -49,13 +49,20 @@ fun Project.applyLibrariesConfiguration() {
configurations = listOf(project.configurations["shade"])
archiveClassifier.set("")
// Yeet module-info's
exclude("module-info.class")
dependencies {
exclude(dependency("com.google.guava:guava"))
exclude(dependency("com.google.code.gson:gson"))
exclude(dependency("com.google.errorprone:error_prone_annotations"))
exclude(dependency("org.checkerframework:checker-qual"))
exclude(dependency("org.jetbrains:annotations"))
exclude(dependency("org.apache.logging.log4j:log4j-api"))
exclude(dependency("com.google.code.findbugs:jsr305"))
exclude {
it.moduleGroup == "org.jetbrains.kotlin"
}
}
relocations.forEach { (from, to) ->
@ -85,6 +92,10 @@ fun Project.applyLibrariesConfiguration() {
from({
altConfigFiles("sources")
})
// Yeet module-info's
exclude("module-info.java")
relocations.forEach { (from, to) ->
val filePattern = Regex("(.*)${from.replace('.', '/')}((?:/|$).*)")
val textPattern = Regex.fromLiteral(from)

Datei anzeigen

@ -17,10 +17,7 @@ import org.gradle.plugins.signing.SigningExtension
fun Project.applyPlatformAndCoreConfiguration() {
applyCommonConfiguration()
apply(plugin = "java")
apply(plugin = "eclipse")
apply(plugin = "idea")
apply(plugin = "maven-publish")
apply(plugin = "com.github.johnrengelman.shadow")
apply(plugin = "signing")
applyCommonJavaConfiguration(
@ -42,11 +39,6 @@ fun Project.applyPlatformAndCoreConfiguration() {
the<JavaPluginExtension>().withSourcesJar()
}
val javaComponent = components["java"] as AdhocComponentWithVariants
javaComponent.withVariantsFromConfiguration(configurations["shadowRuntimeElements"]) {
skip()
}
val publishingExtension = the<PublishingExtension>()
configure<SigningExtension> {
@ -62,7 +54,14 @@ fun Project.applyPlatformAndCoreConfiguration() {
configure<PublishingExtension> {
publications {
register<MavenPublication>("maven") {
from(javaComponent)
versionMapping {
usage("java-api") {
fromResolutionOf("runtimeClasspath")
}
usage("java-runtime") {
fromResolutionResult()
}
}
group = "com.fastasyncworldedit"
artifactId = "${rootProject.name}-${project.description}"
@ -128,6 +127,7 @@ fun Project.applyPlatformAndCoreConfiguration() {
}
fun Project.applyShadowConfiguration() {
apply(plugin = "com.github.johnrengelman.shadow")
tasks.named<ShadowJar>("shadowJar") {
dependencies {
include(project(":worldedit-libs:core"))
@ -141,6 +141,11 @@ fun Project.applyShadowConfiguration() {
exclude("META-INF/maven/**")
minimize()
}
val javaComponent = components["java"] as AdhocComponentWithVariants
// I don't think we want this published (it's the shadow jar)
javaComponent.withVariantsFromConfiguration(configurations["shadowRuntimeElements"]) {
skip()
}
}
val CLASSPATH = listOf("truezip", "truevfs", "js")

Datei anzeigen

@ -44,6 +44,8 @@ val localImplementation = configurations.create("localImplementation") {
isCanBeConsumed = false
isCanBeResolved = false
}
configurations["compileOnly"].extendsFrom(localImplementation)
configurations["testImplementation"].extendsFrom(localImplementation)
val adapters = configurations.create("adapters") {
description = "Adapters to include in the JAR"
@ -75,8 +77,8 @@ dependencies {
// Platform expectations
compileOnly(libs.paper) {
exclude("junit", "junit")
exclude(group = "org.slf4j", module = "slf4j-api")
exclude("junit", "junit")
}
// Logging

Datei anzeigen

@ -31,7 +31,9 @@ dependencies {
implementation(libs.snakeyaml)
// Logging
implementation(libs.log4jApi)
implementation(libs.log4jApi) {
because("Mojang provides Log4J")
}
// Plugins
compileOnly(libs.plotSquaredCore) { isTransitive = false }