From 3bd253dcdd8071436a47b155ea9e9f4599eafd18 Mon Sep 17 00:00:00 2001 From: Jared Date: Wed, 15 Jun 2022 20:44:14 +0200 Subject: [PATCH] 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) --- Common/build.gradle | 1 + Fabric/build.gradle | 22 ++++++++++++++-------- Forge/build.gradle | 11 +++++++---- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/Common/build.gradle b/Common/build.gradle index 53588b4..ea3a28a 100644 --- a/Common/build.gradle +++ b/Common/build.gradle @@ -35,6 +35,7 @@ processResources { expand buildProps } } + publishing { publications { mavenJava(MavenPublication) { diff --git a/Fabric/build.gradle b/Fabric/build.gradle index bd4a49e..44abfe0 100644 --- a/Fabric/build.gradle +++ b/Fabric/build.gradle @@ -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 { diff --git a/Forge/build.gradle b/Forge/build.gradle index ab9c78e..64ab013 100644 --- a/Forge/build.gradle +++ b/Forge/build.gradle @@ -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')