2019-08-26 04:45:03 +00:00
|
|
|
import org.ajoberstar.grgit.Grgit
|
2021-05-07 21:47:35 +00:00
|
|
|
import org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
|
|
|
|
import org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED
|
2021-11-22 15:56:20 +00:00
|
|
|
import java.net.URI
|
2023-04-07 13:10:14 +00:00
|
|
|
import java.time.format.DateTimeFormatter
|
|
|
|
import xyz.jpenilla.runpaper.task.RunServer
|
2021-11-22 15:56:20 +00:00
|
|
|
|
|
|
|
plugins {
|
2024-04-06 07:36:53 +00:00
|
|
|
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
|
2024-08-19 00:48:37 +00:00
|
|
|
id("xyz.jpenilla.run-paper") version "2.3.1"
|
2021-11-22 15:56:20 +00:00
|
|
|
}
|
2019-08-26 04:45:03 +00:00
|
|
|
|
2023-01-15 19:24:51 +00: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) }
|
|
|
|
}
|
|
|
|
|
2019-08-26 04:45:03 +00:00
|
|
|
logger.lifecycle("""
|
|
|
|
*******************************************
|
|
|
|
You are building FastAsyncWorldEdit!
|
|
|
|
|
|
|
|
If you encounter trouble:
|
2022-01-27 20:04:22 +00:00
|
|
|
1) Read COMPILING.adoc if you haven't yet
|
2019-08-26 04:45:03 +00:00
|
|
|
2) Try running 'build' in a separate Gradle run
|
|
|
|
3) Use gradlew and not gradle
|
2021-02-16 22:49:04 +00:00
|
|
|
4) If you still need help, ask on Discord! https://discord.gg/intellectualsites
|
2019-08-26 04:45:03 +00:00
|
|
|
|
|
|
|
Output files will be in [subproject]/build/libs
|
|
|
|
*******************************************
|
|
|
|
""")
|
2020-08-14 19:29:15 +00:00
|
|
|
|
2024-10-25 18:44:56 +00:00
|
|
|
var rootVersion by extra("2.12.1")
|
2021-11-22 12:38:32 +00:00
|
|
|
var snapshot by extra("SNAPSHOT")
|
2020-08-14 19:29:15 +00:00
|
|
|
var revision: String by extra("")
|
|
|
|
var buildNumber by extra("")
|
|
|
|
var date: String by extra("")
|
2019-08-26 04:45:03 +00:00
|
|
|
ext {
|
|
|
|
val git: Grgit = Grgit.open {
|
2021-04-18 18:23:32 +00:00
|
|
|
dir = File("$rootDir/.git")
|
2019-08-26 04:45:03 +00:00
|
|
|
}
|
2021-04-18 18:23:32 +00:00
|
|
|
date = git.head().dateTime.format(DateTimeFormatter.ofPattern("yy.MM.dd"))
|
|
|
|
revision = "-${git.head().abbreviatedId}"
|
|
|
|
buildNumber = if (project.hasProperty("buildnumber")) {
|
2021-12-21 15:27:46 +00:00
|
|
|
snapshot + "-" + project.properties["buildnumber"] as String
|
2019-08-26 04:45:03 +00:00
|
|
|
} else {
|
2021-11-22 13:35:40 +00:00
|
|
|
project.properties["snapshot"] as String
|
2019-11-07 10:28:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-10-25 18:44:56 +00:00
|
|
|
version = String.format("%s-%s", rootVersion, buildNumber)
|
2019-08-26 04:45:03 +00:00
|
|
|
|
|
|
|
if (!project.hasProperty("gitCommitHash")) {
|
|
|
|
apply(plugin = "org.ajoberstar.grgit")
|
|
|
|
ext["gitCommitHash"] = try {
|
2020-07-14 02:50:59 +00:00
|
|
|
extensions.getByName<Grgit>("grgit").head()?.abbreviatedId
|
2019-08-26 04:45:03 +00:00
|
|
|
} catch (e: Exception) {
|
|
|
|
logger.warn("Error getting commit hash", e)
|
|
|
|
|
2020-07-14 02:50:59 +00:00
|
|
|
"no.git.id"
|
2019-08-26 04:45:03 +00:00
|
|
|
}
|
|
|
|
}
|
2021-04-18 18:23:32 +00:00
|
|
|
|
|
|
|
allprojects {
|
|
|
|
gradle.projectsEvaluated {
|
|
|
|
tasks.withType(JavaCompile::class) {
|
|
|
|
options.compilerArgs.addAll(arrayOf("-Xmaxerrs", "1000"))
|
|
|
|
}
|
2021-05-07 21:47:35 +00:00
|
|
|
tasks.withType(Test::class) {
|
|
|
|
testLogging {
|
|
|
|
events(FAILED)
|
|
|
|
exceptionFormat = FULL
|
|
|
|
showExceptions = true
|
|
|
|
showCauses = true
|
|
|
|
showStackTraces = true
|
|
|
|
}
|
|
|
|
}
|
2021-04-18 18:23:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
applyCommonConfiguration()
|
2024-08-11 19:23:45 +00:00
|
|
|
val supportedVersions = listOf("1.19.4", "1.20", "1.20.4", "1.20.5", "1.20.6", "1.21", "1.21.1")
|
2021-11-22 15:56:20 +00:00
|
|
|
|
2022-06-20 15:56:51 +00:00
|
|
|
tasks {
|
2023-04-07 13:10:14 +00:00
|
|
|
supportedVersions.forEach {
|
|
|
|
register<RunServer>("runServer-$it") {
|
|
|
|
minecraftVersion(it)
|
|
|
|
pluginJars(*project(":worldedit-bukkit").getTasksByName("shadowJar", false).map { (it as Jar).archiveFile }
|
|
|
|
.toTypedArray())
|
2024-09-15 15:00:56 +00:00
|
|
|
jvmArgs("-DPaper.IgnoreJavaVersion=true", "-Dcom.mojang.eula.agree=true", "--add-modules=jdk.incubator.vector")
|
2023-04-07 13:10:14 +00:00
|
|
|
group = "run paper"
|
|
|
|
runDirectory.set(file("run-$it"))
|
|
|
|
}
|
|
|
|
}
|
2022-06-20 15:56:51 +00:00
|
|
|
runServer {
|
2024-09-15 15:32:58 +00:00
|
|
|
minecraftVersion("1.21.1")
|
2023-03-16 09:45:22 +00:00
|
|
|
pluginJars(*project(":worldedit-bukkit").getTasksByName("shadowJar", false).map { (it as Jar).archiveFile }
|
|
|
|
.toTypedArray())
|
2022-06-20 15:56:51 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-22 15:56:20 +00:00
|
|
|
nexusPublishing {
|
2023-06-06 17:18:01 +00:00
|
|
|
this.repositories {
|
2021-11-22 15:56:20 +00: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/"))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|