2023-03-15 21:52:13 +00:00
|
|
|
// SPDX-FileCopyrightText: 2022 The CC: Tweaked Developers
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2023-11-22 18:20:15 +00:00
|
|
|
import cc.tweaked.gradle.*
|
2022-11-09 23:58:56 +00:00
|
|
|
|
|
|
|
plugins {
|
|
|
|
id("cc-tweaked.vanilla")
|
|
|
|
id("cc-tweaked.gametest")
|
2023-11-22 18:20:15 +00:00
|
|
|
id("cc-tweaked.illuaminate")
|
2023-10-11 18:15:36 +00:00
|
|
|
id("cc-tweaked.publishing")
|
2022-11-09 23:58:56 +00:00
|
|
|
}
|
|
|
|
|
Move shared generated resources to common project
In 1.20.1, Forge and Fabric have different "common" tag conventions (for
instance, Forge uses forge:dusts/redstone, while Fabric uses
c:redstone_dusts). This means the generated recipes (and advancements)
will be different for the two loader projects. As such, we run data
generators for each loader, and store the results separately.
However, aside from some recipes and advancements, most resources /are/
the same between the two. This means we end up with a lot of duplicate
files, which make the diff even harder to read. This gets worse in
1.20.5, when NeoForge and Fabric have (largely) unified their tag names.
This commit now merges the generated resources of the two loaders,
moving shared files to the common project.
- Add a new MergeTrees command, to handle the de-duplication of files.
- Change the existing runData tasks to write to
build/generatedResources.
- Add a new :common:runData task, that reads from the
build/generatedResources folder and writes to the per-project
src/generated/resources.
2024-04-26 16:59:24 +00:00
|
|
|
sourceSets {
|
|
|
|
main {
|
|
|
|
resources.srcDir("src/generated/resources")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-09 23:58:56 +00:00
|
|
|
minecraft {
|
|
|
|
accessWideners(
|
|
|
|
"src/main/resources/computercraft.accesswidener",
|
|
|
|
"src/main/resources/computercraft-common.accesswidener",
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2023-11-22 18:20:15 +00:00
|
|
|
configurations {
|
|
|
|
register("cctJavadoc")
|
|
|
|
}
|
|
|
|
|
2024-01-29 20:59:16 +00:00
|
|
|
repositories {
|
|
|
|
maven("https://maven.minecraftforge.net/") {
|
|
|
|
content {
|
|
|
|
includeModule("org.spongepowered", "mixin")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-09 23:58:56 +00:00
|
|
|
dependencies {
|
|
|
|
// Pull in our other projects. See comments in MinecraftConfigurations on this nastiness.
|
|
|
|
implementation(project(":core"))
|
|
|
|
implementation(commonClasses(project(":common-api")))
|
|
|
|
clientImplementation(clientClasses(project(":common-api")))
|
|
|
|
|
|
|
|
compileOnly(libs.bundles.externalMods.common)
|
2024-07-26 17:28:13 +00:00
|
|
|
compileOnly(variantOf(libs.create.forge) { classifier("slim") }) { isTransitive = false }
|
2023-07-10 19:31:06 +00:00
|
|
|
clientCompileOnly(variantOf(libs.emi) { classifier("api") })
|
2022-11-09 23:58:56 +00:00
|
|
|
|
|
|
|
annotationProcessorEverywhere(libs.autoService)
|
2022-12-09 22:01:01 +00:00
|
|
|
testFixturesAnnotationProcessor(libs.autoService)
|
2022-11-09 23:58:56 +00:00
|
|
|
|
|
|
|
testImplementation(testFixtures(project(":core")))
|
|
|
|
testImplementation(libs.bundles.test)
|
|
|
|
testRuntimeOnly(libs.bundles.testRuntime)
|
|
|
|
|
2024-02-24 14:52:44 +00:00
|
|
|
testImplementation(libs.jmh)
|
|
|
|
testAnnotationProcessor(libs.jmh.processor)
|
|
|
|
|
2024-01-30 22:00:36 +00:00
|
|
|
testModCompileOnly(libs.mixin)
|
2022-11-09 23:58:56 +00:00
|
|
|
testModImplementation(testFixtures(project(":core")))
|
2022-11-10 15:48:26 +00:00
|
|
|
testModImplementation(testFixtures(project(":common")))
|
2022-11-09 23:58:56 +00:00
|
|
|
testModImplementation(libs.bundles.kotlin)
|
2023-10-08 14:21:33 +00:00
|
|
|
|
|
|
|
testFixturesImplementation(testFixtures(project(":core")))
|
2023-11-22 18:20:15 +00:00
|
|
|
|
|
|
|
"cctJavadoc"(libs.cctJavadoc)
|
|
|
|
}
|
|
|
|
|
|
|
|
illuaminate {
|
|
|
|
version.set(libs.versions.illuaminate)
|
|
|
|
}
|
|
|
|
|
|
|
|
val luaJavadoc by tasks.registering(Javadoc::class) {
|
|
|
|
description = "Generates documentation for Java-side Lua functions."
|
|
|
|
group = JavaBasePlugin.DOCUMENTATION_GROUP
|
|
|
|
|
|
|
|
val sourceSets = listOf(sourceSets.main.get(), project(":core").sourceSets.main.get())
|
|
|
|
for (sourceSet in sourceSets) {
|
|
|
|
source(sourceSet.java)
|
|
|
|
classpath += sourceSet.compileClasspath
|
|
|
|
}
|
|
|
|
|
|
|
|
destinationDir = layout.buildDirectory.dir("docs/luaJavadoc").get().asFile
|
|
|
|
|
|
|
|
val options = options as StandardJavadocDocletOptions
|
|
|
|
options.docletpath = configurations["cctJavadoc"].files.toList()
|
|
|
|
options.doclet = "cc.tweaked.javadoc.LuaDoclet"
|
|
|
|
options.addStringOption("project-root", rootProject.file(".").absolutePath)
|
|
|
|
options.noTimestamp(false)
|
|
|
|
|
|
|
|
javadocTool.set(
|
|
|
|
javaToolchains.javadocToolFor {
|
2024-01-29 22:14:48 +00:00
|
|
|
languageVersion.set(CCTweakedPlugin.JAVA_VERSION)
|
2023-11-22 18:20:15 +00:00
|
|
|
},
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
val lintLua by tasks.registering(IlluaminateExec::class) {
|
|
|
|
group = JavaBasePlugin.VERIFICATION_GROUP
|
|
|
|
description = "Lint Lua (and Lua docs) with illuaminate"
|
|
|
|
|
|
|
|
// Config files
|
|
|
|
inputs.file(rootProject.file("illuaminate.sexp")).withPropertyName("illuaminate.sexp")
|
|
|
|
// Sources
|
|
|
|
inputs.files(rootProject.fileTree("doc")).withPropertyName("docs")
|
|
|
|
inputs.files(project(":core").fileTree("src/main/resources/data/computercraft/lua")).withPropertyName("lua rom")
|
|
|
|
inputs.files(luaJavadoc)
|
|
|
|
|
|
|
|
args = listOf("lint")
|
|
|
|
workingDir = rootProject.projectDir
|
|
|
|
|
|
|
|
doFirst { if (System.getenv("GITHUB_ACTIONS") != null) println("::add-matcher::.github/matchers/illuaminate.json") }
|
|
|
|
doLast { if (System.getenv("GITHUB_ACTIONS") != null) println("::remove-matcher owner=illuaminate::") }
|
2022-11-09 23:58:56 +00:00
|
|
|
}
|
Move shared generated resources to common project
In 1.20.1, Forge and Fabric have different "common" tag conventions (for
instance, Forge uses forge:dusts/redstone, while Fabric uses
c:redstone_dusts). This means the generated recipes (and advancements)
will be different for the two loader projects. As such, we run data
generators for each loader, and store the results separately.
However, aside from some recipes and advancements, most resources /are/
the same between the two. This means we end up with a lot of duplicate
files, which make the diff even harder to read. This gets worse in
1.20.5, when NeoForge and Fabric have (largely) unified their tag names.
This commit now merges the generated resources of the two loaders,
moving shared files to the common project.
- Add a new MergeTrees command, to handle the de-duplication of files.
- Change the existing runData tasks to write to
build/generatedResources.
- Add a new :common:runData task, that reads from the
build/generatedResources folder and writes to the per-project
src/generated/resources.
2024-04-26 16:59:24 +00:00
|
|
|
|
|
|
|
val runData by tasks.registering(MergeTrees::class) {
|
|
|
|
output = layout.projectDirectory.dir("src/generated/resources")
|
|
|
|
|
|
|
|
for (loader in listOf("forge", "fabric")) {
|
|
|
|
mustRunAfter(":$loader:runData")
|
|
|
|
source {
|
|
|
|
input {
|
|
|
|
from(project(":$loader").layout.buildDirectory.dir("generatedResources"))
|
|
|
|
exclude(".cache")
|
|
|
|
}
|
|
|
|
|
|
|
|
output = project(":$loader").layout.projectDirectory.dir("src/generated/resources")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-05-26 08:34:10 +00:00
|
|
|
|
|
|
|
tasks.withType(GenerateModuleMetadata::class).configureEach { isEnabled = false }
|