2019-08-26 06:45:03 +02:00
|
|
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
|
|
|
import org.gradle.api.Project
|
2021-08-01 19:28:51 +02:00
|
|
|
import org.gradle.api.attributes.java.TargetJvmVersion
|
2021-09-19 22:50:34 +02:00
|
|
|
import org.gradle.api.component.AdhocComponentWithVariants
|
|
|
|
import org.gradle.api.plugins.JavaPluginExtension
|
|
|
|
import org.gradle.api.publish.PublishingExtension
|
|
|
|
import org.gradle.api.publish.maven.MavenPublication
|
2019-08-26 06:45:03 +02:00
|
|
|
import org.gradle.api.tasks.bundling.Jar
|
2020-08-14 21:29:15 +02:00
|
|
|
import org.gradle.api.tasks.compile.JavaCompile
|
2019-08-26 06:45:03 +02:00
|
|
|
import org.gradle.api.tasks.javadoc.Javadoc
|
|
|
|
import org.gradle.api.tasks.testing.Test
|
2020-01-07 22:11:47 +01:00
|
|
|
import org.gradle.external.javadoc.StandardJavadocDocletOptions
|
2019-08-26 06:45:03 +02:00
|
|
|
import org.gradle.kotlin.dsl.apply
|
2021-09-19 22:50:34 +02:00
|
|
|
import org.gradle.kotlin.dsl.configure
|
2019-08-26 06:45:03 +02:00
|
|
|
import org.gradle.kotlin.dsl.dependencies
|
|
|
|
import org.gradle.kotlin.dsl.get
|
|
|
|
import org.gradle.kotlin.dsl.getByName
|
|
|
|
import org.gradle.kotlin.dsl.named
|
2021-09-19 22:50:34 +02:00
|
|
|
import org.gradle.kotlin.dsl.provideDelegate
|
2019-08-26 06:45:03 +02:00
|
|
|
import org.gradle.kotlin.dsl.register
|
2021-09-19 22:50:34 +02:00
|
|
|
import org.gradle.kotlin.dsl.the
|
2019-08-26 06:45:03 +02:00
|
|
|
import org.gradle.kotlin.dsl.withType
|
|
|
|
|
|
|
|
fun Project.applyPlatformAndCoreConfiguration() {
|
|
|
|
applyCommonConfiguration()
|
|
|
|
apply(plugin = "java")
|
2020-10-05 19:41:41 +02:00
|
|
|
apply(plugin = "eclipse")
|
2019-08-26 06:45:03 +02:00
|
|
|
apply(plugin = "idea")
|
2021-01-18 21:58:50 +01:00
|
|
|
apply(plugin = "maven-publish")
|
2019-08-26 06:45:03 +02:00
|
|
|
apply(plugin = "com.github.johnrengelman.shadow")
|
|
|
|
|
2021-04-19 12:56:34 +02:00
|
|
|
if (project.hasProperty("buildnumber")) {
|
|
|
|
ext["internalVersion"] = "$version;${rootProject.ext["gitCommitHash"]}"
|
|
|
|
} else {
|
|
|
|
ext["internalVersion"] = "$version"
|
|
|
|
}
|
2021-05-14 23:42:37 +02:00
|
|
|
|
2020-08-14 21:29:15 +02:00
|
|
|
tasks
|
|
|
|
.withType<JavaCompile>()
|
|
|
|
.matching { it.name == "compileJava" || it.name == "compileTestJava" }
|
|
|
|
.configureEach {
|
|
|
|
val disabledLint = listOf(
|
|
|
|
"processing", "path", "fallthrough", "serial"
|
|
|
|
)
|
2021-07-01 22:16:25 +02:00
|
|
|
options.release.set(11)
|
2021-07-24 22:48:58 +02:00
|
|
|
options.compilerArgs.addAll(listOf("-Xlint:all") + disabledLint.map { "-Xlint:-$it" })
|
2020-08-14 21:29:15 +02:00
|
|
|
options.isDeprecation = false
|
|
|
|
options.encoding = "UTF-8"
|
2021-02-25 22:58:17 +01:00
|
|
|
options.compilerArgs.add("-parameters")
|
2020-08-14 21:29:15 +02:00
|
|
|
}
|
|
|
|
|
2021-08-01 19:28:51 +02:00
|
|
|
configurations.all {
|
|
|
|
attributes.attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 16)
|
|
|
|
}
|
2019-08-26 06:45:03 +02:00
|
|
|
|
|
|
|
tasks.withType<Test>().configureEach {
|
|
|
|
useJUnitPlatform()
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2021-08-01 19:28:51 +02:00
|
|
|
"compileOnly"("com.google.code.findbugs:jsr305:3.0.2")
|
|
|
|
"testImplementation"("org.junit.jupiter:junit-jupiter-api:5.7.2")
|
|
|
|
"testImplementation"("org.junit.jupiter:junit-jupiter-params:5.7.2")
|
2021-09-06 15:28:54 +02:00
|
|
|
"testImplementation"("org.mockito:mockito-core:3.12.4")
|
|
|
|
"testImplementation"("org.mockito:mockito-junit-jupiter:3.12.4")
|
2021-08-01 19:28:51 +02:00
|
|
|
"testImplementation"("net.bytebuddy:byte-buddy:1.11.9")
|
2021-09-06 15:28:54 +02:00
|
|
|
"testRuntimeOnly"("org.junit.jupiter:junit-jupiter-engine:3.12.4")
|
2019-08-26 06:45:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Java 8 turns on doclint which we fail
|
|
|
|
tasks.withType<Javadoc>().configureEach {
|
2020-08-14 21:29:15 +02:00
|
|
|
(options as StandardJavadocDocletOptions).apply {
|
|
|
|
addStringOption("Xdoclint:none", "-quiet")
|
|
|
|
tags(
|
|
|
|
"apiNote:a:API Note:",
|
|
|
|
"implSpec:a:Implementation Requirements:",
|
|
|
|
"implNote:a:Implementation Note:"
|
|
|
|
)
|
2021-08-10 10:31:37 +02:00
|
|
|
options.encoding = "UTF-8"
|
2021-08-18 11:26:14 +02:00
|
|
|
links(
|
|
|
|
"https://javadoc.io/doc/com.google.code.findbugs/jsr305/3.0.2/",
|
2021-09-07 10:41:42 +02:00
|
|
|
"https://jd.adventure.kyori.net/api/4.9.1/",
|
2021-08-18 11:26:14 +02:00
|
|
|
"https://javadoc.io/doc/org.apache.logging.log4j/log4j-api/2.14.1/",
|
|
|
|
"https://javadoc.io/doc/com.google.guava/guava/21.0/",
|
|
|
|
"https://www.antlr.org/api/Java/",
|
|
|
|
"https://docs.enginehub.org/javadoc/org.enginehub.piston/core/0.5.7/",
|
2021-08-18 12:08:52 +02:00
|
|
|
"https://docs.enginehub.org/javadoc/org.enginehub.piston/default-impl/0.5.7/",
|
|
|
|
"https://papermc.io/javadocs/paper/1.17/",
|
|
|
|
"https://ci.athion.net/job/FastAsyncWorldEdit-1.17-Core-Javadocs/javadoc/" // needed for other module linking
|
2021-08-18 11:26:14 +02:00
|
|
|
)
|
2020-08-14 21:29:15 +02:00
|
|
|
}
|
2019-08-26 06:45:03 +02:00
|
|
|
}
|
|
|
|
|
2021-09-19 22:50:34 +02:00
|
|
|
configure<JavaPluginExtension> {
|
|
|
|
disableAutoTargetJvm()
|
|
|
|
withJavadocJar()
|
2019-08-26 06:45:03 +02:00
|
|
|
}
|
|
|
|
|
2021-09-19 22:50:34 +02:00
|
|
|
if (name in setOf("worldedit-core", "worldedit-bukkit", "worldedit-cli")) {
|
|
|
|
the<JavaPluginExtension>().withSourcesJar()
|
2019-08-26 06:45:03 +02:00
|
|
|
}
|
|
|
|
|
2021-09-19 22:50:34 +02:00
|
|
|
val javaComponent = components["java"] as AdhocComponentWithVariants
|
|
|
|
javaComponent.withVariantsFromConfiguration(configurations["shadowRuntimeElements"]) {
|
|
|
|
skip()
|
2019-08-26 06:45:03 +02:00
|
|
|
}
|
|
|
|
|
2021-09-19 22:50:34 +02:00
|
|
|
configure<PublishingExtension> {
|
|
|
|
publications {
|
|
|
|
register<MavenPublication>("maven") {
|
|
|
|
from(javaComponent)
|
|
|
|
|
|
|
|
group = "com.fastasyncworldedit"
|
|
|
|
artifactId = "${rootProject.name}-${project.description}"
|
|
|
|
version = version
|
|
|
|
|
|
|
|
pom {
|
|
|
|
name.set("${rootProject.name}-${project.description}" + " " + project.version)
|
|
|
|
description.set("Blazingly fast Minecraft world manipulation for artists, builders and everyone else.")
|
|
|
|
url.set("https://github.com/IntellectualSites/FastAsyncWorldEdit")
|
|
|
|
|
|
|
|
licenses {
|
|
|
|
license {
|
|
|
|
name.set("GNU General Public License, Version 3.0")
|
|
|
|
url.set("https://www.gnu.org/licenses/gpl-3.0.html")
|
|
|
|
distribution.set("repo")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
developers {
|
|
|
|
developer {
|
|
|
|
id.set("NotMyFault")
|
|
|
|
name.set("NotMyFault")
|
|
|
|
email.set("contact@notmyfault.dev")
|
|
|
|
organization.set("IntellectualSites")
|
|
|
|
}
|
|
|
|
developer {
|
|
|
|
id.set("SirYwell")
|
|
|
|
name.set("Hannes Greule")
|
|
|
|
organization.set("IntellectualSites")
|
|
|
|
}
|
|
|
|
developer {
|
|
|
|
id.set("dordsor21")
|
|
|
|
name.set("dordsor21")
|
|
|
|
organization.set("IntellectualSites")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
scm {
|
|
|
|
url.set("https://github.com/IntellectualSites/FastAsyncWorldEdit")
|
|
|
|
connection.set("scm:https://IntellectualSites@github.com/IntellectualSites/FastAsyncWorldEdit.git")
|
|
|
|
developerConnection.set("scm:git://github.com/IntellectualSites/FastAsyncWorldEdit.git")
|
|
|
|
}
|
|
|
|
|
|
|
|
issueManagement{
|
|
|
|
system.set("GitHub")
|
|
|
|
url.set("https://github.com/IntellectualSites/FastAsyncWorldEdit/issues")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-08-26 06:45:03 +02:00
|
|
|
}
|
|
|
|
|
2021-09-19 22:50:34 +02:00
|
|
|
repositories {
|
|
|
|
mavenLocal()
|
|
|
|
val nexusUsername: String? by project
|
|
|
|
val nexusPassword: String? by project
|
|
|
|
if (nexusUsername != null && nexusPassword != null) {
|
|
|
|
maven {
|
|
|
|
val releasesRepositoryUrl = "https://mvn.intellectualsites.com/content/repositories/releases/"
|
|
|
|
val snapshotRepositoryUrl = "https://mvn.intellectualsites.com/content/repositories/snapshots/"
|
|
|
|
/* Commenting this out for now - Fawe currently does not user semver or any sort of versioning that
|
|
|
|
differentiates between snapshots and releases, API & (past) deployment wise, this will come with a next major release.
|
|
|
|
url = uri(
|
|
|
|
if (version.toString().endsWith("-SNAPSHOT")) snapshotRepositoryUrl
|
|
|
|
else releasesRepositoryUrl
|
|
|
|
)
|
|
|
|
*/
|
|
|
|
url = uri(releasesRepositoryUrl)
|
|
|
|
|
|
|
|
credentials {
|
|
|
|
username = nexusUsername
|
|
|
|
password = nexusPassword
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
logger.warn("No nexus repository is added; nexusUsername or nexusPassword is null.")
|
|
|
|
}
|
2019-08-26 06:45:03 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-09 11:08:17 +02:00
|
|
|
if (name != "worldedit-fabric") {
|
|
|
|
configurations["compileClasspath"].apply {
|
|
|
|
resolutionStrategy.componentSelection {
|
|
|
|
withModule("org.slf4j:slf4j-api") {
|
|
|
|
reject("No SLF4J allowed on compile classpath")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-26 06:45:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
fun Project.applyShadowConfiguration() {
|
|
|
|
tasks.named<ShadowJar>("shadowJar") {
|
|
|
|
dependencies {
|
|
|
|
include(project(":worldedit-libs:core"))
|
|
|
|
include(project(":worldedit-libs:${project.name.replace("worldedit-", "")}"))
|
|
|
|
include(project(":worldedit-core"))
|
2021-01-25 11:14:09 +01:00
|
|
|
exclude("com.google.code.findbugs:jsr305")
|
2019-08-26 06:45:03 +02:00
|
|
|
}
|
|
|
|
exclude("GradleStart**")
|
|
|
|
exclude(".cache")
|
|
|
|
exclude("LICENSE*")
|
2019-11-19 22:25:36 +01:00
|
|
|
exclude("META-INF/maven/**")
|
2019-08-26 06:45:03 +02:00
|
|
|
minimize()
|
|
|
|
}
|
|
|
|
}
|
2020-01-11 04:32:12 +01:00
|
|
|
|
2019-12-16 12:00:12 +01:00
|
|
|
val CLASSPATH = listOf("truezip", "truevfs", "js")
|
|
|
|
.map { "$it.jar" }
|
2021-04-10 23:28:20 +02:00
|
|
|
.flatMap { listOf(it, "FastAsyncWorldEdit/$it") }
|
2019-12-16 12:00:12 +01:00
|
|
|
.joinToString(separator = " ")
|
2021-02-25 22:58:17 +01:00
|
|
|
|
|
|
|
sealed class WorldEditKind(
|
2021-07-01 22:16:25 +02:00
|
|
|
val name: String,
|
|
|
|
val mainClass: String = "com.sk89q.worldedit.internal.util.InfoEntryPoint"
|
2021-02-25 22:58:17 +01:00
|
|
|
) {
|
|
|
|
class Standalone(mainClass: String) : WorldEditKind("STANDALONE", mainClass)
|
|
|
|
object Mod : WorldEditKind("MOD")
|
|
|
|
object Plugin : WorldEditKind("PLUGIN")
|
|
|
|
}
|
|
|
|
|
2021-09-07 10:19:04 +02:00
|
|
|
fun Project.addJarManifest(kind: WorldEditKind, includeClasspath: Boolean = false, extraAttributes: Map<String, String> = mapOf()) {
|
2021-02-25 22:58:17 +01:00
|
|
|
tasks.named<Jar>("jar") {
|
|
|
|
val version = project(":worldedit-core").version
|
|
|
|
inputs.property("version", version)
|
|
|
|
val attributes = mutableMapOf(
|
2021-07-01 22:16:25 +02:00
|
|
|
"Implementation-Version" to version,
|
|
|
|
"WorldEdit-Version" to version,
|
|
|
|
"WorldEdit-Kind" to kind.name,
|
|
|
|
"Main-Class" to kind.mainClass
|
2021-02-25 22:58:17 +01:00
|
|
|
)
|
|
|
|
if (includeClasspath) {
|
|
|
|
attributes["Class-Path"] = CLASSPATH
|
|
|
|
}
|
2021-09-07 10:19:04 +02:00
|
|
|
attributes.putAll(extraAttributes)
|
2021-02-25 22:58:17 +01:00
|
|
|
manifest.attributes(attributes)
|
|
|
|
}
|
|
|
|
}
|