Flywheel/neoforge/build.gradle.kts
Jozufozu 452866498c Merge branch '1.20.1/dev' into 1.21.1/dev
# Conflicts:
#	buildSrc/src/main/kotlin/dev/engine_room/gradle/subproject/SubprojectExtension.kt
#	neoforge/build.gradle.kts
#	vanillinNeoForge/build.gradle.kts
2025-03-01 22:07:00 -08:00

148 lines
3.7 KiB
Kotlin

plugins {
idea
java
`maven-publish`
id("dev.architectury.loom")
id("flywheel.subproject")
id("flywheel.platform")
}
val common = ":common"
val commonProject = project(common)
subproject.init("flywheel-neoforge", "flywheel_group", "flywheel_version")
val api = sourceSets.create("api")
val lib = sourceSets.create("lib")
val backend = sourceSets.create("backend")
val stubs = sourceSets.create("stubs")
val main = sourceSets.getByName("main")
val testMod = sourceSets.create("testMod")
transitiveSourceSets {
compileClasspath = main.compileClasspath
sourceSet(api) {
rootCompile()
from(commonProject)
}
sourceSet(lib) {
rootCompile()
compileClasspath(api)
from(commonProject)
}
sourceSet(backend) {
rootCompile()
compileClasspath(api, lib)
from(commonProject)
}
sourceSet(stubs) {
rootCompile()
from(commonProject)
}
sourceSet(main) {
compileClasspath(api, lib, backend)
bundleFrom(commonProject)
bundleOutput(api, lib, backend)
}
sourceSet(testMod) {
rootCompile()
}
createCompileConfigurations()
}
platform {
setupLoomMod(api, lib, backend, main)
setupLoomRuns()
setupTestMod(testMod)
}
val replaceProperties = listOf(
"mod_license",
"mod_sources",
"mod_issues",
"mod_homepage",
"flywheel_id",
"flywheel_name",
"flywheel_description",
"minecraft_maven_version_range",
"neoforge_version_range",
).associateWith { property(it) as String }
.plus("flywheel_version" to "${property("flywheel_version")}${if (subproject.buildNumber != null) "-${subproject.buildNumber}" else ""}")
tasks.withType<ProcessResources>().configureEach {
inputs.properties(replaceProperties)
filesMatching(listOf("pack.mcmeta", "META-INF/neoforge.mods.toml")) {
expand(replaceProperties)
}
}
jarSets {
mainSet.publishWithRawSources {
artifactId = "flywheel-neoforge-${property("artifact_minecraft_version")}"
}
mainSet.outgoing("flywheel")
create("api", api, lib).apply {
addToAssemble()
publishWithRawSources {
artifactId = "flywheel-neoforge-api-${property("artifact_minecraft_version")}"
}
configureJar {
manifest {
attributes("Fabric-Loom-Remap" to "true")
}
}
}
}
defaultPackageInfos {
sources(api, lib, backend, main)
}
loom {
mixin {
useLegacyMixinAp = true
add(main, "flywheel.refmap.json")
add(backend, "backend-flywheel.refmap.json")
}
runs {
configureEach {
property("forge.logging.markers", "")
property("forge.logging.console.level", "debug")
}
}
}
repositories {
maven("https://maven.neoforged.net/releases/")
}
dependencies {
neoForge("net.neoforged:neoforge:${property("neoforge_version")}")
modCompileOnly("maven.modrinth:sodium:${property("sodium_version")}-neoforge")
modCompileOnly("maven.modrinth:iris:${property("iris_version")}-neoforge")
modCompileOnly("maven.modrinth:embeddium:${property("embeddium_version")}")
"forApi"(project(path = common, configuration = "apiClasses"))
"forLib"(project(path = common, configuration = "libClasses"))
"forBackend"(project(path = common, configuration = "backendClasses"))
"forStubs"(project(path = common, configuration = "stubsClasses"))
"forMain"(project(path = common, configuration = "mainClasses"))
"forLib"(project(path = common, configuration = "libResources"))
"forBackend"(project(path = common, configuration = "backendResources"))
"forMain"(project(path = common, configuration = "mainResources"))
}