fix: use split sources preference in more places
ci/woodpecker/push/gradle Pipeline was successful Details
ci/woodpecker/push/pages Pipeline was successful Details

This commit is contained in:
Johannes Frohnmeyer 2024-03-21 13:35:48 +01:00
parent b427d9e1ab
commit 8b6da081a0
Signed by: Johannes
GPG Key ID: E76429612C2929F4
4 changed files with 8 additions and 6 deletions

View File

@ -26,6 +26,7 @@ interface JfModExtension: LomExtension {
fun isFabric(proj: Project) = if (proj == this) isFabric else (proj.extensions.findByName("lom") as? LomExtension)?.isFabric ?: false
fun isForge(proj: Project) = if (proj == this) isForge else (proj.extensions.findByName("lom") as? LomExtension)?.isNeoForge ?: false
fun isNeoForge(proj: Project) = if (proj == this) isNeoForge else (proj.extensions.findByName("lom") as? LomExtension)?.isNeoForge ?: false
fun isSplitSources(proj: Project) = if (proj == this) isSplitSources else (proj.extensions.findByName("lom") as? LomExtension)?.isSplitSources ?: false
fun curseforge(closure: Action<CurseForge>) = closure.execute(curseforge)
fun modrinth(closure: Action<Modrinth>) = closure.execute(modrinth)

View File

@ -66,7 +66,7 @@ afterEvaluate {
mods {
register(sub.name) {
sourceSet(sub.sourceSets.main.get())
sourceSet(sub.sourceSets.client.get())
if (rootArgs.isSplitSources(sub)) sourceSet(sub.sourceSets.client.get())
}
if (!sourceSets.testmod.get().resources.isEmpty) {
register("${sub.name}-testmod") {
@ -99,7 +99,7 @@ afterEvaluate {
if (!isRoot) rootProject.dependencies {
if (rootArgs.isFabric && lomArgs.isFabric) {
api(project(path = project.path, configuration = "shadow"))
clientImplementation(sourceSets.client.get().output)
if (lomArgs.isSplitSources) clientImplementation(sourceSets.client.get().output)
testmodImplementation(sourceSets.testmod.get().output)
if (!devOnly) include(project)

View File

@ -24,4 +24,5 @@ fun DependencyHandler.devProject(path: String): Dependency = project(path, "dev"
val LomExtension.isFabric: Boolean get() = loaderKind.get() == LoaderKind.FABRIC
val LomExtension.isForge: Boolean get() = loaderKind.get() == LoaderKind.FORGE
val LomExtension.isNeoForge: Boolean get() = loaderKind.get() == LoaderKind.NEOFORGE
val LomExtension.isNeoForge: Boolean get() = loaderKind.get() == LoaderKind.NEOFORGE
val LomExtension.isSplitSources: Boolean get() = isFabric // other loaders don't support split sources

View File

@ -22,7 +22,7 @@ args.loaderKind.finalizeValue()
loom {
runtimeOnlyLog4j.set(true)
// Other loaders unfortunately don't support this yet
if (args.isFabric) splitEnvironmentSourceSets()
if (args.isSplitSources) splitEnvironmentSourceSets()
silentMojangMappingsLicense()
}
@ -44,7 +44,7 @@ loom {
mods {
register(name) {
sourceSet(sourceSets.main.get())
sourceSet(sourceSets.client.get())
if (args.isSplitSources) sourceSet(sourceSets.client.get())
}
if (hasTestmod) {
register("$name-testmod") {
@ -104,7 +104,7 @@ earlyAfterEvaluate {
}
testmodImplementation(sourceSets.main.get().output)
testmodImplementation(sourceSets.client.get().output)
if (args.isSplitSources) testmodImplementation(sourceSets.client.get().output)
}
}