Some TODOs
This commit is contained in:
parent
88cc5e36e9
commit
b5adf70424
|
@ -61,8 +61,10 @@ allprojects {
|
||||||
sourceSet(sub.sourceSets.main)
|
sourceSet(sub.sourceSets.main)
|
||||||
sourceSet(sub.sourceSets.client)
|
sourceSet(sub.sourceSets.client)
|
||||||
}
|
}
|
||||||
register("${sub.name}-testmod") {
|
if (!sourceSets.testmod.resources.isEmpty) {
|
||||||
sourceSet(sub.sourceSets.testmod)
|
register("${sub.name}-testmod") {
|
||||||
|
sourceSet(sub.sourceSets.testmod)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,25 +81,35 @@ subprojects {
|
||||||
|
|
||||||
tasks.named("javadoc").get().enabled = false
|
tasks.named("javadoc").get().enabled = false
|
||||||
|
|
||||||
afterEvaluate {
|
if (name !in devOnlyModules && !sourceSets.testmod.resources.isEmpty) {
|
||||||
dependencies {
|
//TODO register testmods of subprojects as testmodInclude automatically
|
||||||
testmodImplementation(sourceSets.main.output)
|
// 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")))
|
||||||
|
clientImplementation(sourceSets.client.output)
|
||||||
|
testmodImplementation(sourceSets.testmod.output)
|
||||||
|
|
||||||
|
if (name !in devOnlyModules) include(project)
|
||||||
|
}
|
||||||
|
|
||||||
|
afterEvaluate {
|
||||||
tasks.genClientOnlySources.enabled = false
|
tasks.genClientOnlySources.enabled = false
|
||||||
tasks.genCommonSources.enabled = false
|
tasks.genCommonSources.enabled = false
|
||||||
tasks.unpickClientOnlyJar.enabled = false
|
tasks.unpickClientOnlyJar.enabled = false
|
||||||
tasks.unpickCommonJar.enabled = false
|
tasks.unpickCommonJar.enabled = false
|
||||||
|
|
||||||
rootProject.dependencies {
|
|
||||||
api(project(mapOf("path" to project.path, "configuration" to "shadow")))
|
|
||||||
clientImplementation(sourceSets.client.output)
|
|
||||||
testmodImplementation(sourceSets.testmod.output)
|
|
||||||
|
|
||||||
if (name !in devOnlyModules) include(project)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasProperty("curseforge_id")) apply(plugin = "jfmod.curseforge")
|
if (hasProperty("curseforge_id")) apply(plugin = "jfmod.curseforge")
|
||||||
if (hasProperty("modrinth_id")) apply(plugin = "jfmod.modrinth")
|
if (hasProperty("modrinth_id")) apply(plugin = "jfmod.modrinth")
|
||||||
|
|
|
@ -47,17 +47,6 @@ class LomPlugin @Inject constructor(private val softwareComponentFactory: Softwa
|
||||||
loom {
|
loom {
|
||||||
runtimeOnlyLog4j.set(true)
|
runtimeOnlyLog4j.set(true)
|
||||||
splitEnvironmentSourceSets()
|
splitEnvironmentSourceSets()
|
||||||
|
|
||||||
// Class path groups (required to allow ultra early init)
|
|
||||||
mods {
|
|
||||||
register(name) {
|
|
||||||
sourceSet(sourceSets.main)
|
|
||||||
sourceSet(sourceSets.client)
|
|
||||||
}
|
|
||||||
register("$name-testmod") {
|
|
||||||
sourceSet(sourceSets.testmod)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create testmod source set with access to main and client classpaths
|
// Create testmod source set with access to main and client classpaths
|
||||||
|
@ -71,6 +60,40 @@ class LomPlugin @Inject constructor(private val softwareComponentFactory: Softwa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val hasTestmod = !sourceSets.testmod.resources.isEmpty
|
||||||
|
|
||||||
|
// Class path groups (required to allow ultra early init)
|
||||||
|
loom {
|
||||||
|
mods {
|
||||||
|
register(name) {
|
||||||
|
sourceSet(sourceSets.main)
|
||||||
|
sourceSet(sourceSets.client)
|
||||||
|
}
|
||||||
|
if (hasTestmod) {
|
||||||
|
register("$name-testmod") {
|
||||||
|
sourceSet(sourceSets.testmod)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasTestmod) {
|
||||||
|
runs {
|
||||||
|
create("testmodClient") {
|
||||||
|
client()
|
||||||
|
ideConfigGenerated(rootProject == project)
|
||||||
|
name("Testmod Client")
|
||||||
|
source(sourceSets.testmod)
|
||||||
|
}
|
||||||
|
create("testmodServer") {
|
||||||
|
server()
|
||||||
|
ideConfigGenerated(rootProject == project)
|
||||||
|
name("Testmod Server")
|
||||||
|
source(sourceSets.testmod)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Common repositories for mods
|
// Common repositories for mods
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
|
@ -97,10 +120,15 @@ class LomPlugin @Inject constructor(private val softwareComponentFactory: Softwa
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register dev configuration and add "dev" classifier to unremapped jars
|
// Mark normal jars as -dev
|
||||||
configurations.create("dev")
|
|
||||||
tasks.jar.archiveClassifier.set("dev")
|
tasks.jar.archiveClassifier.set("dev")
|
||||||
|
|
||||||
|
// Used for referencing the unremapped jars of other projects
|
||||||
|
artifacts.add(configurations.create("dev").name, tasks.jar.archiveFile.get().asFile) {
|
||||||
|
type = "jar"
|
||||||
|
builtBy(tasks.jar)
|
||||||
|
}
|
||||||
|
|
||||||
// configure the shadow task to not shadow by default and output to builds/devlibs
|
// configure the shadow task to not shadow by default and output to builds/devlibs
|
||||||
tasks.shadowJar {
|
tasks.shadowJar {
|
||||||
val inputTask: Jar = tasks.findByName("injectCompiledConfig") as Jar? ?: tasks.jar // get injectCompiledConfig task if present (-> LibJF) or use normal jar task
|
val inputTask: Jar = tasks.findByName("injectCompiledConfig") as Jar? ?: tasks.jar // get injectCompiledConfig task if present (-> LibJF) or use normal jar task
|
||||||
|
@ -111,13 +139,6 @@ class LomPlugin @Inject constructor(private val softwareComponentFactory: Softwa
|
||||||
destinationDirectory.set(devlibs)
|
destinationDirectory.set(devlibs)
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is here for some reason
|
|
||||||
// TODO wtf does this do?
|
|
||||||
artifacts.add("dev", tasks.jar.archiveFile.get().asFile) {
|
|
||||||
type = "jar"
|
|
||||||
builtBy(tasks.jar)
|
|
||||||
}
|
|
||||||
|
|
||||||
// generate sources jar to publish for better debugging with dependents
|
// generate sources jar to publish for better debugging with dependents
|
||||||
java {
|
java {
|
||||||
withSourcesJar()
|
withSourcesJar()
|
||||||
|
@ -138,22 +159,6 @@ class LomPlugin @Inject constructor(private val softwareComponentFactory: Softwa
|
||||||
}
|
}
|
||||||
tasks.assemble.dependsOn(remapMavenJar)
|
tasks.assemble.dependsOn(remapMavenJar)
|
||||||
|
|
||||||
// generate jar from testmod source set
|
|
||||||
val testmodJar by tasks.registering(Jar::class) {
|
|
||||||
from(sourceSets.testmod.output)
|
|
||||||
destinationDirectory.set(devlibs)
|
|
||||||
archiveClassifier.set("testmod")
|
|
||||||
}
|
|
||||||
|
|
||||||
// remap configuration for outputting usable testmod jar
|
|
||||||
val remapTestmodJar by tasks.registering(RemapJarTask::class) { //TODO include deps
|
|
||||||
dependsOn(testmodJar)
|
|
||||||
inputFile.set(testmodJar.archiveFile.get())
|
|
||||||
archiveClassifier.set("testmod")
|
|
||||||
addNestedDependencies.set(false)
|
|
||||||
}
|
|
||||||
tasks.assemble.dependsOn(remapTestmodJar)
|
|
||||||
|
|
||||||
// configure remapJar to use the output of shadow
|
// configure remapJar to use the output of shadow
|
||||||
tasks.remapJar {
|
tasks.remapJar {
|
||||||
dependsOn(tasks.shadowJar.get())
|
dependsOn(tasks.shadowJar.get())
|
||||||
|
@ -180,6 +185,31 @@ class LomPlugin @Inject constructor(private val softwareComponentFactory: Softwa
|
||||||
tasks.publish.dependsOn(tasks.build)
|
tasks.publish.dependsOn(tasks.build)
|
||||||
tasks.deployDebug.dependsOn(tasks.publish)
|
tasks.deployDebug.dependsOn(tasks.publish)
|
||||||
|
|
||||||
|
// create testmodInclude configuration
|
||||||
|
val testmodIncludeConfiguration = configurations.create("testmodInclude")
|
||||||
|
|
||||||
|
if (hasTestmod) {
|
||||||
|
// generate jar from testmod source set
|
||||||
|
val testmodJar by tasks.registering(Jar::class) {
|
||||||
|
from(sourceSets.testmod.output)
|
||||||
|
destinationDirectory.set(devlibs)
|
||||||
|
archiveClassifier.set("testmod")
|
||||||
|
}
|
||||||
|
|
||||||
|
afterEvaluate {
|
||||||
|
// remap configuration for outputting usable testmod jar
|
||||||
|
val remapTestmodJar by tasks.registering(RemapJarTask::class) {
|
||||||
|
dependsOn(testmodJar)
|
||||||
|
inputFile.set(testmodJar.archiveFile.get())
|
||||||
|
archiveClassifier.set("testmod")
|
||||||
|
// add nested jars from testmodInclude
|
||||||
|
addNestedDependencies.set(true)
|
||||||
|
nestedJars.setFrom(*testmodIncludeConfiguration.files.toTypedArray())
|
||||||
|
}
|
||||||
|
tasks.assemble.dependsOn(remapTestmodJar)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
afterEvaluate {
|
afterEvaluate {
|
||||||
// from fabric-example-mod, enforces modern java
|
// from fabric-example-mod, enforces modern java
|
||||||
tasks.withType<JavaCompile>().configureEach {
|
tasks.withType<JavaCompile>().configureEach {
|
||||||
|
@ -188,7 +218,6 @@ class LomPlugin @Inject constructor(private val softwareComponentFactory: Softwa
|
||||||
}
|
}
|
||||||
|
|
||||||
// otherwise we can't easily overwrite the artifacts to publish while keeping dependency metadata
|
// otherwise we can't easily overwrite the artifacts to publish while keeping dependency metadata
|
||||||
//TODO find a better solution to this (custom component?)
|
|
||||||
tasks.withType<GenerateModuleMetadata> {
|
tasks.withType<GenerateModuleMetadata> {
|
||||||
enabled = false
|
enabled = false
|
||||||
}
|
}
|
||||||
|
@ -205,4 +234,4 @@ class LomPlugin @Inject constructor(private val softwareComponentFactory: Softwa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue