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")
|
2023-11-22 18:20:15 +00:00
|
|
|
id("cc-tweaked.illuaminate")
|
2024-12-05 11:58:03 +00:00
|
|
|
id("cc-tweaked.mod")
|
2023-10-11 19:15:36 +01:00
|
|
|
id("cc-tweaked.publishing")
|
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 {
|
2024-04-25 21:32:48 +01:00
|
|
|
maven("https://maven.neoforged.net/") {
|
2024-01-29 20:59:16 +00:00
|
|
|
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.
|
2024-08-30 09:35:48 +01:00
|
|
|
api(project(":core"))
|
|
|
|
api(commonClasses(project(":common-api")))
|
|
|
|
clientApi(clientClasses(project(":common-api")))
|
2022-11-09 23:58:56 +00:00
|
|
|
|
2024-03-22 21:47:11 +00:00
|
|
|
compileOnly(libs.mixin)
|
2024-04-25 21:32:48 +01:00
|
|
|
compileOnly(libs.mixinExtra)
|
2022-11-09 23:58:56 +00:00
|
|
|
compileOnly(libs.bundles.externalMods.common)
|
2024-07-26 18:28:13 +01:00
|
|
|
compileOnly(variantOf(libs.create.forge) { classifier("slim") }) { isTransitive = false }
|
2023-07-10 20:31:06 +01: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 15:21:33 +01:00
|
|
|
|
|
|
|
testFixturesImplementation(testFixtures(project(":core")))
|
2023-11-22 18:20:15 +00:00
|
|
|
|
|
|
|
"cctJavadoc"(libs.cctJavadoc)
|
|
|
|
}
|
|
|
|
|
|
|
|
illuaminate {
|
2025-01-12 18:26:51 +00:00
|
|
|
version = libs.versions.illuaminate
|
2023-11-22 18:20:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
2025-01-12 18:26:51 +00:00
|
|
|
javadocTool = javaToolchains.javadocToolFor { languageVersion = 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 17:59:24 +01:00
|
|
|
|
Clean up Javadocs a little
I've no motivation for modding right now, but always got time for build
system busywork!
CC:T (and CC before that) has always published its API docs. However,
they're not always the most helpful — they're useful if you know what
you're looking for, but aren't a good getting-started guide.
Part of the issue here is there's no examples, and everything is
described pretty abstractly. I have occasionally tried to improve this
(e.g. the peripheral docs in bdffabc08e2eb9895f966c949acc8334a2bf4475),
but it's a long road.
This commit adds a new example mod, which registers peripherals, an API
and a turtle upgrade. While the mod itself isn't exported as part of the
docs, we reference blocks of it using Java's new {@snippet} tag.
- Switch the Forge project to use NeoForge's new Legacy MDG plugin. We
don't *need* to do this, but it means the build logic for Forge and
NeoForge is more closely aligned.
- Add a new SnippetTaglet, which is a partial backport of Java 18+'s
{@snippet}.
- Add an example mod. This is a working multi-loader mod, complete with
datagen (albeit with no good multi-loader abstractions).
- Move our existing <pre>{@code ...}</pre> blocks into the example mod,
replacing them with {@snippet}s.
- Add a new overview page to the docs, providing some getting-started
information. We had this already in the dan200.computercraft.api
package docs, but it's not especially visible there.
2025-01-09 20:47:51 +00:00
|
|
|
fun MergeTrees.configureForDatagen(source: SourceSet, outputFolder: String) {
|
|
|
|
output = layout.projectDirectory.dir(outputFolder)
|
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 17:59:24 +01:00
|
|
|
|
|
|
|
for (loader in listOf("forge", "fabric")) {
|
Clean up Javadocs a little
I've no motivation for modding right now, but always got time for build
system busywork!
CC:T (and CC before that) has always published its API docs. However,
they're not always the most helpful — they're useful if you know what
you're looking for, but aren't a good getting-started guide.
Part of the issue here is there's no examples, and everything is
described pretty abstractly. I have occasionally tried to improve this
(e.g. the peripheral docs in bdffabc08e2eb9895f966c949acc8334a2bf4475),
but it's a long road.
This commit adds a new example mod, which registers peripherals, an API
and a turtle upgrade. While the mod itself isn't exported as part of the
docs, we reference blocks of it using Java's new {@snippet} tag.
- Switch the Forge project to use NeoForge's new Legacy MDG plugin. We
don't *need* to do this, but it means the build logic for Forge and
NeoForge is more closely aligned.
- Add a new SnippetTaglet, which is a partial backport of Java 18+'s
{@snippet}.
- Add an example mod. This is a working multi-loader mod, complete with
datagen (albeit with no good multi-loader abstractions).
- Move our existing <pre>{@code ...}</pre> blocks into the example mod,
replacing them with {@snippet}s.
- Add a new overview page to the docs, providing some getting-started
information. We had this already in the dan200.computercraft.api
package docs, but it's not especially visible there.
2025-01-09 20:47:51 +00:00
|
|
|
mustRunAfter(":$loader:$name")
|
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 17:59:24 +01:00
|
|
|
source {
|
|
|
|
input {
|
Clean up Javadocs a little
I've no motivation for modding right now, but always got time for build
system busywork!
CC:T (and CC before that) has always published its API docs. However,
they're not always the most helpful — they're useful if you know what
you're looking for, but aren't a good getting-started guide.
Part of the issue here is there's no examples, and everything is
described pretty abstractly. I have occasionally tried to improve this
(e.g. the peripheral docs in bdffabc08e2eb9895f966c949acc8334a2bf4475),
but it's a long road.
This commit adds a new example mod, which registers peripherals, an API
and a turtle upgrade. While the mod itself isn't exported as part of the
docs, we reference blocks of it using Java's new {@snippet} tag.
- Switch the Forge project to use NeoForge's new Legacy MDG plugin. We
don't *need* to do this, but it means the build logic for Forge and
NeoForge is more closely aligned.
- Add a new SnippetTaglet, which is a partial backport of Java 18+'s
{@snippet}.
- Add an example mod. This is a working multi-loader mod, complete with
datagen (albeit with no good multi-loader abstractions).
- Move our existing <pre>{@code ...}</pre> blocks into the example mod,
replacing them with {@snippet}s.
- Add a new overview page to the docs, providing some getting-started
information. We had this already in the dan200.computercraft.api
package docs, but it's not especially visible there.
2025-01-09 20:47:51 +00:00
|
|
|
from(project(":$loader").layout.buildDirectory.dir(source.getTaskName("generateResources", null)))
|
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 17:59:24 +01:00
|
|
|
exclude(".cache")
|
|
|
|
}
|
|
|
|
|
Clean up Javadocs a little
I've no motivation for modding right now, but always got time for build
system busywork!
CC:T (and CC before that) has always published its API docs. However,
they're not always the most helpful — they're useful if you know what
you're looking for, but aren't a good getting-started guide.
Part of the issue here is there's no examples, and everything is
described pretty abstractly. I have occasionally tried to improve this
(e.g. the peripheral docs in bdffabc08e2eb9895f966c949acc8334a2bf4475),
but it's a long road.
This commit adds a new example mod, which registers peripherals, an API
and a turtle upgrade. While the mod itself isn't exported as part of the
docs, we reference blocks of it using Java's new {@snippet} tag.
- Switch the Forge project to use NeoForge's new Legacy MDG plugin. We
don't *need* to do this, but it means the build logic for Forge and
NeoForge is more closely aligned.
- Add a new SnippetTaglet, which is a partial backport of Java 18+'s
{@snippet}.
- Add an example mod. This is a working multi-loader mod, complete with
datagen (albeit with no good multi-loader abstractions).
- Move our existing <pre>{@code ...}</pre> blocks into the example mod,
replacing them with {@snippet}s.
- Add a new overview page to the docs, providing some getting-started
information. We had this already in the dan200.computercraft.api
package docs, but it's not especially visible there.
2025-01-09 20:47:51 +00:00
|
|
|
output = project(":$loader").layout.projectDirectory.dir(outputFolder)
|
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 17:59:24 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-05-26 09:34:10 +01:00
|
|
|
|
Clean up Javadocs a little
I've no motivation for modding right now, but always got time for build
system busywork!
CC:T (and CC before that) has always published its API docs. However,
they're not always the most helpful — they're useful if you know what
you're looking for, but aren't a good getting-started guide.
Part of the issue here is there's no examples, and everything is
described pretty abstractly. I have occasionally tried to improve this
(e.g. the peripheral docs in bdffabc08e2eb9895f966c949acc8334a2bf4475),
but it's a long road.
This commit adds a new example mod, which registers peripherals, an API
and a turtle upgrade. While the mod itself isn't exported as part of the
docs, we reference blocks of it using Java's new {@snippet} tag.
- Switch the Forge project to use NeoForge's new Legacy MDG plugin. We
don't *need* to do this, but it means the build logic for Forge and
NeoForge is more closely aligned.
- Add a new SnippetTaglet, which is a partial backport of Java 18+'s
{@snippet}.
- Add an example mod. This is a working multi-loader mod, complete with
datagen (albeit with no good multi-loader abstractions).
- Move our existing <pre>{@code ...}</pre> blocks into the example mod,
replacing them with {@snippet}s.
- Add a new overview page to the docs, providing some getting-started
information. We had this already in the dan200.computercraft.api
package docs, but it's not especially visible there.
2025-01-09 20:47:51 +00:00
|
|
|
val runData by tasks.registering(MergeTrees::class) {
|
|
|
|
configureForDatagen(sourceSets.main.get(), "src/generated/resources")
|
|
|
|
}
|
|
|
|
|
|
|
|
val runExampleData by tasks.registering(MergeTrees::class) {
|
|
|
|
configureForDatagen(sourceSets.examples.get(), "src/examples/generatedResources")
|
|
|
|
}
|
|
|
|
|
2025-01-13 21:54:20 +00:00
|
|
|
// We can't create accurate module metadata for our additional capabilities, so disable it.
|
|
|
|
project.tasks.withType(GenerateModuleMetadata::class.java).configureEach {
|
|
|
|
isEnabled = false
|
|
|
|
}
|