feat: build improvements

This commit is contained in:
Zoe Gidiere committed 2026-11-10 08:52:27 -07:00
1 parent b8f94a67ef
commit 407aaf203e
32 files changed
+378 -356

No files matched your search

+2 -6
View File
@@ -12,18 +12,14 @@ allprojects {
configureDependencies()
configurePublishing()
tasks.withType<JavaCompile>().configureEach {
options.isFork = true
options.isIncremental = true
}
tasks.withType<Test>().configureEach {
useJUnitPlatform()
maxHeapSize = "2G"
ignoreFailures = false
failFast = true
maxParallelForks = (Runtime.getRuntime().availableProcessors() - 1).takeIf { it > 0 } ?: 1
// Projects already test in parallel, more forks per task mostly adds JVM and Minecraft bootstrap time.
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 8).coerceIn(1, 4)
reports.html.required.set(false)
reports.junitXml.required.set(false)
+5 -5
View File
@@ -28,10 +28,10 @@ repositories {
dependencies {
//TODO Allow pulling from Versions.kt
implementation("com.gradleup.shadow", "shadow-gradle-plugin", "9.3.1")
implementation("com.gradleup.shadow:shadow-gradle-plugin:9.6.1")
implementation("org.ow2.asm", "asm", "9.9")
implementation("org.ow2.asm", "asm-tree", "9.9")
implementation("com.dfsek.tectonic", "common", "4.4.0")
implementation("org.yaml", "snakeyaml", "2.5")
implementation("org.ow2.asm:asm:9.11.1")
implementation("org.ow2.asm:asm-tree:9.11.1")
implementation("com.dfsek.tectonic:common:4.4.0")
implementation("org.yaml:snakeyaml:2.7")
}
+11 -13
View File
@@ -3,7 +3,7 @@ import java.io.File
import java.util.function.Predicate
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.kotlin.dsl.extra
import org.gradle.kotlin.dsl.named
import kotlin.streams.asStream
@@ -11,8 +11,13 @@ import kotlin.streams.asStream
* Configures a directory where addons will be put.
*/
fun Project.addonDir(dir: File, task: Task) {
val addonProjects = project(":common:addons").subprojects
val moveAddons = tasks.register("moveAddons" + task.name) {
dependsOn("compileAddons")
// Resolved here rather than in doLast: task actions can't reach into other projects.
val jars = addonProjects.map { addon ->
(if (addon.isBootstrapAddon()) "bootstrap/" else "") to addon.tasks.named<ShadowJar>("shadowJar").flatMap { it.archiveFile }
}
doLast {
dir.parentFile.mkdirs()
matchingAddons(dir) {
@@ -21,20 +26,13 @@ fun Project.addonDir(dir: File, task: Task) {
logger.info("Deleting old addon: " + it.absolutePath)
it.delete()
}
forSubProjects(":common:addons") {
val jar = tasks.named("shadowJar").get() as ShadowJar
val boot = if (extra.has("bootstrap") && extra.get("bootstrap") as Boolean) "bootstrap/" else ""
val target = File(dir, boot + jar.archiveFileName.get())
val base = "${jar.archiveBaseName.get()}-${version}"
logger.info("Copying addon ${jar.archiveFileName.get()} to ${target.absolutePath}. Base name: $base")
jar.archiveFile.orNull?.asFile?.copyTo(target)
jars.forEach { (subdirectory, jar) ->
val file = jar.get().asFile
val target = File(dir, subdirectory + file.name)
logger.info("Copying addon ${file.name} to ${target.absolutePath}")
file.copyTo(target)
}
}
}
task.dependsOn(moveAddons)
@@ -35,18 +35,16 @@ fun Project.configureCompilation() {
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
doFirst {
options.compilerArgs.add("-Xlint:all")
}
options.compilerArgs.add("-Xlint:all")
}
// Gradle doesn't fingerprint filter arguments; the tokens are declared as inputs.
val metadataTokens = mapOf(
"DESCRIPTION" to properties["terra.description"],
"WIKI" to properties["terra.wiki"],
"SOURCE" to properties["terra.source"],
"ISSUES" to properties["terra.issues"],
"LICENSE" to properties["terra.license"]
"DESCRIPTION" to findProperty("terra.description"),
"WIKI" to findProperty("terra.wiki"),
"SOURCE" to findProperty("terra.source"),
"ISSUES" to findProperty("terra.issues"),
"LICENSE" to findProperty("terra.license")
)
tasks.withType<ProcessResources> {
include("**/*.*")
+12 -17
View File
@@ -1,28 +1,23 @@
import org.gradle.api.Project
import org.gradle.kotlin.dsl.creating
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.getValue
import org.gradle.kotlin.dsl.getting
import org.gradle.kotlin.dsl.maven
import org.gradle.kotlin.dsl.repositories
fun Project.configureDependencies() {
val testImplementation by configurations.getting
val compileOnly by configurations.getting
val testImplementation = configurations.getByName("testImplementation")
val compileOnly = configurations.getByName("compileOnly")
val api by configurations.getting
val implementation by configurations.getting
val api = configurations.getByName("api")
val implementation = configurations.getByName("implementation")
val shaded by configurations.creating
val shaded = configurations.create("shaded")
@Suppress("UNUSED_VARIABLE")
val shadedApi by configurations.creating {
configurations.create("shadedApi") {
shaded.extendsFrom(this)
api.extendsFrom(this)
}
@Suppress("UNUSED_VARIABLE")
val shadedImplementation by configurations.creating {
configurations.create("shadedImplementation") {
shaded.extendsFrom(this)
implementation.extendsFrom(this)
}
@@ -72,11 +67,11 @@ fun Project.configureDependencies() {
}
dependencies {
testImplementation("org.junit.jupiter", "junit-jupiter", Versions.Libraries.Internal.junit)
"testRuntimeOnly"("org.junit.platform", "junit-platform-launcher")
compileOnly("org.jetbrains", "annotations", Versions.Libraries.Internal.jetBrainsAnnotations)
testImplementation("org.junit.jupiter:junit-jupiter:${Versions.Libraries.Internal.junit}")
"testRuntimeOnly"("org.junit.platform:junit-platform-launcher")
compileOnly("org.jetbrains:annotations:${Versions.Libraries.Internal.jetBrainsAnnotations}")
compileOnly("com.google.guava", "guava", Versions.Libraries.Internal.guava)
testImplementation("com.google.guava", "guava", Versions.Libraries.Internal.guava)
compileOnly("com.google.guava:guava:${Versions.Libraries.Internal.guava}")
testImplementation("com.google.guava:guava:${Versions.Libraries.Internal.guava}")
}
}
+168 -155
View File
@@ -1,44 +1,36 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import java.io.File
import java.io.FileWriter
import java.net.URL
import java.nio.file.FileSystems
import java.nio.file.Path
import java.net.URI
import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse
import java.time.Duration
import org.gradle.api.DefaultTask
import org.gradle.api.Project
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.plugins.BasePluginExtension
import org.gradle.api.provider.ListProperty
import org.gradle.api.provider.MapProperty
import org.gradle.api.provider.Property
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputDirectory
import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.PathSensitive
import org.gradle.api.tasks.PathSensitivity
import org.gradle.api.tasks.SourceSetContainer
import org.gradle.api.tasks.TaskAction
import org.gradle.api.tasks.TaskProvider
import org.gradle.api.tasks.bundling.AbstractArchiveTask
import org.gradle.jvm.tasks.Jar
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.extra
import org.gradle.kotlin.dsl.get
import org.gradle.kotlin.dsl.named
import org.gradle.kotlin.dsl.register
import org.yaml.snakeyaml.DumperOptions
import org.yaml.snakeyaml.Yaml
import kotlin.io.path.copyTo
import kotlin.io.path.createDirectories
import kotlin.io.path.createFile
import kotlin.io.path.exists
private fun Project.installAddonsInto(dest: Path) {
FileSystems.newFileSystem(dest, mapOf("create" to "false"), null).use { fs ->
forSubProjects(":common:addons") {
val jar = getJarTask()
logger.info("Packaging addon ${jar.archiveFileName.get()} to $dest. size: ${jar.archiveFile.get().asFile.length() / 1024}KB")
val boot = if (extra.has("bootstrap") && extra.get("bootstrap") as Boolean) "bootstrap/" else ""
val addonPath = fs.getPath("/addons/$boot${jar.archiveFileName.get()}")
if (!addonPath.exists()) {
addonPath.parent.createDirectories()
addonPath.createFile()
jar.archiveFile.get().asFile.toPath().copyTo(addonPath, overwrite = true)
}
}
}
}
fun Project.configureDistribution() {
apply(plugin = "com.gradleup.shadow")
@@ -52,150 +44,171 @@ fun Project.configureDistribution() {
))
}
}
val downloadDefaultPacks = tasks.create("downloadDefaultPacks") {
val addonProjects = project(":common:addons").subprojects
tasks.register("compileAddons") {
dependsOn(addonProjects.map { "${it.path}:shadowJar" })
}
val generateResources = tasks.register<GenerateTerraResources>("generateTerraResources") {
group = "terra"
doFirst {
try {
file("${buildDir}/resources/main/packs/").deleteRecursively()
file("${buildDir}/resources/main/metapacks/").deleteRecursively()
val overworldPackUrl =
URL("https://github.com/PolyhedralDev/TerraOverworldConfig/releases/download/" + Versions.Terra.overworldConfig + "/Overworld.zip")
val reimagENDPackUrl =
URL("https://github.com/PolyhedralDev/ReimagEND/releases/download/" + Versions.Terra.reimagENDConfig + "/ReimagEND.zip")
val tartarusPackUrl =
URL("https://github.com/PolyhedralDev/Tartarus/releases/download/" + Versions.Terra.tartarusConfig + "/Tartarus.zip")
val defaultPackUrl =
URL("https://github.com/PolyhedralDev/DefaultMetapack/releases/download/" + Versions.Terra.defaultConfig + "/default.zip")
downloadPack(overworldPackUrl, project)
downloadPack(reimagENDPackUrl, project)
downloadPack(tartarusPackUrl, project)
downloadPack(defaultPackUrl, project, true)
} catch (_: Exception) {
defaultPacks.set(defaultPacksTask().flatMap { it.outputDir })
outputDir.set(layout.buildDirectory.dir("generated/terra-resources"))
}
configure<SourceSetContainer> {
named("main") {
output.dir(mapOf("builtBy" to generateResources), generateResources.flatMap { it.outputDir })
}
}
gradle.projectsEvaluated {
generateResources.configure {
addonProjects.forEach { addon ->
val name = addon.tasks.named<ShadowJar>("shadowJar").get().archiveFileName.get()
(if (addon.isBootstrapAddon()) bootstrapAddons else addons).add(name)
}
}
}
val compileAddons = tasks.create("compileAddons") {
forSubProjects(":common:addons") {
afterEvaluate {
dependsOn(getJarTask())
}
}
}
val installAddons = tasks.create("installAddons") {
group = "terra"
dependsOn(compileAddons)
doLast {
// https://github.com/johnrengelman/shadow/issues/111
val dest = tasks.named<ShadowJar>("shadowJar").get().archiveFile.get().asFile.toPath()
installAddonsInto(dest)
}
}
tasks.create("installAddonsIntoDefaultJar") {
group = "terra"
dependsOn(compileAddons)
doLast {
val dest = tasks.named<Jar>("jar").get().archiveFile.get().asFile.toPath()
installAddonsInto(dest)
}
}
val generateResourceManifest = tasks.create("generateResourceManifest") {
group = "terra"
doLast {
val resources = HashMap<String, MutableList<String>>()
val packsDir = File("${project.buildDir}/resources/main/packs/")
packsDir.walkTopDown().forEach {
if (it.isDirectory || !it.name.endsWith(".zip")) return@forEach
resources.computeIfAbsent("packs") { ArrayList() }.add(it.name)
}
val metaPacksDir = File("${project.buildDir}/resources/main/metapacks/")
metaPacksDir.walkTopDown().forEach {
if (it.isDirectory || !it.name.endsWith(".zip")) return@forEach
resources.computeIfAbsent("metapacks") { ArrayList() }.add(it.name)
}
val langDir = File("${project(":common:implementation").buildDir}/resources/main/lang/")
langDir.walkTopDown().forEach {
if (it.isDirectory || !it.name.endsWith(".yml")) return@forEach
resources.computeIfAbsent("lang") { ArrayList() }.add(it.name)
}
forSubProjects(":common:addons") {
val jar = getJarTask().archiveFileName.get()
resources.computeIfAbsent(
if (extra.has("bootstrap") && extra.get("bootstrap") as Boolean) "addons/bootstrap"
else "addons"
) { ArrayList() }.add(jar)
}
val options = DumperOptions()
options.indent = 2
options.indentWithIndicator = true
options.indicatorIndent = 2
options.isPrettyFlow = true
options.defaultFlowStyle = DumperOptions.FlowStyle.BLOCK
options.defaultScalarStyle = DumperOptions.ScalarStyle.DOUBLE_QUOTED
val yaml = Yaml(options)
val manifest = File("${project.buildDir}/resources/main/resources.yml")
if (manifest.exists()) manifest.delete()
manifest.parentFile.mkdirs()
manifest.createNewFile()
FileWriter(manifest).use {
yaml.dump(resources, it)
}
}
}
tasks.named("processResources") {
generateResourceManifest.mustRunAfter(downloadDefaultPacks)
finalizedBy(downloadDefaultPacks)
finalizedBy(generateResourceManifest)
}
bundleAddons(tasks.named<ShadowJar>("shadowJar"))
tasks.named<ShadowJar>("shadowJar") {
// Tell shadow to download the packs
dependsOn(downloadDefaultPacks)
configurations.set(listOf(project.configurations["shaded"]))
configurations.set(listOf(project.configurations.getByName("shaded")))
archiveClassifier.set("shaded")
version = project.version
relocate("org.apache.commons", "com.dfsek.terra.lib.commons")
relocate("org.objectweb.asm", "com.dfsek.terra.lib.asm")
relocate("org.json", "com.dfsek.terra.lib.json")
relocate("org.yaml", "com.dfsek.terra.lib.yaml")
finalizedBy(installAddons)
}
configure<BasePluginExtension> {
archivesName.set(project.name)
}
tasks.named<DefaultTask>("build") {
dependsOn(tasks["shadowJar"])
tasks.named("build") {
dependsOn("shadowJar")
}
}
fun downloadPack(packUrl: URL, project: Project, metapack: Boolean = false) {
val fileName = packUrl.file.substring(packUrl.file.lastIndexOf("/"))
val resourceType = if (metapack) "metapacks" else "packs"
val file = File("${project.buildDir}/resources/main/${resourceType}/${fileName}")
file.parentFile.mkdirs()
file.outputStream().write(packUrl.readBytes())
fun Project.bundleAddons(archive: TaskProvider<out AbstractArchiveTask>) {
val addonProjects = project(":common:addons").subprojects
gradle.projectsEvaluated {
archive.configure {
addonProjects.forEach { addon ->
from(addon.tasks.named("shadowJar")) {
into(if (addon.isBootstrapAddon()) "addons/bootstrap" else "addons")
}
}
}
}
}
fun Project.getJarTask() = tasks.named("shadowJar").get() as ShadowJar
internal fun Project.isBootstrapAddon() = extra.has("bootstrap") && extra.get("bootstrap") as Boolean
private fun Project.defaultPacksTask(): TaskProvider<DownloadDefaultPacks> {
val root = rootProject
if ("downloadDefaultPacks" in root.tasks.names) return root.tasks.named<DownloadDefaultPacks>("downloadDefaultPacks")
return root.tasks.register<DownloadDefaultPacks>("downloadDefaultPacks") {
group = "terra"
fun release(repo: String, tag: String, file: String) =
"https://github.com/PolyhedralDev/$repo/releases/download/$tag/$file"
packs.put("packs/Overworld.zip", release("TerraOverworldConfig", Versions.Terra.overworldConfig, "Overworld.zip"))
packs.put("packs/ReimagEND.zip", release("ReimagEND", Versions.Terra.reimagENDConfig, "ReimagEND.zip"))
packs.put("packs/Tartarus.zip", release("Tartarus", Versions.Terra.tartarusConfig, "Tartarus.zip"))
packs.put("metapacks/default.zip", release("DefaultMetapack", Versions.Terra.defaultConfig, "default.zip"))
offline.set(root.gradle.startParameter.isOffline)
outputDir.set(root.layout.buildDirectory.dir("default-packs"))
}
}
abstract class DownloadDefaultPacks : DefaultTask() {
@get:Input
abstract val packs: MapProperty<String, String>
@get:Internal
abstract val offline: Property<Boolean>
@get:OutputDirectory
abstract val outputDir: DirectoryProperty
init {
outputs.upToDateWhen { packs.get().values.none { "/latest/" in it } }
}
@TaskAction
fun download() {
val out = outputDir.get().asFile
if (offline.get()) {
logger.warn("Offline: using the default packs from the last build in $out")
return
}
val client = HttpClient.newBuilder()
.followRedirects(HttpClient.Redirect.NORMAL)
.connectTimeout(Duration.ofSeconds(20))
.build()
val responses = packs.get().mapValues { (_, url) ->
client.sendAsync(HttpRequest.newBuilder(URI(url)).timeout(Duration.ofMinutes(2)).build(),
HttpResponse.BodyHandlers.ofByteArray())
}
responses.forEach { (path, response) ->
val file = File(out, path)
val body = try {
response.join().takeIf { it.statusCode() == 200 }?.body()
} catch (e: Exception) {
null
}
when {
body != null -> if (!file.exists() || !file.readBytes().contentEquals(body)) {
file.parentFile.mkdirs()
file.writeBytes(body)
}
file.exists() -> logger.warn("Could not download ${packs.get()[path]}; using the copy from the last build")
else -> logger.warn("Could not download ${packs.get()[path]}; jars will not include $path")
}
}
}
}
abstract class GenerateTerraResources : DefaultTask() {
@get:InputDirectory
@get:PathSensitive(PathSensitivity.RELATIVE)
abstract val defaultPacks: DirectoryProperty
@get:Input
abstract val addons: ListProperty<String>
@get:Input
abstract val bootstrapAddons: ListProperty<String>
@get:OutputDirectory
abstract val outputDir: DirectoryProperty
@TaskAction
fun generate() {
val out = outputDir.get().asFile
out.deleteRecursively()
defaultPacks.get().asFile.copyRecursively(out)
val resources = LinkedHashMap<String, List<String>>()
fun put(key: String, entries: List<String>) {
if (entries.isNotEmpty()) resources[key] = entries
}
fun zips(dir: String) = File(out, dir).listFiles { file -> file.name.endsWith(".zip") }?.map { it.name }?.sorted().orEmpty()
put("addons/bootstrap", bootstrapAddons.get())
put("addons", addons.get())
put("packs", zips("packs"))
put("metapacks", zips("metapacks"))
val options = DumperOptions()
options.indent = 2
options.indentWithIndicator = true
options.indicatorIndent = 2
options.isPrettyFlow = true
options.defaultFlowStyle = DumperOptions.FlowStyle.BLOCK
options.defaultScalarStyle = DumperOptions.ScalarStyle.DOUBLE_QUOTED
File(out, "resources.yml").writer().use { Yaml(options).dump(resources, it) }
}
}
+5 -5
View File
@@ -26,13 +26,13 @@ fun Project.configurePublishing() {
//val mavenSnapshotUrl = "https://repo.codemc.io/repository/maven-snapshots/"
maven(mavenUrl) {
val SoloStudiosReleasesUsername: String? by project
val SoloStudiosReleasesPassword: String? by project
val releasesUsername = findProperty("SoloStudiosReleasesUsername") as String?
val releasesPassword = findProperty("SoloStudiosReleasesPassword") as String?
if (SoloStudiosReleasesUsername != null && SoloStudiosReleasesPassword != null) {
if (releasesUsername != null && releasesPassword != null) {
credentials {
username = SoloStudiosReleasesUsername
password = SoloStudiosReleasesPassword
username = releasesUsername
password = releasesPassword
}
}
}
+15 -15
View File
@@ -14,25 +14,25 @@ object Versions {
const val cloud = "2.1.0"
const val caffeine = "3.2.2"
const val caffeine = "3.3.1"
const val slf4j = "2.0.17"
const val slf4j = "2.0.20"
object Internal {
const val shadow = "9.3.1"
const val apacheText = "1.14.0"
const val apacheIO = "2.20.0"
const val guava = "33.5.0-jre"
const val asm = "9.9"
const val snakeYml = "2.5"
const val jetBrainsAnnotations = "26.0.2-1"
const val junit = "6.0.0"
const val shadow = "9.6.1"
const val apacheText = "1.15.0"
const val apacheIO = "2.22.0"
const val guava = "33.8.0-jre"
const val asm = "9.11.1"
const val snakeYml = "2.7"
const val jetBrainsAnnotations = "26.1.0"
const val junit = "6.1.3"
const val nbt = "6.1"
}
}
object Fabric {
const val fabricAPI = "0.165.2+${Mod.minecraft}"
const val fabricAPI = "0.166.0+${Mod.minecraft}"
const val cloud = "2.1.0"
}
//
@@ -60,12 +60,12 @@ object Versions {
object Bukkit {
const val minecraft = "26.3"
const val paperBuild = "$minecraft.build.244-stable"
const val paperBuild = "$minecraft.build.246-stable"
const val paper = paperBuild
const val runPaper = "3.0.2"
const val runPaper = "3.1.0"
const val wyck = "4.0.0-0f573ad7"
const val cloud = "2.0.1"
const val multiverse = "5.3.0"
const val multiverse = "5.8.2"
}
//
@@ -76,7 +76,7 @@ object Versions {
// }
//
object CLI {
const val logback = "1.5.19"
const val logback = "1.6.6"
const val picocli = "4.7.7"
}
@@ -7,7 +7,13 @@ import java.io.File
import java.io.FileInputStream
import java.io.InputStream
import org.gradle.api.DefaultTask
import org.gradle.api.plugins.JavaPluginExtension
import org.gradle.api.file.Directory
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.provider.ListProperty
import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.PathSensitive
import org.gradle.api.tasks.PathSensitivity
import org.gradle.api.tasks.TaskAction
import org.objectweb.asm.ClassReader
import org.objectweb.asm.tree.ClassNode
@@ -15,11 +21,18 @@ import org.objectweb.asm.tree.FieldNode
abstract class GenerateDocsTask : DefaultTask() {
@get:InputFiles
@get:PathSensitive(PathSensitivity.RELATIVE)
abstract val classDirectories: ListProperty<Directory>
@get:OutputDirectory
abstract val docsDirectory: DirectoryProperty
@TaskAction
fun generateDocs() {
project.extensions.getByType(JavaPluginExtension::class.java).sourceSets.forEach { sources ->
classDirectories.get().forEach { classesDirectory ->
val classes = HashMap<String, ClassNode>()
sources.java.classesDirectory.get().asFileTree.forEach { file ->
classesDirectory.asFileTree.forEach { file ->
if (file.name.endsWith(".class")) {
val node = createClassNode(FileInputStream(file))
if (node.fields.stream().anyMatch { field ->
@@ -27,10 +40,7 @@ abstract class GenerateDocsTask : DefaultTask() {
it.desc.equals(descriptor(Value::class.java.canonicalName))
} == true
}) {
var name = sources
.java
.classesDirectory
.get()
var name = classesDirectory
.asFile
.toPath()
.relativize(file.toPath())
@@ -44,7 +54,7 @@ abstract class GenerateDocsTask : DefaultTask() {
}
}
val docsDir = File(project.buildDir, "tectonic")
val docsDir = docsDirectory.get().asFile
docsDir.mkdirs()
classes.forEach { (name, clazz) ->
@@ -2,9 +2,15 @@ package com.dfsek.terra.tectonicdoc
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.plugins.JavaPluginExtension
class TectonicDocPlugin : Plugin<Project> {
override fun apply(project: Project) {
project.tasks.create("generateDocs", GenerateDocsTask::class.java)
project.tasks.register("generateDocs", GenerateDocsTask::class.java) {
project.extensions.getByType(JavaPluginExtension::class.java).sourceSets.configureEach {
classDirectories.add(java.classesDirectory)
}
docsDirectory.set(project.layout.buildDirectory.dir("tectonic"))
}
}
}
}
@@ -6,5 +6,5 @@ dependencies {
testImplementation(project(":common:implementation:base"))
testImplementation(project(":common:addons:minecraft-attributes"))
testImplementation(project(":common:addons:manifest-addon-loader"))
testImplementation("com.dfsek", "paralithic", Versions.Libraries.paralithic)
testImplementation("com.dfsek:paralithic:${Versions.Libraries.paralithic}")
}
+1 -1
View File
@@ -3,5 +3,5 @@ version = version("1.0.0")
dependencies {
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
testImplementation("com.dfsek.tectonic", "common", Versions.Libraries.tectonic)
testImplementation("com.dfsek.tectonic:common:${Versions.Libraries.tectonic}")
}
@@ -2,5 +2,5 @@ version = version("1.2.0")
dependencies {
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
api("com.dfsek", "paralithic", Versions.Libraries.paralithic)
api("com.dfsek:paralithic:${Versions.Libraries.paralithic}")
}
@@ -2,5 +2,5 @@ version = version("1.0.0")
dependencies {
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
api("com.dfsek", "paralithic", Versions.Libraries.paralithic)
api("com.dfsek:paralithic:${Versions.Libraries.paralithic}")
}
@@ -1,8 +1,8 @@
version = version("1.0.0")
dependencies {
api("commons-io", "commons-io", Versions.Libraries.Internal.apacheIO)
implementation("com.dfsek.tectonic", "yaml", Versions.Libraries.tectonic)
api("commons-io:commons-io:${Versions.Libraries.Internal.apacheIO}")
implementation("com.dfsek.tectonic:yaml:${Versions.Libraries.tectonic}")
}
tasks.withType<Jar> {
@@ -1,7 +1,7 @@
version = version("1.0.0")
dependencies {
api("commons-io", "commons-io", Versions.Libraries.Internal.apacheIO)
api("com.github.Querz", "NBT", Versions.Libraries.Internal.nbt)
api("commons-io:commons-io:${Versions.Libraries.Internal.apacheIO}")
api("com.github.Querz:NBT:${Versions.Libraries.Internal.nbt}")
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
}
@@ -1,6 +1,6 @@
version = version("1.2.0")
dependencies {
api("commons-io", "commons-io", Versions.Libraries.Internal.apacheIO)
api("commons-io:commons-io:${Versions.Libraries.Internal.apacheIO}")
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
}
+8 -8
View File
@@ -1,16 +1,16 @@
dependencies {
compileOnlyApi("org.slf4j", "slf4j-api", Versions.Libraries.slf4j)
testImplementation("org.slf4j", "slf4j-api", Versions.Libraries.slf4j)
compileOnlyApi("org.slf4j:slf4j-api:${Versions.Libraries.slf4j}")
testImplementation("org.slf4j:slf4j-api:${Versions.Libraries.slf4j}")
api("org.incendo", "cloud-core", Versions.Libraries.cloud)
api("org.incendo:cloud-core:${Versions.Libraries.cloud}")
api("com.github.ben-manes.caffeine", "caffeine", Versions.Libraries.caffeine)
api("com.github.ben-manes.caffeine:caffeine:${Versions.Libraries.caffeine}")
api("com.dfsek.tectonic", "common", Versions.Libraries.tectonic)
api("ca.solo-studios", "strata", Versions.Libraries.strata)
api("com.dfsek", "paralithic", Versions.Libraries.paralithic)
api("com.dfsek", "seismic", Versions.Libraries.seismic)
api("com.dfsek.tectonic:common:${Versions.Libraries.tectonic}")
api("ca.solo-studios:strata:${Versions.Libraries.strata}")
api("com.dfsek:paralithic:${Versions.Libraries.paralithic}")
api("com.dfsek:seismic:${Versions.Libraries.seismic}")
}
+5 -5
View File
@@ -2,14 +2,14 @@ dependencies {
api(project(":common:api"))
api(project(":common:implementation:bootstrap-addon-loader"))
testImplementation("org.slf4j", "slf4j-api", Versions.Libraries.slf4j)
testImplementation("org.slf4j:slf4j-api:${Versions.Libraries.slf4j}")
implementation("commons-io", "commons-io", Versions.Libraries.Internal.apacheIO)
implementation("commons-io:commons-io:${Versions.Libraries.Internal.apacheIO}")
implementation("org.apache.commons", "commons-text", Versions.Libraries.Internal.apacheText)
implementation("com.dfsek.tectonic", "yaml", Versions.Libraries.tectonic)
implementation("org.apache.commons:commons-text:${Versions.Libraries.Internal.apacheText}")
implementation("com.dfsek.tectonic:yaml:${Versions.Libraries.tectonic}")
implementation("com.dfsek", "paralithic", Versions.Libraries.paralithic)
implementation("com.dfsek:paralithic:${Versions.Libraries.paralithic}")
}
+3
View File
@@ -7,4 +7,7 @@ terra.license=MIT
# Gradle options
org.gradle.jvmargs=-Xmx4096M -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.warning.mode=all
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.tooling.parallel=true
Binary file not shown.
+4 -2
View File
@@ -1,8 +1,10 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=553c78f50dafcd54d65b9a444649057857469edf836431389695608536d6b746
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.0-bin.zip
distributionSha256Sum=0b00b0ffe07c4d4789c12d4935a44a7057d55774b7540bd4a3f76f336deb177a
distributionUrl=https\://services.gradle.org/distributions/gradle-9.9.0-bin.zip
networkTimeout=10000
retries=0
retryBackOffMs=500
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored
+4 -7
View File
@@ -1,7 +1,7 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
# Copyright © 2015 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -20,7 +20,7 @@
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
# gradlew start up script for POSIX generated by Gradle.
#
# Important for running:
#
@@ -29,7 +29,7 @@
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
# ksh gradlew
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
@@ -57,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -114,7 +114,6 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH="\\\"\\\""
# Determine the Java command to use to start the JVM.
@@ -172,7 +171,6 @@ fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
@@ -212,7 +210,6 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
Vendored
+52 -34
View File
@@ -19,12 +19,39 @@
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem gradlew startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Set local scope for the variables, and ensure extensions are enabled
setlocal EnableExtensions
@rem Catch executions from older scripts and ensure they exit cleanly.
@rem This can be removed once we can be reasonably confident that few people
@rem will be migrating directly to this new wrapper.
goto afterSafetyNet
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
goto exitWithErrorLevel
:afterSafetyNet
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@@ -45,13 +72,14 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
1>&2 echo.
1>&2 echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
1>&2 echo.
1>&2 echo Please set the JAVA_HOME variable in your environment to match the
1>&2 echo location of your Java installation.
goto fail
"%COMSPEC%" /c exit 1
goto exitWithErrorLevel
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
@@ -59,36 +87,26 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
1>&2 echo.
1>&2 echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
1>&2 echo.
1>&2 echo Please set the JAVA_HOME variable in your environment to match the
1>&2 echo location of your Java installation.
goto fail
"%COMSPEC%" /c exit 1
goto exitWithErrorLevel
:execute
@rem Setup the command line
set CLASSPATH=
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
@rem Execute gradlew
@rem endlocal doesn't take effect until after the line is parsed and variables are expanded
@rem which allows us to clear the local environment before executing the java command
endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel & goto exitWithErrorLevel
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
@rem This label must not be changed. We rely on old scripts being able to jump to this point.
:exitWithErrorLevel
@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts
"%COMSPEC%" /c exit %ERRORLEVEL%
+8 -8
View File
@@ -11,26 +11,26 @@ repositories {
}
}
val geyserMappings: Configuration by configurations.register("geyserMappings") {
val geyserMappings = configurations.register("geyserMappings") {
isCanBeConsumed = false
}
val mcmeta: Configuration by configurations.register("mcmeta") {
val mcmeta = configurations.register("mcmeta") {
isCanBeConsumed = false
}
dependencies {
shadedApi(project(":common:implementation:base"))
implementation("com.google.code.gson", "gson", Versions.Allay.gson)
implementation("com.google.code.gson:gson:${Versions.Allay.gson}")
compileOnly("org.allaymc.allay", "api", Versions.Allay.api)
compileOnly("org.allaymc.allay:api:${Versions.Allay.api}")
geyserMappings("GeyserMC.mappings", "items", Versions.Allay.mappings, ext = "json")
geyserMappings("GeyserMC.mappings", "biomes", Versions.Allay.mappings, ext = "json")
geyserMappings("GeyserMC.mappings-generator", "generator_blocks", Versions.Allay.mappingsGenerator, ext = "json")
geyserMappings("GeyserMC.mappings:items:${Versions.Allay.mappings}@json")
geyserMappings("GeyserMC.mappings:biomes:${Versions.Allay.mappings}@json")
geyserMappings("GeyserMC.mappings-generator:generator_blocks:${Versions.Allay.mappingsGenerator}@json")
mcmeta("misode.mcmeta", "blocks/data", Versions.Allay.mcmeta, ext = "json")
mcmeta("misode.mcmeta:blocks/data:${Versions.Allay.mcmeta}@json")
}
tasks.processResources {
+7 -7
View File
@@ -27,18 +27,18 @@ dependencies {
implementation(project(":platforms:minecraft-common")) { isTransitive = false }
shaded(project(":platforms:minecraft-common")) { isTransitive = false }
compileOnly("io.papermc.paper", "paper-api", Versions.Bukkit.paper)
compileOnly("io.papermc.paper:paper-api:${Versions.Bukkit.paper}")
compileOnly("com.dfsek.wyck", "Wyck", Versions.Bukkit.wyck)
compileOnly("com.dfsek.wyck:Wyck:${Versions.Bukkit.wyck}")
compileOnly("org.mvplugins.multiverse.core", "multiverse-core", Versions.Bukkit.multiverse)
compileOnly("org.mvplugins.multiverse.core:multiverse-core:${Versions.Bukkit.multiverse}")
shadedApi("com.google.guava", "guava", Versions.Libraries.Internal.guava)
shadedApi("com.google.guava:guava:${Versions.Libraries.Internal.guava}")
shadedApi("org.incendo", "cloud-paper", Versions.Bukkit.cloud)
shadedApi("org.incendo:cloud-paper:${Versions.Bukkit.cloud}")
testImplementation(testFixtures(project(":platforms:minecraft-common")))
testImplementation(project(":common:addons:minecraft-attributes"))
testImplementation("io.papermc.paper", "paper-api", Versions.Bukkit.paper)
testImplementation("com.dfsek.wyck", "Wyck", Versions.Bukkit.wyck)
testImplementation("io.papermc.paper:paper-api:${Versions.Bukkit.paper}")
testImplementation("com.dfsek.wyck:Wyck:${Versions.Bukkit.wyck}")
}
+9 -10
View File
@@ -7,15 +7,15 @@ val javaMainClass = "com.dfsek.terra.cli.TerraCLI"
dependencies {
shadedApi(project(":common:implementation:base"))
shadedApi("commons-io", "commons-io", Versions.Libraries.Internal.apacheIO)
shadedApi("com.github.Querz", "NBT", Versions.Libraries.Internal.nbt)
shadedApi("commons-io:commons-io:${Versions.Libraries.Internal.apacheIO}")
shadedApi("com.github.Querz:NBT:${Versions.Libraries.Internal.nbt}")
shadedImplementation("info.picocli", "picocli", Versions.CLI.picocli)
annotationProcessor("info.picocli", "picocli-codegen", Versions.CLI.picocli)
shadedImplementation("info.picocli:picocli:${Versions.CLI.picocli}")
annotationProcessor("info.picocli:picocli-codegen:${Versions.CLI.picocli}")
shadedImplementation("com.google.guava", "guava", Versions.Libraries.Internal.guava)
shadedImplementation("com.google.guava:guava:${Versions.Libraries.Internal.guava}")
shadedImplementation("ch.qos.logback", "logback-classic", Versions.CLI.logback)
shadedImplementation("ch.qos.logback:logback-classic:${Versions.CLI.logback}")
// Addon class loaders find minecraft-attributes on the test class path first; its entrypoint needs the manifest addon API.
testImplementation(project(":common:addons:minecraft-attributes"))
@@ -32,9 +32,7 @@ tasks.withType<Jar> {
}
tasks.withType<JavaCompile> {
doFirst {
options.compilerArgs.add("-Aproject=${project.group}/${project.name}")
}
options.compilerArgs.add("-Aproject=${project.group}/${project.name}")
}
application {
@@ -43,9 +41,10 @@ application {
tasks.getByName("run").setProperty("workingDir", file("./run"))
// CLIPlatform uses "./" as its data folder.
// CLIPlatform uses "./" as its data folder. Terra initializes once per JVM, and each test class starts its own platform.
tasks.withType<Test> {
workingDir = file("./run").also { it.mkdirs() }
forkEvery = 1
}
tasks.withType<Test> { dependsOn("moveAddonsrun") }
+3 -3
View File
@@ -28,12 +28,12 @@ dependencies {
implementation("net.fabricmc:fabric-loader:${Versions.Mod.fabricLoader}")
implementation("org.incendo", "cloud-fabric", Versions.Fabric.cloud) {
implementation("org.incendo:cloud-fabric:${Versions.Fabric.cloud}") {
exclude("me.lucko", "fabric-permissions-api")
}
include("org.incendo", "cloud-fabric", Versions.Fabric.cloud)
include("org.incendo:cloud-fabric:${Versions.Fabric.cloud}")
runtimeOnly("net.fabricmc.fabric-api", "fabric-api", Versions.Fabric.fabricAPI)
runtimeOnly("net.fabricmc.fabric-api:fabric-api:${Versions.Fabric.fabricAPI}")
}
loom {
+9 -20
View File
@@ -6,32 +6,21 @@ dependencies {
api(project(":common:implementation:base"))
}
val taskSet = HashSet<AbstractArchiveTask>()
val resourcesDir = File("${project.buildDir}/resources/main/")
val dump = tasks.create("dumpDependents") {
doFirst {
taskSet.forEach {
val resource = File(resourcesDir, it.archiveFileName.get())
logger.info("Including archive " + it.archiveFileName.orNull + " in directory " + resource.absolutePath)
it.archiveFile.get().asFile.copyTo(resource, true)
}
}
val dump = tasks.register<Sync>("dumpDependents") {
into(layout.buildDirectory.dir("generated/platform-jars"))
}
tasks["processResources"].dependsOn(dump)
sourceSets.main {
output.dir(mapOf("builtBy" to dump), dump.map { it.destinationDir })
}
afterEvaluate {
project(":platforms").subprojects.forEach {
if (it == this@afterEvaluate) return@forEach
val taskName = platformOverrides.getOrDefault(it.name, "jar")
val task = it.tasks.named(taskName).get()
if (task !is AbstractArchiveTask) {
throw IllegalArgumentException("Task dependency must be Archive Task: " + task.name)
}
tasks["dumpDependents"].dependsOn(task)
taskSet.add(task)
logger.info("Merged JAR will incorporate task ${task.name} from platform ${it.name}.")
val task = it.tasks.named(taskName)
dump.configure { from(task) }
logger.info("Merged JAR will incorporate task $taskName from platform ${it.name}.")
}
}
}
+4 -6
View File
@@ -1,14 +1,12 @@
dependencies {
shadedApi(project(":common:implementation:base"))
shadedApi("com.github.ben-manes.caffeine", "caffeine", Versions.Libraries.caffeine)
shadedImplementation("com.google.guava", "guava", Versions.Libraries.Internal.guava)
shadedApi("com.github.ben-manes.caffeine:caffeine:${Versions.Libraries.caffeine}")
shadedImplementation("com.google.guava:guava:${Versions.Libraries.Internal.guava}")
compileOnly("net.minestom", "minestom", Versions.Minestom.minestom)
compileOnly("net.minestom:minestom:${Versions.Minestom.minestom}")
}
tasks.named("jar") {
finalizedBy("installAddonsIntoDefaultJar")
}
bundleAddons(tasks.jar)
tasks.withType<JavaCompile>().configureEach {
options.release = 25
+2 -2
View File
@@ -7,8 +7,8 @@ val javaMainClass = "com.dfsek.terra.minestom.TerraMinestomExample"
dependencies {
shadedApi(project(":platforms:minestom"))
implementation("net.minestom", "minestom", Versions.Minestom.minestom)
implementation("org.slf4j", "slf4j-simple", Versions.Libraries.slf4j)
implementation("net.minestom:minestom:${Versions.Minestom.minestom}")
implementation("org.slf4j:slf4j-simple:${Versions.Libraries.slf4j}")
}
tasks.withType<Jar> {
+1 -1
View File
@@ -14,7 +14,7 @@ dependencies {
minecraft("com.mojang:minecraft:${Versions.Mod.minecraft}")
implementation("org.incendo", "cloud-fabric", Versions.Fabric.cloud) {
implementation("org.incendo:cloud-fabric:${Versions.Fabric.cloud}") {
exclude("net.fabricmc")
exclude("net.fabricmc.fabric-api")
exclude("me.lucko", "fabric-permissions-api")