3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-09-29 02:21:06 +02: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 import org.gradle.kotlin.dsl.dependencies
// For specific version pinning, see // For specific version pinning, see
// https://papermc.io/repo/service/rest/repository/browse/maven-public/io/papermc/paper/dev-bundle/ // https://repo.papermc.io/service/rest/repository/browse/maven-public/io/papermc/paper/dev-bundle/
fun Project.applyPaperweightAdapterConfiguration() { fun Project.applyPaperweightAdapterConfiguration(javaRelease: Int = 17) {
applyCommonConfiguration() applyCommonConfiguration()
apply(plugin = "java-library") apply(plugin = "java-library")
applyCommonJavaConfiguration( applyCommonJavaConfiguration(
sourcesJar = true, sourcesJar = true,
javaRelease = javaRelease,
banSlf4j = false, banSlf4j = false,
) )
apply(plugin = "io.papermc.paperweight.userdev") 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.get
import org.gradle.kotlin.dsl.withType 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() applyCommonConfiguration()
apply(plugin = "eclipse")
apply(plugin = "idea") apply(plugin = "idea")
tasks tasks
@ -23,7 +22,7 @@ fun Project.applyCommonJavaConfiguration(sourcesJar: Boolean, banSlf4j: Boolean
val disabledLint = listOf( val disabledLint = listOf(
"processing", "path", "fallthrough", "serial" "processing", "path", "fallthrough", "serial"
) )
options.release.set(17) options.release.set(javaRelease)
options.compilerArgs.addAll(listOf("-Xlint:all") + disabledLint.map { "-Xlint:-$it" }) options.compilerArgs.addAll(listOf("-Xlint:all") + disabledLint.map { "-Xlint:-$it" })
options.isDeprecation = true options.isDeprecation = true
options.encoding = "UTF-8" options.encoding = "UTF-8"
@ -49,6 +48,7 @@ fun Project.applyCommonJavaConfiguration(sourcesJar: Boolean, banSlf4j: Boolean
// Java 8 turns on doclint which we fail // Java 8 turns on doclint which we fail
tasks.withType<Javadoc>().configureEach { tasks.withType<Javadoc>().configureEach {
options.encoding = "UTF-8"
(options as StandardJavadocDocletOptions).apply { (options as StandardJavadocDocletOptions).apply {
addStringOption("Xdoclint:none", "-quiet") addStringOption("Xdoclint:none", "-quiet")
tags( tags(
@ -56,7 +56,6 @@ fun Project.applyCommonJavaConfiguration(sourcesJar: Boolean, banSlf4j: Boolean
"implSpec:a:Implementation Requirements:", "implSpec:a:Implementation Requirements:",
"implNote:a:Implementation Note:" "implNote:a:Implementation Note:"
) )
options.encoding = "UTF-8"
links( links(
"https://jd.advntr.dev/api/latest/", "https://jd.advntr.dev/api/latest/",
"https://logging.apache.org/log4j/2.x/log4j-api/apidocs/", "https://logging.apache.org/log4j/2.x/log4j-api/apidocs/",

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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