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
}
}
publishing {
publications {
mavenJava(MavenPublication) {

View File

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

View File

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