2019-08-26 04:45:03 +00:00
|
|
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
|
|
|
import org.gradle.api.Project
|
2021-09-19 20:50:34 +00: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 04:45:03 +00:00
|
|
|
import org.gradle.api.tasks.bundling.Jar
|
|
|
|
import org.gradle.kotlin.dsl.apply
|
2021-09-19 20:50:34 +00:00
|
|
|
import org.gradle.kotlin.dsl.configure
|
2019-08-26 04:45:03 +00:00
|
|
|
import org.gradle.kotlin.dsl.get
|
|
|
|
import org.gradle.kotlin.dsl.named
|
2021-09-19 20:50:34 +00:00
|
|
|
import org.gradle.kotlin.dsl.provideDelegate
|
2019-08-26 04:45:03 +00:00
|
|
|
import org.gradle.kotlin.dsl.register
|
2021-09-19 20:50:34 +00:00
|
|
|
import org.gradle.kotlin.dsl.the
|
2021-11-22 12:38:32 +00:00
|
|
|
import org.gradle.plugins.signing.SigningExtension
|
2019-08-26 04:45:03 +00:00
|
|
|
|
|
|
|
fun Project.applyPlatformAndCoreConfiguration() {
|
|
|
|
applyCommonConfiguration()
|
|
|
|
apply(plugin = "java")
|
2020-10-05 17:41:41 +00:00
|
|
|
apply(plugin = "eclipse")
|
2019-08-26 04:45:03 +00:00
|
|
|
apply(plugin = "idea")
|
2021-01-18 20:58:50 +00:00
|
|
|
apply(plugin = "maven-publish")
|
2019-08-26 04:45:03 +00:00
|
|
|
apply(plugin = "com.github.johnrengelman.shadow")
|
2021-11-22 12:38:32 +00:00
|
|
|
apply(plugin = "signing")
|
2019-08-26 04:45:03 +00:00
|
|
|
|
2021-10-17 14:32:36 +00:00
|
|
|
applyCommonJavaConfiguration(
|
|
|
|
sourcesJar = name in setOf("worldedit-core", "worldedit-bukkit"),
|
|
|
|
)
|
|
|
|
|
2021-04-19 10:56:34 +00:00
|
|
|
if (project.hasProperty("buildnumber")) {
|
|
|
|
ext["internalVersion"] = "$version;${rootProject.ext["gitCommitHash"]}"
|
|
|
|
} else {
|
|
|
|
ext["internalVersion"] = "$version"
|
|
|
|
}
|
2021-05-14 21:42:37 +00:00
|
|
|
|
2021-09-19 20:50:34 +00:00
|
|
|
configure<JavaPluginExtension> {
|
|
|
|
disableAutoTargetJvm()
|
|
|
|
withJavadocJar()
|
2019-08-26 04:45:03 +00:00
|
|
|
}
|
|
|
|
|
2021-09-19 20:50:34 +00:00
|
|
|
if (name in setOf("worldedit-core", "worldedit-bukkit", "worldedit-cli")) {
|
|
|
|
the<JavaPluginExtension>().withSourcesJar()
|
2019-08-26 04:45:03 +00:00
|
|
|
}
|
|
|
|
|
2021-09-19 20:50:34 +00:00
|
|
|
val javaComponent = components["java"] as AdhocComponentWithVariants
|
|
|
|
javaComponent.withVariantsFromConfiguration(configurations["shadowRuntimeElements"]) {
|
|
|
|
skip()
|
2019-08-26 04:45:03 +00:00
|
|
|
}
|
|
|
|
|
2021-11-25 12:14:49 +00:00
|
|
|
val publishingExtension = the<PublishingExtension>()
|
|
|
|
|
2021-11-22 12:38:32 +00:00
|
|
|
configure<SigningExtension> {
|
|
|
|
if (!version.toString().endsWith("-SNAPSHOT")) {
|
|
|
|
val signingKey: String? by project
|
|
|
|
val signingPassword: String? by project
|
|
|
|
useInMemoryPgpKeys(signingKey, signingPassword)
|
|
|
|
isRequired
|
2021-11-25 12:14:49 +00:00
|
|
|
sign(publishingExtension.publications)
|
2021-11-22 12:38:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-19 20:50:34 +00: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")
|
2022-05-07 14:14:40 +00:00
|
|
|
name.set("Alexander Brandes")
|
2023-03-02 19:50:01 +00:00
|
|
|
email.set("contact(at)notmyfault.dev")
|
2021-09-19 20:50:34 +00:00
|
|
|
organization.set("IntellectualSites")
|
2023-10-04 11:46:24 +00:00
|
|
|
organizationUrl.set("https://github.com/IntellectualSites")
|
2021-09-19 20:50:34 +00:00
|
|
|
}
|
|
|
|
developer {
|
|
|
|
id.set("SirYwell")
|
|
|
|
name.set("Hannes Greule")
|
|
|
|
organization.set("IntellectualSites")
|
2023-10-04 11:46:24 +00:00
|
|
|
organizationUrl.set("https://github.com/IntellectualSites")
|
2021-09-19 20:50:34 +00:00
|
|
|
}
|
|
|
|
developer {
|
|
|
|
id.set("dordsor21")
|
|
|
|
name.set("dordsor21")
|
|
|
|
organization.set("IntellectualSites")
|
2023-10-04 11:46:24 +00:00
|
|
|
organizationUrl.set("https://github.com/IntellectualSites")
|
2021-09-19 20:50:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
scm {
|
|
|
|
url.set("https://github.com/IntellectualSites/FastAsyncWorldEdit")
|
2023-10-04 09:04:35 +00:00
|
|
|
connection.set("scm:git:https://github.com/IntellectualSites/FastAsyncWorldEdit.git")
|
|
|
|
developerConnection.set("scm:git:git@github.com:IntellectualSites/FastAsyncWorldEdit.git")
|
|
|
|
tag.set("${project.version}")
|
2021-09-19 20:50:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
issueManagement{
|
|
|
|
system.set("GitHub")
|
|
|
|
url.set("https://github.com/IntellectualSites/FastAsyncWorldEdit/issues")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-08-26 04:45:03 +00:00
|
|
|
}
|
2021-11-22 12:38:32 +00:00
|
|
|
}
|
2019-08-26 04:45:03 +00:00
|
|
|
|
2021-07-09 09:08:17 +00: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 04:45:03 +00: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 10:14:09 +00:00
|
|
|
exclude("com.google.code.findbugs:jsr305")
|
2019-08-26 04:45:03 +00:00
|
|
|
}
|
|
|
|
exclude("GradleStart**")
|
|
|
|
exclude(".cache")
|
|
|
|
exclude("LICENSE*")
|
2019-11-19 21:25:36 +00:00
|
|
|
exclude("META-INF/maven/**")
|
2019-08-26 04:45:03 +00:00
|
|
|
minimize()
|
|
|
|
}
|
|
|
|
}
|
2020-01-11 03:32:12 +00:00
|
|
|
|
2019-12-16 11:00:12 +00:00
|
|
|
val CLASSPATH = listOf("truezip", "truevfs", "js")
|
|
|
|
.map { "$it.jar" }
|
2021-04-10 21:28:20 +00:00
|
|
|
.flatMap { listOf(it, "FastAsyncWorldEdit/$it") }
|
2019-12-16 11:00:12 +00:00
|
|
|
.joinToString(separator = " ")
|
2021-02-25 21:58:17 +00:00
|
|
|
|
|
|
|
sealed class WorldEditKind(
|
2021-07-01 20:16:25 +00:00
|
|
|
val name: String,
|
|
|
|
val mainClass: String = "com.sk89q.worldedit.internal.util.InfoEntryPoint"
|
2021-02-25 21:58:17 +00:00
|
|
|
) {
|
|
|
|
class Standalone(mainClass: String) : WorldEditKind("STANDALONE", mainClass)
|
|
|
|
object Mod : WorldEditKind("MOD")
|
|
|
|
object Plugin : WorldEditKind("PLUGIN")
|
|
|
|
}
|
|
|
|
|
2021-09-07 08:19:04 +00:00
|
|
|
fun Project.addJarManifest(kind: WorldEditKind, includeClasspath: Boolean = false, extraAttributes: Map<String, String> = mapOf()) {
|
2021-02-25 21:58:17 +00:00
|
|
|
tasks.named<Jar>("jar") {
|
|
|
|
val version = project(":worldedit-core").version
|
|
|
|
inputs.property("version", version)
|
|
|
|
val attributes = mutableMapOf(
|
2021-07-01 20:16:25 +00:00
|
|
|
"Implementation-Version" to version,
|
|
|
|
"WorldEdit-Version" to version,
|
|
|
|
"WorldEdit-Kind" to kind.name,
|
|
|
|
"Main-Class" to kind.mainClass
|
2021-02-25 21:58:17 +00:00
|
|
|
)
|
|
|
|
if (includeClasspath) {
|
|
|
|
attributes["Class-Path"] = CLASSPATH
|
|
|
|
}
|
2021-09-07 08:19:04 +00:00
|
|
|
attributes.putAll(extraAttributes)
|
2021-02-25 21:58:17 +00:00
|
|
|
manifest.attributes(attributes)
|
|
|
|
}
|
|
|
|
}
|