forked from EngineHub/WorldEdit
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
186 changed files
with
2,259 additions
and
6,142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
repositories { | ||
gradlePluginPortal() | ||
maven { | ||
name = "EngineHub Repository" | ||
url = uri("https://maven.enginehub.org/repo/") | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation(gradleApi()) | ||
implementation(libs.licenser) | ||
implementation(libs.grgit) | ||
implementation(libs.japicmp) | ||
implementation(libs.shadow) | ||
implementation(libs.jfrog.buildinfo) | ||
implementation(libs.paperweight) | ||
implementation(libs.gson) | ||
constraints { | ||
val asmVersion = "[${libs.versions.minimumAsm.get()},)" | ||
implementation("org.ow2.asm:asm:$asmVersion") { | ||
because("Need Java 21 support in shadow") | ||
} | ||
implementation("org.ow2.asm:asm-commons:$asmVersion") { | ||
because("Need Java 21 support in shadow") | ||
} | ||
implementation("org.vafer:jdependency:[${libs.versions.minimumJdependency.get()},)") { | ||
because("Need Java 21 support in shadow") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
dependencyResolutionManagement { | ||
versionCatalogs { | ||
create("libs") { | ||
from(files("../gradle/libs.versions.toml")) | ||
} | ||
} | ||
} | ||
|
||
rootProject.name = "build-logic" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import buildlogic.stringyLibs | ||
import buildlogic.getVersion | ||
|
||
plugins { | ||
`java-library` | ||
id("buildlogic.common") | ||
id("buildlogic.common-java") | ||
id("io.papermc.paperweight.userdev") | ||
} | ||
|
||
configure<buildlogic.CommonJavaExtension> { | ||
banSlf4j = false | ||
} | ||
|
||
dependencies { | ||
"implementation"(project(":worldedit-bukkit")) | ||
constraints { | ||
"remapper"("net.fabricmc:tiny-remapper:[${stringyLibs.getVersion("minimumTinyRemapper")},)") { | ||
because("Need remapper to support Java 21") | ||
} | ||
} | ||
} | ||
|
||
tasks.named("assemble") { | ||
dependsOn("reobfJar") | ||
} |
35 changes: 35 additions & 0 deletions
35
build-logic/src/main/kotlin/buildlogic.artifactory-root.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.configure | ||
import org.gradle.kotlin.dsl.named | ||
import org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention | ||
import org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask | ||
|
||
plugins { | ||
id("com.jfrog.artifactory") | ||
} | ||
|
||
val ARTIFACTORY_CONTEXT_URL = "artifactory_contextUrl" | ||
val ARTIFACTORY_USER = "artifactory_user" | ||
val ARTIFACTORY_PASSWORD = "artifactory_password" | ||
|
||
if (!project.hasProperty(ARTIFACTORY_CONTEXT_URL)) ext[ARTIFACTORY_CONTEXT_URL] = "http://localhost" | ||
if (!project.hasProperty(ARTIFACTORY_USER)) ext[ARTIFACTORY_USER] = "guest" | ||
if (!project.hasProperty(ARTIFACTORY_PASSWORD)) ext[ARTIFACTORY_PASSWORD] = "" | ||
|
||
configure<ArtifactoryPluginConvention> { | ||
setContextUrl("${project.property(ARTIFACTORY_CONTEXT_URL)}") | ||
clientConfig.publisher.run { | ||
repoKey = when { | ||
"${project.version}".contains("SNAPSHOT") -> "libs-snapshot-local" | ||
else -> "libs-release-local" | ||
} | ||
username = "${project.property(ARTIFACTORY_USER)}" | ||
password = "${project.property(ARTIFACTORY_PASSWORD)}" | ||
isMaven = true | ||
isIvy = false | ||
} | ||
} | ||
|
||
tasks.named<ArtifactoryTask>("artifactoryPublish") { | ||
isSkip = true | ||
} |
10 changes: 10 additions & 0 deletions
10
build-logic/src/main/kotlin/buildlogic.artifactory-sub.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
plugins { | ||
id("com.jfrog.artifactory") | ||
} | ||
|
||
// Artifactory eagerly evaluates publications, so this must run after all changes to artifacts are done | ||
afterEvaluate { | ||
tasks.named<org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask>("artifactoryPublish") { | ||
publications("maven") | ||
} | ||
} |
82 changes: 82 additions & 0 deletions
82
build-logic/src/main/kotlin/buildlogic.common-java.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import buildlogic.stringyLibs | ||
import buildlogic.getLibrary | ||
|
||
plugins { | ||
id("eclipse") | ||
id("idea") | ||
id("checkstyle") | ||
id("buildlogic.common") | ||
} | ||
|
||
val commonJava = extensions.create<buildlogic.CommonJavaExtension>("commonJava") | ||
commonJava.banSlf4j.convention(true) | ||
|
||
tasks | ||
.withType<JavaCompile>() | ||
.matching { it.name == "compileJava" || it.name == "compileTestJava" } | ||
.configureEach { | ||
// TODO: re-enable this-escape when ANTLR suppresses it properly | ||
val disabledLint = listOf( | ||
"processing", "path", "fallthrough", "serial", "overloads", "this-escape", | ||
) | ||
options.release.set(21) | ||
options.compilerArgs.addAll(listOf("-Xlint:all") + disabledLint.map { "-Xlint:-$it" }) | ||
options.isDeprecation = true | ||
options.encoding = "UTF-8" | ||
options.compilerArgs.add("-parameters") | ||
options.compilerArgs.add("-Werror") | ||
} | ||
|
||
configure<CheckstyleExtension> { | ||
configFile = rootProject.file("config/checkstyle/checkstyle.xml") | ||
toolVersion = "10.16.0" | ||
} | ||
|
||
tasks.withType<Test>().configureEach { | ||
useJUnitPlatform() | ||
} | ||
|
||
dependencies { | ||
"compileOnly"(stringyLibs.getLibrary("jsr305")) | ||
"testImplementation"(platform(stringyLibs.getLibrary("junit-bom"))) | ||
"testImplementation"(stringyLibs.getLibrary("junit-jupiter-api")) | ||
"testImplementation"(stringyLibs.getLibrary("junit-jupiter-params")) | ||
"testImplementation"(platform(stringyLibs.getLibrary("mockito-bom"))) | ||
"testImplementation"(stringyLibs.getLibrary("mockito-core")) | ||
"testImplementation"(stringyLibs.getLibrary("mockito-junit-jupiter")) | ||
"testRuntimeOnly"(stringyLibs.getLibrary("junit-jupiter-engine")) | ||
} | ||
|
||
// Java 8 turns on doclint which we fail | ||
tasks.withType<Javadoc>().configureEach { | ||
options.encoding = "UTF-8" | ||
(options as StandardJavadocDocletOptions).apply { | ||
addBooleanOption("Werror", true) | ||
addBooleanOption("Xdoclint:all", true) | ||
addBooleanOption("Xdoclint:-missing", true) | ||
tags( | ||
"apiNote:a:API Note:", | ||
"implSpec:a:Implementation Requirements:", | ||
"implNote:a:Implementation Note:" | ||
) | ||
} | ||
} | ||
|
||
configure<JavaPluginExtension> { | ||
withJavadocJar() | ||
withSourcesJar() | ||
} | ||
|
||
configurations["compileClasspath"].apply { | ||
resolutionStrategy.componentSelection { | ||
withModule("org.slf4j:slf4j-api") { | ||
if (commonJava.banSlf4j.get()) { | ||
reject("No SLF4J allowed on compile classpath") | ||
} | ||
} | ||
} | ||
} | ||
|
||
tasks.named("check").configure { | ||
dependsOn("checkstyleMain", "checkstyleTest") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import buildlogic.getLibrary | ||
import buildlogic.stringyLibs | ||
import org.gradle.plugins.ide.idea.model.IdeaModel | ||
|
||
plugins { | ||
id("org.cadixdev.licenser") | ||
} | ||
|
||
group = rootProject.group | ||
version = rootProject.version | ||
|
||
repositories { | ||
maven { | ||
name = "EngineHub" | ||
url = uri("https://maven.enginehub.org/repo/") | ||
} | ||
} | ||
|
||
configurations.all { | ||
resolutionStrategy { | ||
cacheChangingModulesFor(1, TimeUnit.DAYS) | ||
} | ||
} | ||
|
||
plugins.withId("java") { | ||
the<JavaPluginExtension>().toolchain { | ||
languageVersion.set(JavaLanguageVersion.of(21)) | ||
} | ||
} | ||
|
||
dependencies { | ||
for (conf in listOf("implementation", "api")) { | ||
if (!configurations.names.contains(conf)) { | ||
continue | ||
} | ||
add(conf, platform(stringyLibs.getLibrary("log4j-bom")).map { | ||
val dep = create(it) | ||
dep.because("Mojang provides Log4j") | ||
dep | ||
}) | ||
constraints { | ||
add(conf, stringyLibs.getLibrary("guava")) { | ||
because("Mojang provides Guava") | ||
} | ||
add(conf, stringyLibs.getLibrary("gson")) { | ||
because("Mojang provides Gson") | ||
} | ||
add(conf, stringyLibs.getLibrary("fastutil")) { | ||
because("Mojang provides FastUtil") | ||
} | ||
} | ||
} | ||
} | ||
|
||
license { | ||
header(rootProject.file("HEADER.txt")) | ||
include("**/*.java") | ||
include("**/*.kt") | ||
} | ||
|
||
plugins.withId("idea") { | ||
configure<IdeaModel> { | ||
module { | ||
isDownloadSources = true | ||
isDownloadJavadoc = true | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
build-logic/src/main/kotlin/buildlogic.core-and-platform.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
plugins { | ||
id("java") | ||
id("maven-publish") | ||
id("buildlogic.common-java") | ||
id("buildlogic.artifactory-sub") | ||
} | ||
|
||
ext["internalVersion"] = "$version+${rootProject.ext["gitCommitHash"]}" | ||
|
||
publishing { | ||
publications { | ||
register<MavenPublication>("maven") { | ||
versionMapping { | ||
usage("java-api") { | ||
fromResolutionOf("runtimeClasspath") | ||
} | ||
usage("java-runtime") { | ||
fromResolutionResult() | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.