Move to jar / *Jar tasks instead of compileJava

Prior to this PR, classes were compiled multiple times (presumably for each sourceset, so at-least twice in normal projects)
This commit is contained in:
Jared 2022-06-15 20:44:14 +02:00
parent d4b36f9cde
commit 3bd253dcdd
No known key found for this signature in database
GPG Key ID: DB3BA3B9088A1BDF
3 changed files with 22 additions and 12 deletions

View File

@ -35,6 +35,7 @@ processResources {
expand buildProps expand buildProps
} }
} }
publishing { publishing {
publications { publications {
mavenJava(MavenPublication) { mavenJava(MavenPublication) {

View File

@ -16,6 +16,12 @@ dependencies {
} }
loom { loom {
mods {
register(mod_id) {
sourceSet sourceSets.main
sourceSet project(":Common").sourceSets.main
}
}
runs { runs {
client { client {
client() client()
@ -32,9 +38,7 @@ loom {
} }
} }
processResources { processResources {
from project(":Common").sourceSets.main.resources
inputs.property "version", project.version inputs.property "version", project.version
filesMatching("fabric.mod.json") { filesMatching("fabric.mod.json") {
@ -42,14 +46,16 @@ processResources {
} }
} }
tasks.withType(JavaCompile) { jar {
source(project(":Common").sourceSets.main.allSource) from project(":Common").sourceSets.main.output
} }
jar { javadoc {
from("LICENSE") { source project(":Common").sourceSets.main.allJava
rename { "${it}_${mod_name}" }
} }
sourcesJar {
from project(":Common").sourceSets.main.allSource
} }
publishing { publishing {

View File

@ -77,14 +77,17 @@ dependencies {
compileOnly project(":Common") compileOnly project(":Common")
} }
tasks.withType(JavaCompile) { jar {
source(project(":Common").sourceSets.main.allSource) from project(":Common").sourceSets.main.output
} }
processResources { javadoc {
from project(":Common").sourceSets.main.resources source project(":Common").sourceSets.main.allJava
} }
sourcesJar {
from project(":Common").sourceSets.main.allSource
}
jar.finalizedBy('reobfJar') jar.finalizedBy('reobfJar')