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
+371 -349

No files matched your search

+2 -6
View File
@@ -12,18 +12,14 @@ allprojects {
configureDependencies() configureDependencies()
configurePublishing() configurePublishing()
tasks.withType<JavaCompile>().configureEach {
options.isFork = true
options.isIncremental = true
}
tasks.withType<Test>().configureEach { tasks.withType<Test>().configureEach {
useJUnitPlatform() useJUnitPlatform()
maxHeapSize = "2G" maxHeapSize = "2G"
ignoreFailures = false ignoreFailures = false
failFast = true 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.html.required.set(false)
reports.junitXml.required.set(false) reports.junitXml.required.set(false)
+5 -5
View File
@@ -28,10 +28,10 @@ repositories {
dependencies { dependencies {
//TODO Allow pulling from Versions.kt //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:9.11.1")
implementation("org.ow2.asm", "asm-tree", "9.9") implementation("org.ow2.asm:asm-tree:9.11.1")
implementation("com.dfsek.tectonic", "common", "4.4.0") implementation("com.dfsek.tectonic:common:4.4.0")
implementation("org.yaml", "snakeyaml", "2.5") implementation("org.yaml:snakeyaml:2.7")
} }
+11 -13
View File
@@ -3,7 +3,7 @@ import java.io.File
import java.util.function.Predicate import java.util.function.Predicate
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.api.Task import org.gradle.api.Task
import org.gradle.kotlin.dsl.extra import org.gradle.kotlin.dsl.named
import kotlin.streams.asStream import kotlin.streams.asStream
@@ -11,8 +11,13 @@ import kotlin.streams.asStream
* Configures a directory where addons will be put. * Configures a directory where addons will be put.
*/ */
fun Project.addonDir(dir: File, task: Task) { fun Project.addonDir(dir: File, task: Task) {
val addonProjects = project(":common:addons").subprojects
val moveAddons = tasks.register("moveAddons" + task.name) { val moveAddons = tasks.register("moveAddons" + task.name) {
dependsOn("compileAddons") 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 { doLast {
dir.parentFile.mkdirs() dir.parentFile.mkdirs()
matchingAddons(dir) { matchingAddons(dir) {
@@ -21,20 +26,13 @@ fun Project.addonDir(dir: File, task: Task) {
logger.info("Deleting old addon: " + it.absolutePath) logger.info("Deleting old addon: " + it.absolutePath)
it.delete() it.delete()
} }
forSubProjects(":common:addons") { jars.forEach { (subdirectory, jar) ->
val jar = tasks.named("shadowJar").get() as ShadowJar val file = jar.get().asFile
val target = File(dir, subdirectory + file.name)
val boot = if (extra.has("bootstrap") && extra.get("bootstrap") as Boolean) "bootstrap/" else "" logger.info("Copying addon ${file.name} to ${target.absolutePath}")
val target = File(dir, boot + jar.archiveFileName.get()) file.copyTo(target)
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)
} }
} }
} }
task.dependsOn(moveAddons) task.dependsOn(moveAddons)
@@ -35,18 +35,16 @@ fun Project.configureCompilation() {
tasks.withType<JavaCompile> { tasks.withType<JavaCompile> {
options.encoding = "UTF-8" 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. // Gradle doesn't fingerprint filter arguments; the tokens are declared as inputs.
val metadataTokens = mapOf( val metadataTokens = mapOf(
"DESCRIPTION" to properties["terra.description"], "DESCRIPTION" to findProperty("terra.description"),
"WIKI" to properties["terra.wiki"], "WIKI" to findProperty("terra.wiki"),
"SOURCE" to properties["terra.source"], "SOURCE" to findProperty("terra.source"),
"ISSUES" to properties["terra.issues"], "ISSUES" to findProperty("terra.issues"),
"LICENSE" to properties["terra.license"] "LICENSE" to findProperty("terra.license")
) )
tasks.withType<ProcessResources> { tasks.withType<ProcessResources> {
include("**/*.*") include("**/*.*")
+12 -17
View File
@@ -1,28 +1,23 @@
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.kotlin.dsl.creating
import org.gradle.kotlin.dsl.dependencies 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.maven
import org.gradle.kotlin.dsl.repositories import org.gradle.kotlin.dsl.repositories
fun Project.configureDependencies() { fun Project.configureDependencies() {
val testImplementation by configurations.getting val testImplementation = configurations.getByName("testImplementation")
val compileOnly by configurations.getting val compileOnly = configurations.getByName("compileOnly")
val api by configurations.getting val api = configurations.getByName("api")
val implementation by configurations.getting val implementation = configurations.getByName("implementation")
val shaded by configurations.creating val shaded = configurations.create("shaded")
@Suppress("UNUSED_VARIABLE") configurations.create("shadedApi") {
val shadedApi by configurations.creating {
shaded.extendsFrom(this) shaded.extendsFrom(this)
api.extendsFrom(this) api.extendsFrom(this)
} }
@Suppress("UNUSED_VARIABLE") configurations.create("shadedImplementation") {
val shadedImplementation by configurations.creating {
shaded.extendsFrom(this) shaded.extendsFrom(this)
implementation.extendsFrom(this) implementation.extendsFrom(this)
} }
@@ -72,11 +67,11 @@ fun Project.configureDependencies() {
} }
dependencies { dependencies {
testImplementation("org.junit.jupiter", "junit-jupiter", Versions.Libraries.Internal.junit) testImplementation("org.junit.jupiter:junit-jupiter:${Versions.Libraries.Internal.junit}")
"testRuntimeOnly"("org.junit.platform", "junit-platform-launcher") "testRuntimeOnly"("org.junit.platform:junit-platform-launcher")
compileOnly("org.jetbrains", "annotations", Versions.Libraries.Internal.jetBrainsAnnotations) compileOnly("org.jetbrains:annotations:${Versions.Libraries.Internal.jetBrainsAnnotations}")
compileOnly("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) testImplementation("com.google.guava:guava:${Versions.Libraries.Internal.guava}")
} }
} }
+163 -150
View File
@@ -1,44 +1,36 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import java.io.File import java.io.File
import java.io.FileWriter import java.net.URI
import java.net.URL import java.net.http.HttpClient
import java.nio.file.FileSystems import java.net.http.HttpRequest
import java.nio.file.Path import java.net.http.HttpResponse
import java.time.Duration
import org.gradle.api.DefaultTask import org.gradle.api.DefaultTask
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.plugins.BasePluginExtension 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.jvm.tasks.Jar
import org.gradle.kotlin.dsl.apply import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.configure import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.extra import org.gradle.kotlin.dsl.extra
import org.gradle.kotlin.dsl.get
import org.gradle.kotlin.dsl.named import org.gradle.kotlin.dsl.named
import org.gradle.kotlin.dsl.register
import org.yaml.snakeyaml.DumperOptions import org.yaml.snakeyaml.DumperOptions
import org.yaml.snakeyaml.Yaml 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() { fun Project.configureDistribution() {
apply(plugin = "com.gradleup.shadow") apply(plugin = "com.gradleup.shadow")
@@ -53,149 +45,170 @@ 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" group = "terra"
doFirst { defaultPacks.set(defaultPacksTask().flatMap { it.outputDir })
try { outputDir.set(layout.buildDirectory.dir("generated/terra-resources"))
file("${buildDir}/resources/main/packs/").deleteRecursively() }
file("${buildDir}/resources/main/metapacks/").deleteRecursively() configure<SourceSetContainer> {
val overworldPackUrl = named("main") {
URL("https://github.com/PolyhedralDev/TerraOverworldConfig/releases/download/" + Versions.Terra.overworldConfig + "/Overworld.zip") output.dir(mapOf("builtBy" to generateResources), generateResources.flatMap { it.outputDir })
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") gradle.projectsEvaluated {
val defaultPackUrl = generateResources.configure {
URL("https://github.com/PolyhedralDev/DefaultMetapack/releases/download/" + Versions.Terra.defaultConfig + "/default.zip") addonProjects.forEach { addon ->
downloadPack(overworldPackUrl, project) val name = addon.tasks.named<ShadowJar>("shadowJar").get().archiveFileName.get()
downloadPack(reimagENDPackUrl, project) (if (addon.isBootstrapAddon()) bootstrapAddons else addons).add(name)
downloadPack(tartarusPackUrl, project)
downloadPack(defaultPackUrl, project, true)
} catch (_: Exception) {
} }
} }
} }
val compileAddons = tasks.create("compileAddons") { bundleAddons(tasks.named<ShadowJar>("shadowJar"))
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)
}
tasks.named<ShadowJar>("shadowJar") { tasks.named<ShadowJar>("shadowJar") {
// Tell shadow to download the packs configurations.set(listOf(project.configurations.getByName("shaded")))
dependsOn(downloadDefaultPacks)
configurations.set(listOf(project.configurations["shaded"]))
archiveClassifier.set("shaded") archiveClassifier.set("shaded")
version = project.version version = project.version
relocate("org.apache.commons", "com.dfsek.terra.lib.commons") relocate("org.apache.commons", "com.dfsek.terra.lib.commons")
relocate("org.objectweb.asm", "com.dfsek.terra.lib.asm") relocate("org.objectweb.asm", "com.dfsek.terra.lib.asm")
relocate("org.json", "com.dfsek.terra.lib.json") relocate("org.json", "com.dfsek.terra.lib.json")
relocate("org.yaml", "com.dfsek.terra.lib.yaml") relocate("org.yaml", "com.dfsek.terra.lib.yaml")
finalizedBy(installAddons)
} }
configure<BasePluginExtension> { configure<BasePluginExtension> {
archivesName.set(project.name) archivesName.set(project.name)
} }
tasks.named<DefaultTask>("build") { tasks.named("build") {
dependsOn(tasks["shadowJar"]) dependsOn("shadowJar")
} }
} }
fun downloadPack(packUrl: URL, project: Project, metapack: Boolean = false) { fun Project.bundleAddons(archive: TaskProvider<out AbstractArchiveTask>) {
val fileName = packUrl.file.substring(packUrl.file.lastIndexOf("/")) val addonProjects = project(":common:addons").subprojects
val resourceType = if (metapack) "metapacks" else "packs" gradle.projectsEvaluated {
val file = File("${project.buildDir}/resources/main/${resourceType}/${fileName}") archive.configure {
file.parentFile.mkdirs() addonProjects.forEach { addon ->
file.outputStream().write(packUrl.readBytes()) 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/" //val mavenSnapshotUrl = "https://repo.codemc.io/repository/maven-snapshots/"
maven(mavenUrl) { maven(mavenUrl) {
val SoloStudiosReleasesUsername: String? by project val releasesUsername = findProperty("SoloStudiosReleasesUsername") as String?
val SoloStudiosReleasesPassword: String? by project val releasesPassword = findProperty("SoloStudiosReleasesPassword") as String?
if (SoloStudiosReleasesUsername != null && SoloStudiosReleasesPassword != null) { if (releasesUsername != null && releasesPassword != null) {
credentials { credentials {
username = SoloStudiosReleasesUsername username = releasesUsername
password = SoloStudiosReleasesPassword password = releasesPassword
} }
} }
} }
+15 -15
View File
@@ -14,25 +14,25 @@ object Versions {
const val cloud = "2.1.0" 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 { object Internal {
const val shadow = "9.3.1" const val shadow = "9.6.1"
const val apacheText = "1.14.0" const val apacheText = "1.15.0"
const val apacheIO = "2.20.0" const val apacheIO = "2.22.0"
const val guava = "33.5.0-jre" const val guava = "33.8.0-jre"
const val asm = "9.9" const val asm = "9.11.1"
const val snakeYml = "2.5" const val snakeYml = "2.7"
const val jetBrainsAnnotations = "26.0.2-1" const val jetBrainsAnnotations = "26.1.0"
const val junit = "6.0.0" const val junit = "6.1.3"
const val nbt = "6.1" const val nbt = "6.1"
} }
} }
object Fabric { object Fabric {
const val fabricAPI = "0.165.2+${Mod.minecraft}" const val fabricAPI = "0.166.0+${Mod.minecraft}"
const val cloud = "2.1.0" const val cloud = "2.1.0"
} }
// //
@@ -60,12 +60,12 @@ object Versions {
object Bukkit { object Bukkit {
const val minecraft = "26.3" 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 paper = paperBuild
const val runPaper = "3.0.2" const val runPaper = "3.1.0"
const val wyck = "4.0.0-0f573ad7" const val wyck = "4.0.0-0f573ad7"
const val cloud = "2.0.1" 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 { object CLI {
const val logback = "1.5.19" const val logback = "1.6.6"
const val picocli = "4.7.7" const val picocli = "4.7.7"
} }
@@ -7,7 +7,13 @@ import java.io.File
import java.io.FileInputStream import java.io.FileInputStream
import java.io.InputStream import java.io.InputStream
import org.gradle.api.DefaultTask 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.gradle.api.tasks.TaskAction
import org.objectweb.asm.ClassReader import org.objectweb.asm.ClassReader
import org.objectweb.asm.tree.ClassNode import org.objectweb.asm.tree.ClassNode
@@ -15,11 +21,18 @@ import org.objectweb.asm.tree.FieldNode
abstract class GenerateDocsTask : DefaultTask() { abstract class GenerateDocsTask : DefaultTask() {
@get:InputFiles
@get:PathSensitive(PathSensitivity.RELATIVE)
abstract val classDirectories: ListProperty<Directory>
@get:OutputDirectory
abstract val docsDirectory: DirectoryProperty
@TaskAction @TaskAction
fun generateDocs() { fun generateDocs() {
project.extensions.getByType(JavaPluginExtension::class.java).sourceSets.forEach { sources -> classDirectories.get().forEach { classesDirectory ->
val classes = HashMap<String, ClassNode>() val classes = HashMap<String, ClassNode>()
sources.java.classesDirectory.get().asFileTree.forEach { file -> classesDirectory.asFileTree.forEach { file ->
if (file.name.endsWith(".class")) { if (file.name.endsWith(".class")) {
val node = createClassNode(FileInputStream(file)) val node = createClassNode(FileInputStream(file))
if (node.fields.stream().anyMatch { field -> if (node.fields.stream().anyMatch { field ->
@@ -27,10 +40,7 @@ abstract class GenerateDocsTask : DefaultTask() {
it.desc.equals(descriptor(Value::class.java.canonicalName)) it.desc.equals(descriptor(Value::class.java.canonicalName))
} == true } == true
}) { }) {
var name = sources var name = classesDirectory
.java
.classesDirectory
.get()
.asFile .asFile
.toPath() .toPath()
.relativize(file.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() docsDir.mkdirs()
classes.forEach { (name, clazz) -> classes.forEach { (name, clazz) ->
@@ -2,9 +2,15 @@ package com.dfsek.terra.tectonicdoc
import org.gradle.api.Plugin import org.gradle.api.Plugin
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.api.plugins.JavaPluginExtension
class TectonicDocPlugin : Plugin<Project> { class TectonicDocPlugin : Plugin<Project> {
override fun apply(project: 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:implementation:base"))
testImplementation(project(":common:addons:minecraft-attributes")) testImplementation(project(":common:addons:minecraft-attributes"))
testImplementation(project(":common:addons:manifest-addon-loader")) 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 { dependencies {
compileOnlyApi(project(":common:addons:manifest-addon-loader")) 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 { dependencies {
compileOnlyApi(project(":common:addons:manifest-addon-loader")) 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 { dependencies {
compileOnlyApi(project(":common:addons:manifest-addon-loader")) 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") version = version("1.0.0")
dependencies { dependencies {
api("commons-io", "commons-io", Versions.Libraries.Internal.apacheIO) api("commons-io:commons-io:${Versions.Libraries.Internal.apacheIO}")
implementation("com.dfsek.tectonic", "yaml", Versions.Libraries.tectonic) implementation("com.dfsek.tectonic:yaml:${Versions.Libraries.tectonic}")
} }
tasks.withType<Jar> { tasks.withType<Jar> {
@@ -1,7 +1,7 @@
version = version("1.0.0") version = version("1.0.0")
dependencies { dependencies {
api("commons-io", "commons-io", Versions.Libraries.Internal.apacheIO) api("commons-io:commons-io:${Versions.Libraries.Internal.apacheIO}")
api("com.github.Querz", "NBT", Versions.Libraries.Internal.nbt) api("com.github.Querz:NBT:${Versions.Libraries.Internal.nbt}")
compileOnlyApi(project(":common:addons:manifest-addon-loader")) compileOnlyApi(project(":common:addons:manifest-addon-loader"))
} }
@@ -1,6 +1,6 @@
version = version("1.2.0") version = version("1.2.0")
dependencies { 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")) compileOnlyApi(project(":common:addons:manifest-addon-loader"))
} }
+8 -8
View File
@@ -1,16 +1,16 @@
dependencies { dependencies {
compileOnlyApi("org.slf4j", "slf4j-api", Versions.Libraries.slf4j) compileOnlyApi("org.slf4j:slf4j-api:${Versions.Libraries.slf4j}")
testImplementation("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("com.dfsek.tectonic:common:${Versions.Libraries.tectonic}")
api("ca.solo-studios", "strata", Versions.Libraries.strata) api("ca.solo-studios:strata:${Versions.Libraries.strata}")
api("com.dfsek", "paralithic", Versions.Libraries.paralithic) api("com.dfsek:paralithic:${Versions.Libraries.paralithic}")
api("com.dfsek", "seismic", Versions.Libraries.seismic) api("com.dfsek:seismic:${Versions.Libraries.seismic}")
} }
+5 -5
View File
@@ -2,14 +2,14 @@ dependencies {
api(project(":common:api")) api(project(":common:api"))
api(project(":common:implementation:bootstrap-addon-loader")) 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("org.apache.commons:commons-text:${Versions.Libraries.Internal.apacheText}")
implementation("com.dfsek.tectonic", "yaml", Versions.Libraries.tectonic) 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 # Gradle options
org.gradle.jvmargs=-Xmx4096M -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 org.gradle.jvmargs=-Xmx4096M -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.warning.mode=all 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 distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionSha256Sum=553c78f50dafcd54d65b9a444649057857469edf836431389695608536d6b746 distributionSha256Sum=0b00b0ffe07c4d4789c12d4935a44a7057d55774b7540bd4a3f76f336deb177a
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.0-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-9.9.0-bin.zip
networkTimeout=10000 networkTimeout=10000
retries=0
retryBackOffMs=500
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
Vendored
+4 -7
View File
@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# #
# Copyright © 2015-2021 the original authors. # Copyright © 2015 the original authors.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with 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: # Important for running:
# #
@@ -29,7 +29,7 @@
# bash, then to run this script, type that shell name before the whole # bash, then to run this script, type that shell name before the whole
# command line, like: # command line, like:
# #
# ksh Gradle # ksh gradlew
# #
# Busybox and similar reduced shells will NOT work, because this script # Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features: # requires all of these POSIX shell features:
@@ -57,7 +57,7 @@
# Darwin, MinGW, and NonStop. # Darwin, MinGW, and NonStop.
# #
# (3) This script is generated from the Groovy template # (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. # within the Gradle project.
# #
# You can find Gradle at https://github.com/gradle/gradle/. # You can find Gradle at https://github.com/gradle/gradle/.
@@ -114,7 +114,6 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;; NONSTOP* ) nonstop=true ;;
esac esac
CLASSPATH="\\\"\\\""
# Determine the Java command to use to start the JVM. # 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 # For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" ) JAVACMD=$( cygpath --unix "$JAVACMD" )
@@ -212,7 +210,6 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
set -- \ set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \ "-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@" "$@"
Vendored
+52 -34
View File
@@ -19,12 +19,39 @@
@if "%DEBUG%"=="" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
@rem Gradle startup script for Windows @rem gradlew startup script for Windows
@rem @rem
@rem ########################################################################## @rem ##########################################################################
@rem Set local scope for the variables with windows NT shell @rem Set local scope for the variables, and ensure extensions are enabled
if "%OS%"=="Windows_NT" setlocal 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 set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=. if "%DIRNAME%"=="" set DIRNAME=.
@@ -45,13 +72,14 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2 1>&2 echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 1>&2 echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo. 1>&2 1>&2 echo.
echo Please set the JAVA_HOME variable in your environment to match the 1>&2 1>&2 echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation. 1>&2 1>&2 echo location of your Java installation.
goto fail "%COMSPEC%" /c exit 1
goto exitWithErrorLevel
:findJavaFromJavaHome :findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=% set JAVA_HOME=%JAVA_HOME:"=%
@@ -59,36 +87,26 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute if exist "%JAVA_EXE%" goto execute
echo. 1>&2 1>&2 echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 1>&2 echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo. 1>&2 1>&2 echo.
echo Please set the JAVA_HOME variable in your environment to match the 1>&2 1>&2 echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation. 1>&2 1>&2 echo location of your Java installation.
goto fail "%COMSPEC%" /c exit 1
goto exitWithErrorLevel
:execute :execute
@rem Setup the command line @rem Setup the command line
set CLASSPATH=
@rem Execute Gradle @rem Execute gradlew
"%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 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 This label must not be changed. We rely on old scripts being able to jump to this point.
@rem End local scope for the variables with windows NT shell :exitWithErrorLevel
if %ERRORLEVEL% equ 0 goto mainEnd @rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts
"%COMSPEC%" /c exit %ERRORLEVEL%
: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
+8 -8
View File
@@ -11,26 +11,26 @@ repositories {
} }
} }
val geyserMappings: Configuration by configurations.register("geyserMappings") { val geyserMappings = configurations.register("geyserMappings") {
isCanBeConsumed = false isCanBeConsumed = false
} }
val mcmeta: Configuration by configurations.register("mcmeta") { val mcmeta = configurations.register("mcmeta") {
isCanBeConsumed = false isCanBeConsumed = false
} }
dependencies { dependencies {
shadedApi(project(":common:implementation:base")) 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:items:${Versions.Allay.mappings}@json")
geyserMappings("GeyserMC.mappings", "biomes", Versions.Allay.mappings, ext = "json") geyserMappings("GeyserMC.mappings:biomes:${Versions.Allay.mappings}@json")
geyserMappings("GeyserMC.mappings-generator", "generator_blocks", Versions.Allay.mappingsGenerator, ext = "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 { tasks.processResources {
+7 -7
View File
@@ -27,18 +27,18 @@ dependencies {
implementation(project(":platforms:minecraft-common")) { isTransitive = false } implementation(project(":platforms:minecraft-common")) { isTransitive = false }
shaded(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(testFixtures(project(":platforms:minecraft-common")))
testImplementation(project(":common:addons:minecraft-attributes")) testImplementation(project(":common:addons:minecraft-attributes"))
testImplementation("io.papermc.paper", "paper-api", Versions.Bukkit.paper) testImplementation("io.papermc.paper:paper-api:${Versions.Bukkit.paper}")
testImplementation("com.dfsek.wyck", "Wyck", Versions.Bukkit.wyck) testImplementation("com.dfsek.wyck:Wyck:${Versions.Bukkit.wyck}")
} }
+9 -10
View File
@@ -7,15 +7,15 @@ val javaMainClass = "com.dfsek.terra.cli.TerraCLI"
dependencies { dependencies {
shadedApi(project(":common:implementation:base")) shadedApi(project(":common:implementation:base"))
shadedApi("commons-io", "commons-io", Versions.Libraries.Internal.apacheIO) shadedApi("commons-io:commons-io:${Versions.Libraries.Internal.apacheIO}")
shadedApi("com.github.Querz", "NBT", Versions.Libraries.Internal.nbt) shadedApi("com.github.Querz:NBT:${Versions.Libraries.Internal.nbt}")
shadedImplementation("info.picocli", "picocli", Versions.CLI.picocli) shadedImplementation("info.picocli:picocli:${Versions.CLI.picocli}")
annotationProcessor("info.picocli", "picocli-codegen", 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. // 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")) testImplementation(project(":common:addons:minecraft-attributes"))
@@ -32,9 +32,7 @@ tasks.withType<Jar> {
} }
tasks.withType<JavaCompile> { tasks.withType<JavaCompile> {
doFirst { options.compilerArgs.add("-Aproject=${project.group}/${project.name}")
options.compilerArgs.add("-Aproject=${project.group}/${project.name}")
}
} }
application { application {
@@ -43,9 +41,10 @@ application {
tasks.getByName("run").setProperty("workingDir", file("./run")) 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> { tasks.withType<Test> {
workingDir = file("./run").also { it.mkdirs() } workingDir = file("./run").also { it.mkdirs() }
forkEvery = 1
} }
tasks.withType<Test> { dependsOn("moveAddonsrun") } tasks.withType<Test> { dependsOn("moveAddonsrun") }
+3 -3
View File
@@ -28,12 +28,12 @@ dependencies {
implementation("net.fabricmc:fabric-loader:${Versions.Mod.fabricLoader}") 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") 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 { loom {
+8 -19
View File
@@ -6,32 +6,21 @@ dependencies {
api(project(":common:implementation:base")) api(project(":common:implementation:base"))
} }
val taskSet = HashSet<AbstractArchiveTask>() val dump = tasks.register<Sync>("dumpDependents") {
val resourcesDir = File("${project.buildDir}/resources/main/") into(layout.buildDirectory.dir("generated/platform-jars"))
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)
}
}
} }
tasks["processResources"].dependsOn(dump) sourceSets.main {
output.dir(mapOf("builtBy" to dump), dump.map { it.destinationDir })
}
afterEvaluate { afterEvaluate {
project(":platforms").subprojects.forEach { project(":platforms").subprojects.forEach {
if (it == this@afterEvaluate) return@forEach if (it == this@afterEvaluate) return@forEach
val taskName = platformOverrides.getOrDefault(it.name, "jar") val taskName = platformOverrides.getOrDefault(it.name, "jar")
val task = it.tasks.named(taskName).get() val task = it.tasks.named(taskName)
if (task !is AbstractArchiveTask) { dump.configure { from(task) }
throw IllegalArgumentException("Task dependency must be Archive Task: " + task.name) logger.info("Merged JAR will incorporate task $taskName from platform ${it.name}.")
}
tasks["dumpDependents"].dependsOn(task)
taskSet.add(task)
logger.info("Merged JAR will incorporate task ${task.name} from platform ${it.name}.")
} }
} }
+4 -6
View File
@@ -1,14 +1,12 @@
dependencies { dependencies {
shadedApi(project(":common:implementation:base")) shadedApi(project(":common:implementation:base"))
shadedApi("com.github.ben-manes.caffeine", "caffeine", Versions.Libraries.caffeine) shadedApi("com.github.ben-manes.caffeine:caffeine:${Versions.Libraries.caffeine}")
shadedImplementation("com.google.guava", "guava", Versions.Libraries.Internal.guava) 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") { bundleAddons(tasks.jar)
finalizedBy("installAddonsIntoDefaultJar")
}
tasks.withType<JavaCompile>().configureEach { tasks.withType<JavaCompile>().configureEach {
options.release = 25 options.release = 25
+2 -2
View File
@@ -7,8 +7,8 @@ val javaMainClass = "com.dfsek.terra.minestom.TerraMinestomExample"
dependencies { dependencies {
shadedApi(project(":platforms:minestom")) shadedApi(project(":platforms:minestom"))
implementation("net.minestom", "minestom", Versions.Minestom.minestom) implementation("net.minestom:minestom:${Versions.Minestom.minestom}")
implementation("org.slf4j", "slf4j-simple", Versions.Libraries.slf4j) implementation("org.slf4j:slf4j-simple:${Versions.Libraries.slf4j}")
} }
tasks.withType<Jar> { tasks.withType<Jar> {
+1 -1
View File
@@ -14,7 +14,7 @@ dependencies {
minecraft("com.mojang:minecraft:${Versions.Mod.minecraft}") 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")
exclude("net.fabricmc.fabric-api") exclude("net.fabricmc.fabric-api")
exclude("me.lucko", "fabric-permissions-api") exclude("me.lucko", "fabric-permissions-api")