1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-11-17 13:47:11 +00:00

Split CC:T into common and forge projects

After several weeks of carefully arranging ribbons, we pull the string
and end up with, ... a bit of a messy bow. There were still some things
I'd missed.

 - Split the mod into a common (vanilla-only) project and Forge-specific
   project. This gives us room to add Fabric support later on.

 - Split the project into main/client source sets. This is not currently
   statically checked: we'll do that soon.

 - Rename block/item/tile entities to use suffixes rather than prefixes.
This commit is contained in:
Jonathan Coates
2022-11-09 23:58:56 +00:00
parent bdf590fa30
commit f04acdc199
992 changed files with 2294 additions and 2125 deletions

View File

@@ -1,3 +1,6 @@
import cc.tweaked.gradle.clientClasses
import cc.tweaked.gradle.commonClasses
/**
* Sets up the configurations for writing game tests.
*
@@ -9,12 +12,13 @@ plugins {
id("cc-tweaked.java-convention")
}
val main = sourceSets.main.get()
val main = sourceSets["main"]
val client = sourceSets["client"]
// Both testMod and testFixtures inherit from the main classpath, just so we have access to Minecraft classes.
// Both testMod and testFixtures inherit from the main and client classpath, just so we have access to Minecraft classes.
val testMod by sourceSets.creating {
compileClasspath += main.compileClasspath
runtimeClasspath += main.runtimeClasspath
compileClasspath += main.compileClasspath + client.compileClasspath
runtimeClasspath += main.runtimeClasspath + client.runtimeClasspath
}
configurations {
@@ -30,12 +34,13 @@ configurations {
// Like the main test configurations, we're safe to depend on source set outputs.
dependencies {
add(testMod.implementationConfigurationName, main.output)
add(testMod.implementationConfigurationName, client.output)
}
// Similar to java-test-fixtures, but tries to avoid putting the obfuscated jar on the classpath.
val testFixtures by sourceSets.creating {
compileClasspath += main.compileClasspath
compileClasspath += main.compileClasspath + client.compileClasspath
}
java.registerFeature("testFixtures") {
@@ -44,6 +49,12 @@ java.registerFeature("testFixtures") {
}
dependencies {
add(testFixtures.implementationConfigurationName, main.output)
val libs = project.extensions.getByType<VersionCatalogsExtension>().named("libs")
add(testFixtures.apiConfigurationName, libs.findBundle("test").get())
// Consumers of this project already have the common and client classes on the classpath, so it's fine for these
// to be compile-only.
add(testFixtures.compileOnlyApiConfigurationName, commonClasses(project))
add(testFixtures.compileOnlyApiConfigurationName, clientClasses(project))
testImplementation(testFixtures(project))
}