diff --git a/build.gradle.kts b/build.gradle.kts index e20d9799..2bb175db 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,30 +1,18 @@ -import java.text.SimpleDateFormat -import java.util.Date -import java.util.Locale - -import com.diffplug.gradle.spotless.SpotlessExtension -import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar - import net.fabricmc.loom.api.LoomGradleExtensionAPI import net.fabricmc.loom.task.RemapJarTask -import dev.architectury.plugin.ArchitectPluginExtension - -import me.shedaniel.unifiedpublishing.UnifiedPublishingExtension - plugins { java `maven-publish` - id("architectury-plugin") version "3.4-SNAPSHOT" apply false - id("dev.architectury.loom") version "1.2-SNAPSHOT" apply false - id("com.github.johnrengelman.shadow") version "7.1.2" apply false - id("me.shedaniel.unified-publishing") version "0.1.+" apply false - id("com.diffplug.spotless") version "6.4.1" apply false + id("dev.architectury.loom") version "1.3-SNAPSHOT" apply false + id("architectury-plugin") version "3.4-SNAPSHOT" + id("com.github.johnrengelman.shadow") version "8.1.1" + id("me.shedaniel.unified-publishing") version "0.1.+" + id("com.diffplug.spotless") version "6.20.0" } val modId: String by project val minecraftVersion: String by project -val javaVersion: String by project val platforms by extra { property("enabledPlatforms").toString().split(',') @@ -33,7 +21,7 @@ val platforms by extra { fun capitalise(str: String): String { return str.replaceFirstChar { if (it.isLowerCase()) { - it.titlecase(Locale.getDefault()) + it.titlecase() } else { it.toString() } @@ -67,6 +55,8 @@ subprojects { base.archivesName.set("$modId-${project.name}") version = "${(System.getenv("MEGA_VERSION") ?: "v0.0.0").substring(1)}-$minecraftVersion" group = "${property("mavenGroup")}.$modId" + + val javaVersion: String by project java { sourceCompatibility = JavaVersion.valueOf("VERSION_$javaVersion") @@ -75,7 +65,7 @@ subprojects { withSourcesJar() } - configure { + architectury { minecraft = minecraftVersion injectInjectables = false } @@ -131,18 +121,6 @@ subprojects { from(rootProject.file("LICENSE")) { rename { "${it}_$modId"} } - - manifest { - attributes( - "Specification-Title" to modId, - "Specification-Version" to project.version.toString(), - "Specification-Vendor" to "90", - "Implementation-Title" to base.archivesName.get(), - "Implementation-Version" to project.version.toString(), - "Implementation-Vendor" to "90", - "Implementation-Timestamp" to SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(Date()) - ) - } } withType { @@ -151,7 +129,7 @@ subprojects { } } - configure { + spotless { java { target("src/**/java/**/*.java") endWithNewline() @@ -204,7 +182,7 @@ for (platform in platforms) { apply(plugin = "com.github.johnrengelman.shadow") apply(plugin = "me.shedaniel.unified-publishing") - configure { + architectury { platformSetupLoomIde() loader(platform) } @@ -234,18 +212,25 @@ for (platform in platforms) { tasks { processResources { - extra["commonProps"] = mapOf("version" to project.version) + project.properties + val commonProps by extra { mapOf( + "version" to project.version, + "minecraftVersion" to minecraftVersion, + "ae2Version" to project.extra.get("ae2Version"), + "ae2wtVersion" to project.extra.get("ae2wtVersion"), + "appbotVersion" to project.extra.get("appbotVersion")) + } + + inputs.properties(commonProps) } - withType { + shadowJar { exclude("architectury.common.json") configurations = listOf(shadowCommon) archiveClassifier.set("dev-shadow") } withType { - val shadowJar: ShadowJar by project.tasks - inputFile.set(shadowJar.archiveFile) + inputFile.set(shadowJar.get().archiveFile) dependsOn(shadowJar) archiveClassifier.set(null as String?) } @@ -267,7 +252,7 @@ for (platform in platforms) { } if (project.version != "0.0.0") { - configure { + unifiedPublishing { project { val modVersion = project.version.toString() diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index a40c94b0..1ec7fe01 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -25,7 +25,6 @@ "depends": { "minecraft": "$minecraftVersion", - "java": ">=$javaVersion", "ae2": ">=$ae2Version" }, "suggests": { diff --git a/forge/build.gradle.kts b/forge/build.gradle.kts index c5a0a8ff..e5b36e2f 100644 --- a/forge/build.gradle.kts +++ b/forge/build.gradle.kts @@ -104,11 +104,17 @@ dependencies { } tasks.processResources { + val commonProps: Map by extra + val forgeProps = mapOf( + "appmekVersion" to project.extra.get("appmekVersion"), + "loaderVersion" to forgeVersion.substringBefore('.'), + "ae2VersionEnd" to ae2Version.substringBefore('.').toInt() + 1 + ) + + inputs.properties(commonProps) + inputs.properties(forgeProps) + filesMatching("META-INF/mods.toml") { - val commonProps: Map by extra - expand(commonProps + mapOf( - "loaderVersion" to forgeVersion.substringBefore('.'), - "ae2VersionEnd" to ae2Version.substringBefore('.').toInt() + 1 - )) + expand(commonProps + forgeProps) } } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index c1962a79..033e24c4 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0c85a1f7..9f4197d5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index aeb74cbb..fcb6fca1 100755 --- a/gradlew +++ b/gradlew @@ -130,10 +130,13 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can.