2023-03-06 11:38:30 +01:00
|
|
|
import com.diffplug.gradle.spotless.SpotlessPlugin
|
2020-09-20 22:42:13 +02:00
|
|
|
import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin
|
2021-10-04 15:28:47 +02:00
|
|
|
import java.net.URI
|
2023-04-22 11:33:00 +02:00
|
|
|
import xyz.jpenilla.runpaper.task.RunServer
|
2020-09-20 22:42:13 +02:00
|
|
|
|
|
|
|
plugins {
|
|
|
|
java
|
|
|
|
`java-library`
|
|
|
|
`maven-publish`
|
2021-09-04 13:58:16 +02:00
|
|
|
signing
|
2021-08-17 16:38:24 +02:00
|
|
|
|
|
|
|
alias(libs.plugins.shadow)
|
2023-01-08 23:16:40 +01:00
|
|
|
alias(libs.plugins.spotless)
|
2021-08-17 16:38:24 +02:00
|
|
|
alias(libs.plugins.grgit)
|
2021-10-04 15:28:47 +02:00
|
|
|
alias(libs.plugins.nexus)
|
2020-09-20 22:42:13 +02:00
|
|
|
|
|
|
|
eclipse
|
|
|
|
idea
|
2023-04-22 11:33:00 +02:00
|
|
|
|
2023-05-01 10:02:48 +02:00
|
|
|
id("xyz.jpenilla.run-paper") version "2.1.0"
|
2020-09-20 22:42:13 +02:00
|
|
|
}
|
|
|
|
|
2023-06-08 10:40:02 +02:00
|
|
|
group = "com.intellectualsites.plotsquared"
|
2023-08-02 13:57:50 +02:00
|
|
|
version = "7.0.0-SNAPSHOT"
|
2020-09-20 22:42:13 +02:00
|
|
|
|
2023-01-16 00:18:51 +01:00
|
|
|
if (!File("$rootDir/.git").exists()) {
|
|
|
|
logger.lifecycle("""
|
|
|
|
**************************************************************************************
|
|
|
|
You need to fork and clone this repository! Don't download a .zip file.
|
|
|
|
If you need assistance, consult the GitHub docs: https://docs.github.com/get-started/quickstart/fork-a-repo
|
|
|
|
**************************************************************************************
|
|
|
|
""".trimIndent()
|
|
|
|
).also { kotlin.system.exitProcess(1) }
|
|
|
|
}
|
|
|
|
|
2022-06-13 15:23:12 +02:00
|
|
|
subprojects {
|
|
|
|
group = rootProject.group
|
2020-09-20 22:42:13 +02:00
|
|
|
version = rootProject.version
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
|
|
|
|
|
|
|
maven {
|
|
|
|
name = "Sonatype OSS"
|
|
|
|
url = uri("https://oss.sonatype.org/content/repositories/snapshots/")
|
|
|
|
}
|
|
|
|
|
2021-12-31 15:49:11 +01:00
|
|
|
maven {
|
|
|
|
name = "Sonatype OSS (S01)"
|
2022-06-09 12:57:37 +02:00
|
|
|
url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
|
2021-12-31 15:49:11 +01:00
|
|
|
}
|
|
|
|
|
2020-09-20 22:42:13 +02:00
|
|
|
maven {
|
|
|
|
name = "Jitpack"
|
|
|
|
url = uri("https://jitpack.io")
|
2022-04-19 00:46:39 +02:00
|
|
|
content {
|
|
|
|
includeModule("com.github.MilkBowl", "VaultAPI")
|
|
|
|
}
|
2020-09-20 22:42:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
maven {
|
2021-07-05 15:25:22 +02:00
|
|
|
name = "EngineHub"
|
2020-09-20 22:42:13 +02:00
|
|
|
url = uri("https://maven.enginehub.org/repo/")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
apply {
|
|
|
|
plugin<JavaPlugin>()
|
|
|
|
plugin<JavaLibraryPlugin>()
|
|
|
|
plugin<MavenPublishPlugin>()
|
|
|
|
plugin<ShadowPlugin>()
|
2023-01-08 23:16:40 +01:00
|
|
|
plugin<SpotlessPlugin>()
|
2021-09-04 13:58:16 +02:00
|
|
|
plugin<SigningPlugin>()
|
2020-09-20 22:42:13 +02:00
|
|
|
|
|
|
|
plugin<EclipsePlugin>()
|
|
|
|
plugin<IdeaPlugin>()
|
|
|
|
}
|
2022-06-09 12:57:37 +02:00
|
|
|
|
|
|
|
dependencies {
|
2023-08-01 10:45:47 +02:00
|
|
|
implementation(platform("com.intellectualsites.bom:bom-newest:1.34"))
|
2022-06-09 12:57:37 +02:00
|
|
|
}
|
2020-09-20 22:42:13 +02:00
|
|
|
|
2020-10-08 01:22:19 +02:00
|
|
|
dependencies {
|
|
|
|
// Tests
|
2023-08-01 10:45:38 +02:00
|
|
|
testImplementation("org.junit.jupiter:junit-jupiter:5.10.0")
|
2020-10-08 01:22:19 +02:00
|
|
|
}
|
|
|
|
|
2021-04-30 09:50:22 +02:00
|
|
|
plugins.withId("java") {
|
|
|
|
the<JavaPluginExtension>().toolchain {
|
2021-12-18 23:10:41 +01:00
|
|
|
languageVersion.set(JavaLanguageVersion.of(17))
|
2021-04-30 09:50:22 +02:00
|
|
|
}
|
2020-09-20 22:42:13 +02:00
|
|
|
}
|
|
|
|
|
2021-12-18 23:10:41 +01:00
|
|
|
tasks.compileJava.configure {
|
2022-01-27 13:26:58 +01:00
|
|
|
options.release.set(17)
|
2021-12-18 23:10:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
configurations.all {
|
|
|
|
attributes.attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 17)
|
|
|
|
}
|
|
|
|
|
2023-01-08 23:16:40 +01:00
|
|
|
spotless {
|
|
|
|
java {
|
|
|
|
licenseHeaderFile(rootProject.file("HEADER.txt"))
|
|
|
|
target("**/*.java")
|
2023-01-15 17:54:52 +01:00
|
|
|
endWithNewline()
|
|
|
|
trimTrailingWhitespace()
|
|
|
|
removeUnusedImports()
|
2023-01-08 23:16:40 +01:00
|
|
|
}
|
2020-09-20 22:42:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
java {
|
|
|
|
withSourcesJar()
|
|
|
|
withJavadocJar()
|
|
|
|
}
|
|
|
|
|
2021-09-07 13:52:47 +02:00
|
|
|
val javaComponent = components["java"] as AdhocComponentWithVariants
|
|
|
|
javaComponent.withVariantsFromConfiguration(configurations["shadowRuntimeElements"]) {
|
|
|
|
skip()
|
|
|
|
}
|
|
|
|
|
2021-09-04 13:58:16 +02:00
|
|
|
signing {
|
|
|
|
if (!version.toString().endsWith("-SNAPSHOT")) {
|
2021-10-04 15:28:47 +02:00
|
|
|
val signingKey: String? by project
|
|
|
|
val signingPassword: String? by project
|
|
|
|
useInMemoryPgpKeys(signingKey, signingPassword)
|
2021-09-04 13:58:16 +02:00
|
|
|
signing.isRequired
|
|
|
|
sign(publishing.publications)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-08 12:07:18 +02:00
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
create<MavenPublication>("maven") {
|
|
|
|
from(components["java"])
|
|
|
|
|
|
|
|
pom {
|
2021-09-04 13:58:16 +02:00
|
|
|
|
|
|
|
name.set(project.name + " " + project.version)
|
2022-06-15 20:17:17 +02:00
|
|
|
description.set("PlotSquared, a land and world management plugin for Minecraft.")
|
2021-09-04 13:58:16 +02:00
|
|
|
url.set("https://github.com/IntellectualSites/PlotSquared")
|
|
|
|
|
2020-10-08 12:07:18 +02:00
|
|
|
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 {
|
2020-12-16 13:23:14 +01:00
|
|
|
id.set("Sauilitired")
|
2020-10-08 12:07:18 +02:00
|
|
|
name.set("Alexander Söderberg")
|
2021-10-04 15:28:47 +02:00
|
|
|
organization.set("IntellectualSites")
|
2020-10-08 12:07:18 +02:00
|
|
|
}
|
2020-10-08 21:25:09 +02:00
|
|
|
developer {
|
2021-04-30 09:50:22 +02:00
|
|
|
id.set("NotMyFault")
|
2022-05-07 15:56:24 +02:00
|
|
|
name.set("Alexander Brandes")
|
2021-10-04 15:28:47 +02:00
|
|
|
organization.set("IntellectualSites")
|
2023-03-02 20:48:33 +01:00
|
|
|
email.set("contact(at)notmyfault.dev")
|
2020-10-08 21:25:09 +02:00
|
|
|
}
|
2020-12-05 19:50:41 +01:00
|
|
|
developer {
|
|
|
|
id.set("SirYwell")
|
|
|
|
name.set("Hannes Greule")
|
2021-10-04 15:28:47 +02:00
|
|
|
organization.set("IntellectualSites")
|
2020-12-05 19:50:41 +01:00
|
|
|
}
|
2020-12-14 19:09:09 +01:00
|
|
|
developer {
|
|
|
|
id.set("dordsor21")
|
|
|
|
name.set("dordsor21")
|
2021-10-04 15:28:47 +02:00
|
|
|
organization.set("IntellectualSites")
|
2020-12-14 19:09:09 +01:00
|
|
|
}
|
2020-10-08 12:07:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
scm {
|
|
|
|
url.set("https://github.com/IntellectualSites/PlotSquared")
|
|
|
|
connection.set("scm:https://IntellectualSites@github.com/IntellectualSites/PlotSquared.git")
|
|
|
|
developerConnection.set("scm:git://github.com/IntellectualSites/PlotSquared.git")
|
|
|
|
}
|
2021-09-04 13:58:16 +02:00
|
|
|
|
2022-06-13 15:23:12 +02:00
|
|
|
issueManagement {
|
2021-09-04 13:58:16 +02:00
|
|
|
system.set("GitHub")
|
|
|
|
url.set("https://github.com/IntellectualSites/PlotSquared/issues")
|
|
|
|
}
|
2020-10-08 12:07:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-20 22:42:13 +02:00
|
|
|
tasks {
|
2020-10-08 11:49:05 +02:00
|
|
|
|
2020-09-20 22:42:13 +02:00
|
|
|
compileJava {
|
2022-09-03 12:55:55 +02:00
|
|
|
options.compilerArgs.add("-parameters")
|
2020-09-20 22:42:13 +02:00
|
|
|
options.isDeprecation = true
|
|
|
|
options.encoding = "UTF-8"
|
|
|
|
}
|
|
|
|
|
|
|
|
shadowJar {
|
|
|
|
this.archiveClassifier.set(null as String?)
|
|
|
|
this.archiveFileName.set("${project.name}-${project.version}.${this.archiveExtension.getOrElse("jar")}")
|
|
|
|
}
|
|
|
|
|
|
|
|
named("build") {
|
|
|
|
dependsOn(named("shadowJar"))
|
|
|
|
}
|
2021-08-08 13:28:43 +02:00
|
|
|
test {
|
|
|
|
useJUnitPlatform()
|
|
|
|
}
|
2020-09-20 22:42:13 +02:00
|
|
|
}
|
|
|
|
}
|
2021-06-02 23:26:27 +02:00
|
|
|
|
2021-10-04 15:28:47 +02:00
|
|
|
nexusPublishing {
|
2023-06-08 10:40:02 +02:00
|
|
|
this.repositories {
|
2021-10-04 15:28:47 +02:00
|
|
|
sonatype {
|
|
|
|
nexusUrl.set(URI.create("https://s01.oss.sonatype.org/service/local/"))
|
|
|
|
snapshotRepositoryUrl.set(URI.create("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-06-13 15:23:12 +02:00
|
|
|
|
|
|
|
tasks.getByName<Jar>("jar") {
|
|
|
|
enabled = false
|
|
|
|
}
|
2023-04-22 11:33:00 +02:00
|
|
|
|
2023-06-09 13:22:55 +02:00
|
|
|
val supportedVersions = listOf("1.16.5", "1.17", "1.17.1", "1.18.2", "1.19", "1.19.1", "1.19.2", "1.19.3", "1.19.4", "1.20")
|
2023-04-22 11:33:00 +02:00
|
|
|
tasks {
|
|
|
|
supportedVersions.forEach {
|
|
|
|
register<RunServer>("runServer-$it") {
|
|
|
|
minecraftVersion(it)
|
2023-06-08 10:40:02 +02:00
|
|
|
pluginJars(*project(":plotsquared-bukkit").getTasksByName("shadowJar", false).map { (it as Jar).archiveFile }
|
2023-04-22 11:33:00 +02:00
|
|
|
.toTypedArray())
|
|
|
|
jvmArgs("-DPaper.IgnoreJavaVersion=true", "-Dcom.mojang.eula.agree=true")
|
|
|
|
group = "run paper"
|
|
|
|
runDirectory.set(file("run-$it"))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|