From ec685ebdc078135d4673aecb082a76107ec28f80 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Thu, 18 Apr 2024 19:00:19 -0700 Subject: [PATCH] Out for a run - Move loom.runs into subprojects closure - Move common code sharing into subprojects closure - Apply java plugin - Fix runs not being generated by moving generatePackageInfos to the bottom --- build.gradle | 38 ++++++++++++++++++++++++++++++++------ fabric/build.gradle | 33 --------------------------------- forge/build.gradle | 24 ------------------------ 3 files changed, 32 insertions(+), 63 deletions(-) diff --git a/build.gradle b/build.gradle index 516025ba3..700792afb 100644 --- a/build.gradle +++ b/build.gradle @@ -7,23 +7,39 @@ plugins { println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}" -boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE').equalsIgnoreCase('false'); - -ext.buildNumber = System.getenv('BUILD_NUMBER') - subprojects { + boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE').equalsIgnoreCase('false'); + + ext.buildNumber = System.getenv('BUILD_NUMBER') + group = 'com.jozufozu.flywheel' version = mod_version + (dev && buildNumber != null ? "-${buildNumber}" : '') + apply plugin: "java" apply plugin: "maven-publish" apply plugin: "dev.architectury.loom" - apply from: rootProject.file('gradle/package-infos.gradle') loom { silentMojangMappingsLicense() } - ideaSyncTask.finalizedBy(generatePackageInfos) + if (it != project(':common')) { + loom { + runs { + client { + ideConfigGenerated true + property 'flw.dumpShaderSource', 'true' + property 'flw.debugMemorySafety', 'true' + programArgs '--width', '1280', '--height', '720' + } + + server { + ideConfigGenerated true + programArgs '--nogui' + } + } + } + } tasks { // make builds reproducible @@ -101,6 +117,8 @@ subprojects { } tasks.withType(JavaCompile).configureEach { + source(project(':common').sourceSets.main.allSource) + options.encoding = 'UTF-8' options.release = Integer.parseInt(java_version) options.compilerArgs = ['-Xdiags:verbose'] @@ -113,14 +131,22 @@ subprojects { } sourcesJar.configure { + from(project(':common').sourceSets.main.allSource) + addManifest(it) addLicense(it) } javadoc.configure { + source(project(':common').sourceSets.main.allJava) + // prevent java 8's strict doclint for javadocs from failing builds options.addStringOption('Xdoclint:none', '-quiet') } + + apply from: rootProject.file('gradle/package-infos.gradle') + + ideaSyncTask.finalizedBy(generatePackageInfos) } void addLicense(jarTask) { diff --git a/fabric/build.gradle b/fabric/build.gradle index f6749b800..fac6ac166 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -4,27 +4,6 @@ base { archivesName = "flywheel-${project.name}-${artifact_minecraft_version}" } -loom { - runs { - configureEach { - property 'forge.logging.markers', '' - property 'forge.logging.console.level', 'debug' - } - - client { - ideConfigGenerated true - property 'flw.dumpShaderSource', 'true' - property 'flw.debugMemorySafety', 'true' - programArgs '--width', '1280', '--height', '720' - } - - server { - ideConfigGenerated true - programArgs '--nogui' - } - } -} - dependencies { modCompileOnly "net.fabricmc:fabric-loader:$fabric_loader_version" modLocalRuntime "net.fabricmc:fabric-loader:$fabric_loader_version" @@ -43,18 +22,6 @@ dependencies { compileOnly "com.google.code.findbugs:jsr305:3.0.2" } -tasks.withType(JavaCompile).configureEach { - source(project(':common').sourceSets.main.allSource) -} - -sourcesJar.configure { - from(project(':common').sourceSets.main.allSource) -} - -javadoc.configure { - source(project(':common').sourceSets.main.allJava) -} - publishing { publications { register('mavenJava', MavenPublication) { diff --git a/forge/build.gradle b/forge/build.gradle index 8ec5cd047..7d44d99cb 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -16,18 +16,6 @@ loom { property 'forge.logging.markers', '' property 'forge.logging.console.level', 'debug' } - - client { - ideConfigGenerated true - property 'flw.dumpShaderSource', 'true' - property 'flw.debugMemorySafety', 'true' - programArgs '--width', '1280', '--height', '720' - } - - server { - ideConfigGenerated true - programArgs '--nogui' - } } } @@ -42,18 +30,6 @@ dependencies { compileOnly "com.google.code.findbugs:jsr305:3.0.2" } -tasks.withType(JavaCompile).configureEach { - source(project(':common').sourceSets.main.allSource) -} - -sourcesJar.configure { - from(project(':common').sourceSets.main.allSource) -} - -javadoc.configure { - source(project(':common').sourceSets.main.allJava) -} - publishing { publications { register('mavenJava', MavenPublication) {