diff --git a/build.gradle.kts b/build.gradle.kts index c603d2c8..afcd1de9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,4 @@ import java.text.SimpleDateFormat -import java.util.Date import com.diffplug.gradle.spotless.SpotlessExtension import com.fasterxml.jackson.core.type.TypeReference @@ -12,12 +11,13 @@ import net.fabricmc.loom.task.RemapJarTask import dev.architectury.plugin.ArchitectPluginExtension import me.shedaniel.unifiedpublishing.UnifiedPublishingExtension +import java.util.* plugins { java `maven-publish` id("architectury-plugin") version "3.4-SNAPSHOT" apply false - id("dev.architectury.loom") version "1.0-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 @@ -31,6 +31,16 @@ val platforms by extra { property("enabledPlatforms").toString().split(',') } +fun capitalise(str: String): String { + return str.replaceFirstChar { + if (it.isLowerCase()) { + it.titlecase(Locale.getDefault()) + } else { + it.toString() + } + } +} + tasks { val collectJars by registering(Copy::class) { val tasks = subprojects.filter { it.name in platforms }.map { it.tasks.named("remapJar") } @@ -173,7 +183,7 @@ subprojects { publishing { publications { - create("maven${project.name.capitalize()}") { + create("maven${capitalise(project.name)}") { groupId = project.group.toString() artifactId = project.base.archivesName.get() version = project.version.toString() @@ -205,12 +215,12 @@ for (platform in platforms) { configurations { compileClasspath.get().extendsFrom(common) runtimeClasspath.get().extendsFrom(common) - getByName("development${platform.capitalize()}").extendsFrom(common) + getByName("development${capitalise(platform)}").extendsFrom(common) } dependencies { common(project(path = ":common", configuration = "namedElements")) { isTransitive = false } - shadowCommon(project(path = ":common", configuration = "transformProduction${platform.capitalize()}")) { isTransitive = false } + shadowCommon(project(path = ":common", configuration = "transformProduction${capitalise(platform)}")) { isTransitive = false } } tasks { @@ -265,10 +275,10 @@ for (platform in platforms) { var releaseChannel = "release" var changes = System.getenv("CHANGELOG") ?: "No changelog provided?" - if (modVersion.toLowerCase().contains("alpha")) { + if (modVersion.lowercase().contains("alpha")) { releaseChannel = "alpha" changes = "THIS IS AN ALPHA RELEASE, MAKE A BACKUP BEFORE INSTALLING AND FREQUENTLY WHILE PLAYING, AND PLEASE REPORT ANY ISSUE YOU MAY FIND ON THE ISSUE TRACKER.\n\n$changes" - } else if (modVersion.toLowerCase().contains("beta")) { + } else if (modVersion.lowercase().contains("beta")) { releaseChannel = "beta" changes = "This is a beta release. It is expected to be mostly stable, but in any case please report any issue you may find.\n\n$changes" } @@ -277,7 +287,7 @@ for (platform in platforms) { changelog.set(changes) displayName.set(String.format("%s (%s %s)", modVersion.substring(0, modVersion.lastIndexOf("-")), - platform.capitalize(), + capitalise(platform), minecraftVersion)) mainPublication(project.tasks.getByName("remapJar")) diff --git a/common/build.gradle.kts b/common/build.gradle.kts index a468e5ef..52234f46 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -7,7 +7,10 @@ architectury { dependencies { annotationProcessor("org.spongepowered:mixin:0.8.5:processor") + val fabricProject = project(":fabric").dependencyProject + + modCompileOnly("net.fabricmc.fabric-api:fabric-api:${fabricProject.property("fabricApiVersion")}+${property("minecraftVersion")}") modCompileOnly("appeng:appliedenergistics2-fabric:${property("ae2Version")}") - modCompileOnly("curse.maven:ae2wtlib-459929:${project(":fabric").dependencyProject.property("ae2wtFile")}") - modCompileOnly("curse.maven:applied-botanics-addon-610632:${project(":fabric").dependencyProject.property("appbotFile")}") + modCompileOnly("curse.maven:ae2wtlib-459929:${fabricProject.property("ae2wtFile")}") + modCompileOnly("curse.maven:applied-botanics-addon-610632:${fabricProject.property("appbotFile")}") } diff --git a/forge/build.gradle.kts b/forge/build.gradle.kts index 029ab9ad..7f3fbfe7 100644 --- a/forge/build.gradle.kts +++ b/forge/build.gradle.kts @@ -1,18 +1,18 @@ +val generated = file("src/generated/resources") + loom { + val modId: String by project + runs { create("data") { data() + programArgs("--all", "--mod", modId) + programArgs("--output", generated.absolutePath) programArgs("--existing", file("src/main/resources").absolutePath) } } forge { - val modId: String by project - - dataGen { - mod(modId) - } - convertAccessWideners.set(true) extraAccessWideners.add(loom.accessWidenerPath.get().asFile.name) @@ -101,6 +101,7 @@ dependencies { sourceSets { main { resources { + srcDir(generated) exclude("**/.cache") } } @@ -114,4 +115,6 @@ tasks.processResources { "ae2VersionEnd" to ae2Version.substringBefore('.').toInt() + 1 )) } + + duplicatesStrategy = DuplicatesStrategy.INCLUDE } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 249e5832..c1962a79 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 070cb702..0c85a1f7 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index a69d9cb6..aeb74cbb 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,13 +80,10 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -143,12 +140,16 @@ fi if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -193,6 +194,10 @@ if "$cygwin" || "$msys" ; then done fi + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + # Collect all arguments for the java command; # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # shell script including quotes and variable substitutions, so put them in diff --git a/gradlew.bat b/gradlew.bat index 53a6b238..6689b85b 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME%