2022-12-14 19:55:53 +01:00
|
|
|
import gradle.kotlin.dsl.accessors._8cca5f6f823c9edc7e57ea4288458c56.base
|
2022-10-07 16:03:38 +02:00
|
|
|
import io.gitlab.jfronny.scripts.*
|
2022-10-06 19:30:52 +02:00
|
|
|
|
|
|
|
plugins {
|
|
|
|
id("jf.autoversion")
|
|
|
|
id("jf.maven-publish")
|
|
|
|
id("lom")
|
|
|
|
}
|
|
|
|
|
|
|
|
val devOnlyModules by extra(prop("dev_only_module", "").split(", ", ",").filter { it.isNotBlank() })
|
|
|
|
val nonModSubprojects by extra(prop("non_mod_project", "").split(", ", ",").filter { it.isNotBlank() })
|
|
|
|
val self = project
|
2022-10-07 17:10:31 +02:00
|
|
|
if (hasProperty("maven_group")) group = prop("maven_group")
|
2022-10-06 19:30:52 +02:00
|
|
|
|
|
|
|
allprojects {
|
|
|
|
if (name in nonModSubprojects) return@allprojects
|
|
|
|
|
|
|
|
group = self.group
|
|
|
|
version = self.version
|
|
|
|
|
|
|
|
apply(plugin = "jf.maven-publish")
|
|
|
|
apply(plugin = "lom")
|
|
|
|
|
|
|
|
base {
|
2022-12-14 19:55:53 +01:00
|
|
|
archivesName.set(prop("archives_base_name", archivesName.get()))
|
2022-10-06 19:30:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
lom {
|
|
|
|
minecraftVersion.set(prop("minecraft_version"))
|
|
|
|
loaderVersion.set(prop("loader_version"))
|
|
|
|
if (hasProperty("yarn_mappings")) yarn(prop("yarn_mappings"))
|
|
|
|
else mojmap()
|
|
|
|
}
|
|
|
|
|
2022-12-14 19:44:20 +01:00
|
|
|
if (hasProperty("libjf_version")) {
|
|
|
|
dependencies {
|
|
|
|
annotationProcessor("io.gitlab.jfronny.libjf:libjf-config-compiler-plugin-v2:${prop("libjf_version")}")
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.withType<JavaCompile> {
|
2022-12-14 19:55:53 +01:00
|
|
|
options.compilerArgs.add("-AmodId=" + base.archivesName.get())
|
2022-12-14 19:44:20 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-06 19:30:52 +02:00
|
|
|
afterEvaluate {
|
|
|
|
self.allprojects.forEach { sub ->
|
|
|
|
if (sub != this && sub.name !in nonModSubprojects) {
|
|
|
|
loom {
|
|
|
|
mods {
|
|
|
|
register(sub.name) {
|
2022-10-07 18:42:33 +02:00
|
|
|
sourceSet(sub.sourceSets.main.get())
|
|
|
|
sourceSet(sub.sourceSets.client.get())
|
2022-10-06 19:30:52 +02:00
|
|
|
}
|
2022-10-07 18:42:33 +02:00
|
|
|
if (!sourceSets.testmod.get().resources.isEmpty) {
|
2022-10-07 18:20:43 +02:00
|
|
|
register("${sub.name}-testmod") {
|
2022-10-07 18:42:33 +02:00
|
|
|
sourceSet(sub.sourceSets.testmod.get())
|
2022-10-07 18:20:43 +02:00
|
|
|
}
|
2022-10-06 19:30:52 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
subprojects {
|
|
|
|
if (name in nonModSubprojects) return@subprojects
|
|
|
|
|
|
|
|
self.tasks.deployDebug.dependsOn(tasks.deployDebug)
|
|
|
|
self.tasks.deployRelease.dependsOn(tasks.deployRelease)
|
|
|
|
|
2022-12-13 23:07:05 +01:00
|
|
|
tasks.named("javadoc") { enabled = false }
|
2022-10-06 19:30:52 +02:00
|
|
|
|
2022-10-07 18:42:33 +02:00
|
|
|
if (name !in devOnlyModules && !sourceSets.testmod.get().resources.isEmpty) {
|
2022-10-07 18:20:43 +02:00
|
|
|
//TODO register testmods of subprojects as testmodInclude automatically
|
|
|
|
// val configuration = configurations.create("testmodJar").name
|
|
|
|
// val testmodJarTask = tasks.named<Jar>("testmodJar").get()
|
|
|
|
// artifacts.add(configuration, testmodJarTask.archiveFile.get().asFile) {
|
|
|
|
// type = "jar"
|
|
|
|
// builtBy(testmodJarTask)
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// self.dependencies {
|
|
|
|
// testmodInclude(project(mapOf("path" to path, "configuration" to configuration)))
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
|
|
|
|
self.dependencies {
|
|
|
|
api(project(mapOf("path" to project.path, "configuration" to "shadow")))
|
2022-10-07 18:42:33 +02:00
|
|
|
clientImplementation(sourceSets.client.get().output)
|
|
|
|
testmodImplementation(sourceSets.testmod.get().output)
|
2022-10-06 19:30:52 +02:00
|
|
|
|
2022-10-07 18:20:43 +02:00
|
|
|
if (name !in devOnlyModules) include(project)
|
|
|
|
}
|
|
|
|
|
|
|
|
afterEvaluate {
|
2022-12-13 23:07:05 +01:00
|
|
|
tasks.genClientOnlySources { enabled = false }
|
|
|
|
tasks.genCommonSources { enabled = false }
|
|
|
|
tasks.unpickClientOnlyJar { enabled = false }
|
|
|
|
tasks.unpickCommonJar { enabled = false }
|
2022-10-06 19:30:52 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-03 15:53:40 +01:00
|
|
|
val moveArtifacts by tasks.registering(Copy::class) {
|
|
|
|
val suffix = if (flavour.isEmpty()) "" else "-$flavour"
|
|
|
|
|
|
|
|
val sources = mapOf("latest$suffix.jar" to tasks.remapJar, "latest$suffix-dev.jar" to tasks.shadowJar)
|
|
|
|
|
|
|
|
for (source in sources) {
|
|
|
|
from(source.value.map { it.archiveFile }) {
|
|
|
|
this.rename { source.key }
|
|
|
|
}
|
|
|
|
dependsOn(source.value)
|
|
|
|
}
|
|
|
|
|
|
|
|
into(buildDir.resolve("artifacts"))
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.deployDebug.dependsOn(moveArtifacts)
|
|
|
|
|
2022-10-06 19:30:52 +02:00
|
|
|
if (hasProperty("curseforge_id")) apply(plugin = "jfmod.curseforge")
|
2022-10-07 18:20:43 +02:00
|
|
|
if (hasProperty("modrinth_id")) apply(plugin = "jfmod.modrinth")
|