diff --git a/.github/workflows/gradle-publish.yml b/.github/workflows/gradle-publish.yml new file mode 100644 index 0000000..7fdbeb9 --- /dev/null +++ b/.github/workflows/gradle-publish.yml @@ -0,0 +1,45 @@ +name: Publish + +on: + workflow_dispatch: + push: + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: "Checkout" + uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'oracle' + server-id: github # Value of the distributionManagement/repository/id field of the pom.xml + settings-path: ${{ github.workspace }} # location for the settings.xml file + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + - name: Publish + run: ./gradlew publish + env: + MAVEN_USER: ${{ secrets.MAVEN_USER }} + MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} + BUILD_NUMBER: ${{ github.run_number }} + - name: CurseForge Publish + run: ./gradlew curseforge -PcurseApiKey=${CURSE_API_KEY} + env: + CURSE_API_KEY: ${{ secrets.CURSE_API_KEY }} + BUILD_NUMBER: ${{ github.run_number }} + continue-on-error: true + - name: Modrinth Publish + run: ./gradlew modrinth -PmodrinthToken=${MODRINTH_TOKEN} + env: + MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} + BUILD_NUMBER: ${{ github.run_number }} + continue-on-error: true diff --git a/Common/build.gradle b/Common/build.gradle index 4c06545..c05c1b8 100644 --- a/Common/build.gradle +++ b/Common/build.gradle @@ -1,10 +1,8 @@ plugins { - id 'java' id 'org.spongepowered.gradle.vanilla' version '0.2.1-SNAPSHOT' - id 'maven-publish' } -archivesBaseName = "${mod_name}-common" +base.archivesName.set("${mod_name}-common") minecraft { accessWideners(project.file("src/main/resources/terrablender.accesswidener")) @@ -24,7 +22,7 @@ minecraft { dependencies { compileOnly group:'org.spongepowered', name: 'mixin', version: '0.8.5' - compileOnly group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1' + compileOnly group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2' compileOnly("com.electronwill.night-config:toml:${nightconfig_version}") compileOnly("com.electronwill.night-config:core:${nightconfig_version}") } @@ -75,13 +73,10 @@ publishing { } repositories { maven { - url "https://maven.minecraftforge.net/releases/" - authentication { - basic(BasicAuthentication) - } + url = "https://maven.minecraftforge.net/releases/" credentials { - username = System.env.MAVEN_USER ?:'fake' - password = System.env.MAVEN_PASSWORD ?:'news' + username = System.getenv("MAVEN_USER") + password = System.getenv("MAVEN_PASSWORD") } } } diff --git a/Common/src/main/resources/pack.mcmeta b/Common/src/main/resources/pack.mcmeta index 2babb79..c2d21b7 100644 --- a/Common/src/main/resources/pack.mcmeta +++ b/Common/src/main/resources/pack.mcmeta @@ -1,6 +1,6 @@ { "pack": { "description": "Resources used for TerraBlender", - "pack_format": 10 + "pack_format": 15 } } \ No newline at end of file diff --git a/Example/Fabric/build.gradle b/Example/Fabric/build.gradle index 56f3737..ea21a45 100644 --- a/Example/Fabric/build.gradle +++ b/Example/Fabric/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '0.12-SNAPSHOT' + id 'fabric-loom' version '1.4-SNAPSHOT' id 'idea' } @@ -35,4 +35,4 @@ loom { runDir("run") } } -} +} \ No newline at end of file diff --git a/Example/Fabric/gradle/wrapper/gradle-wrapper.jar b/Example/Fabric/gradle/wrapper/gradle-wrapper.jar index 7454180..d64cd49 100644 Binary files a/Example/Fabric/gradle/wrapper/gradle-wrapper.jar and b/Example/Fabric/gradle/wrapper/gradle-wrapper.jar differ diff --git a/Example/Fabric/gradle/wrapper/gradle-wrapper.properties b/Example/Fabric/gradle/wrapper/gradle-wrapper.properties index e750102..a595206 100644 --- a/Example/Fabric/gradle/wrapper/gradle-wrapper.properties +++ b/Example/Fabric/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/Example/Fabric/src/main/resources/pack.mcmeta b/Example/Fabric/src/main/resources/pack.mcmeta index 6977cdd..321da2f 100644 --- a/Example/Fabric/src/main/resources/pack.mcmeta +++ b/Example/Fabric/src/main/resources/pack.mcmeta @@ -1,6 +1,6 @@ { "pack": { "description": "Resources used for test", - "pack_format": 8 + "pack_format": 15 } } \ No newline at end of file diff --git a/Example/Forge/build.gradle b/Example/Forge/build.gradle index bdd5ffa..95c271e 100644 --- a/Example/Forge/build.gradle +++ b/Example/Forge/build.gradle @@ -1,19 +1,10 @@ -buildscript { - repositories { - maven { url = 'https://maven.minecraftforge.net/' } - maven { url = 'https://repo.spongepowered.org/repository/maven-public/' } - mavenCentral() - } - dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.+', changing: true - classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT' - } +plugins { + id "net.minecraftforge.gradle" version "6.+" + id "org.spongepowered.mixin" version "0.7-SNAPSHOT" + id "java" + id "idea" } -apply plugin: 'net.minecraftforge.gradle' -apply plugin: 'idea' -apply plugin: 'org.spongepowered.mixin' - group "test" archivesBaseName = "Test-forge" diff --git a/Example/Forge/gradle/wrapper/gradle-wrapper.jar b/Example/Forge/gradle/wrapper/gradle-wrapper.jar index 7454180..d64cd49 100644 Binary files a/Example/Forge/gradle/wrapper/gradle-wrapper.jar and b/Example/Forge/gradle/wrapper/gradle-wrapper.jar differ diff --git a/Example/Forge/gradle/wrapper/gradle-wrapper.properties b/Example/Forge/gradle/wrapper/gradle-wrapper.properties index e750102..a595206 100644 --- a/Example/Forge/gradle/wrapper/gradle-wrapper.properties +++ b/Example/Forge/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/Example/Forge/src/main/resources/pack.mcmeta b/Example/Forge/src/main/resources/pack.mcmeta index 6977cdd..321da2f 100644 --- a/Example/Forge/src/main/resources/pack.mcmeta +++ b/Example/Forge/src/main/resources/pack.mcmeta @@ -1,6 +1,6 @@ { "pack": { "description": "Resources used for test", - "pack_format": 8 + "pack_format": 15 } } \ No newline at end of file diff --git a/Fabric/build.gradle b/Fabric/build.gradle index 7fb3568..fa840d1 100644 --- a/Fabric/build.gradle +++ b/Fabric/build.gradle @@ -1,20 +1,17 @@ plugins { - id 'fabric-loom' version '0.12-SNAPSHOT' - id 'maven-publish' - id 'idea' + id "fabric-loom" version "1.4-SNAPSHOT" id "com.matthewprenger.cursegradle" version "1.4.0" - id "com.modrinth.minotaur" version "2.7.+" + id "com.modrinth.minotaur" version "2.+" } -archivesBaseName = "${mod_name}-fabric" -def mod_build_version = "${mod_version}.${System.getenv().BUILD_NUMBER}" +base.archivesName.set("${mod_name}-fabric") dependencies { minecraft "com.mojang:minecraft:${minecraft_version}" mappings loom.officialMojangMappings() modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}" modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}" - implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1' + implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2' compileOnly project(":Common") include implementation("com.electronwill.night-config:toml:${nightconfig_version}") include implementation("com.electronwill.night-config:core:${nightconfig_version}") @@ -43,9 +40,9 @@ processResources { inputs.property "version", project.version filesMatching("fabric.mod.json") { - expand "version": mod_build_version + expand "version": mod_version } - + filesMatching("${mod_id}.mixins.json") { expand "refmap_target": "${archivesBaseName}-" } @@ -61,13 +58,8 @@ jar { } } -def changelog_file = rootProject.file("build/TerraBlender-${version}-changelog.txt") - curseforge { - if (project.hasProperty('curseApiKey')) { - apiKey = project.getProperty('curseApiKey') - } - + apiKey = project.findProperty('curseApiKey') ?: 'unset' project { id = '565956' @@ -78,6 +70,7 @@ curseforge { releaseType = release_channel addGameVersion minecraft_version addGameVersion 'Fabric' + addGameVersion 'Quilt' mainArtifact(remapJar) { displayName = "TerraBlender Fabric ${version}" @@ -94,26 +87,22 @@ curseforge { } modrinth { - if (project.hasProperty('modrinthToken')) { - token = project.getProperty('modrinthToken') - } + token = project.findProperty('modrinthToken') projectId = "terrablender" - versionNumber = mod_build_version - versionName = mod_build_version + " for Fabric " + minecraft_version + versionNumber = mod_version + versionName = mod_version + " for Fabric " + minecraft_version versionType = release_channel // can be release, beta, or alpha uploadFile = remapJar - gameVersions = [ minecraft_version ] - loaders = [ 'fabric' ] + gameVersions = [minecraft_version] + loaders = ['fabric', 'quilt'] if (changelog_file.exists()) { - def changelog_text = changelog_file.text - changelog = "```\n" + changelog_text.substring(0, changelog_text.indexOf("=========")).replace("\t", " ") + "```" + changelog = trimChangelog(changelog_file.text) } dependencies { required.project "fabric-api" } - // debugMode = true } publishing { @@ -153,15 +142,12 @@ publishing { } } repositories { - maven { - url "https://maven.minecraftforge.net/releases/" - authentication { - basic(BasicAuthentication) - } - credentials { - username = System.env.MAVEN_USER ?:'fake' - password = System.env.MAVEN_PASSWORD ?:'news' - } - } + maven { + url = "https://maven.minecraftforge.net/releases/" + credentials { + username = System.getenv("MAVEN_USER") + password = System.getenv("MAVEN_PASSWORD") + } + } } -} +} \ No newline at end of file diff --git a/Forge/build.gradle b/Forge/build.gradle index 23329ba..8730b12 100644 --- a/Forge/build.gradle +++ b/Forge/build.gradle @@ -1,37 +1,15 @@ -buildscript { - repositories { - maven { url = 'https://maven.minecraftforge.net' } - maven { url = 'https://repo.spongepowered.org/repository/maven-public/' } - mavenCentral() - } - dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true - classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT' - } -} - plugins { + id "net.minecraftforge.gradle" version "[6.0,6.2.)" + id "org.spongepowered.mixin" version "0.7-SNAPSHOT" id "com.matthewprenger.cursegradle" version "1.4.0" - id "com.modrinth.minotaur" version "2.7.+" + id "com.modrinth.minotaur" version "2.+" } -apply plugin: 'java' -apply plugin: 'net.minecraftforge.gradle' -apply plugin: 'maven-publish' -apply plugin: 'org.spongepowered.mixin' - -archivesBaseName = "${mod_name}-forge" -def mod_build_version = "${mod_version}.${System.getenv().BUILD_NUMBER}" +base.archivesName.set("${mod_name}-forge") minecraft { mappings channel: 'official', version: minecraft_version - - if (project.hasProperty('forge_ats_enabled') && project.findProperty('forge_ats_enabled').toBoolean()) { - // This location is hardcoded in Forge and can not be changed. - // https://github.com/MinecraftForge/MinecraftForge/blob/be1698bb1554f9c8fa2f58e32b9ab70bc4385e60/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFile.java#L123 - accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') - project.logger.debug('Forge Access Transformers are enabled for this project.') - } + accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') runs { client { @@ -39,12 +17,6 @@ minecraft { args "-mixin.config=${mod_id}.mixins.json", "-mixin.config=${mod_id}_forge.mixins.json" ideaModule "${rootProject.name}.${project.name}.main" taskName 'Client' - mods { - modClientRun { - source sourceSets.main - source project(":Common").sourceSets.main - } - } } server { @@ -52,12 +24,6 @@ minecraft { args "-mixin.config=${mod_id}.mixins.json", "-mixin.config=${mod_id}_forge.mixins.json" ideaModule "${rootProject.name}.${project.name}.main" taskName 'Server' - mods { - modServerRun { - source sourceSets.main - source project(":Common").sourceSets.main - } - } } data { @@ -65,12 +31,6 @@ minecraft { ideaModule "${rootProject.name}.${project.name}.main" args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/'), "-mixin.config=${mod_id}.mixins.json", "-mixin.config=${mod_id}_forge.mixins.json" taskName 'Data' - mods { - modDataRun { - source sourceSets.main - source project(":Common").sourceSets.main - } - } } } } @@ -83,6 +43,12 @@ dependencies { annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' } +// Workaround for SpongePowered/MixinGradle#38 +afterEvaluate { + tasks.configureReobfTaskForReobfJar.mustRunAfter(tasks.compileJava) + tasks.configureReobfTaskForReobfJarJar.mustRunAfter(tasks.compileJava) +} + mixin { add sourceSets.main, "${mod_id}.refmap.json" config "${mod_id}.mixins.json" @@ -93,6 +59,16 @@ tasks.withType(JavaCompile) { source(project(":Common").sourceSets.main.allSource) } +// Merge the resources and classes into the same directory. +// This is done because java expects modules to be in a single directory. +// And if we have it in multiple we have to do performance intensive hacks like having the UnionFileSystem +// This will eventually be migrated to ForgeGradle so modders don't need to manually do it. But that is later. +sourceSets.each { + def dir = layout.buildDirectory.dir("sourcesSets/$it.name") + it.output.resourcesDir = dir + it.java.destinationDirectory = dir +} + processResources { from project(":Common").sourceSets.main.resources @@ -103,12 +79,8 @@ processResources { jar.finalizedBy('reobfJar') -def changelog_file = rootProject.file("build/TerraBlender-${version}-changelog.txt") - curseforge { - if (project.hasProperty('curseApiKey')) { - apiKey = project.getProperty('curseApiKey') - } + apiKey = project.findProperty('curseApiKey') ?: 'unset' project { id = '563928' @@ -126,22 +98,18 @@ curseforge { } modrinth { - if (project.hasProperty('modrinthToken')) { - token = project.getProperty('modrinthToken') - } + token = project.findProperty('modrinthToken') projectId = "terrablender" - versionNumber = mod_build_version - versionName = mod_build_version + " for Forge " + minecraft_version + versionNumber = mod_version + versionName = mod_version + " for Forge " + minecraft_version versionType = release_channel // can be release, beta, or alpha uploadFile = jar - gameVersions = [ minecraft_version ] - loaders = [ 'forge' ] + gameVersions = [minecraft_version] + loaders = ['forge'] if (changelog_file.exists()) { - def changelog_text = changelog_file.text - changelog = "```\n" + changelog_text.substring(0, changelog_text.indexOf("=========")).replace("\t", " ") + "```" + changelog = trimChangelog(changelog_file.text) } - // debugMode = true } publishing { @@ -183,14 +151,11 @@ publishing { } repositories { maven { - url "https://maven.minecraftforge.net/releases/" - authentication { - basic(BasicAuthentication) - } + url = "https://maven.minecraftforge.net/releases/" credentials { - username = System.env.MAVEN_USER ?:'fake' - password = System.env.MAVEN_PASSWORD ?:'news' + username = System.getenv("MAVEN_USER") + password = System.getenv("MAVEN_PASSWORD") } } } -} +} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 4adcbd7..cf8f86f 100644 --- a/build.gradle +++ b/build.gradle @@ -1,32 +1,51 @@ -version = "${minecraft_version}-${mod_version}.${System.getenv().BUILD_NUMBER}" +plugins { + // Used for changelog generation + id 'net.minecraftforge.gradleutils' version '2.2.0' +} + +changelog { + fromTag '3.0.1' +} + +ext { + mod_version = gradleutils.getTagOffsetVersion() + changelog_file = rootProject.file("build/changelog.txt") + trimChangelog = (String text) -> { + def m = text =~ /(?s) - (?:[0-9.]+) (.+?)(?=( - )|$)/ + return '```\n' + m[0][1].replaceAll(/(?m)^ */, '') + } +} + +version = "${minecraft_version}-${mod_version}" subprojects { apply plugin: 'java' - + apply plugin: 'idea' + apply plugin: 'maven-publish' + java.toolchain.languageVersion = JavaLanguageVersion.of(17) java.withSourcesJar() java.withJavadocJar() version = rootProject.version - def mod_build_version = "${mod_version}.${System.getenv().BUILD_NUMBER}" jar { manifest { attributes([ - 'Specification-Title' : mod_name, - 'Specification-Vendor' : mod_author, - 'Specification-Version' : mod_build_version, - 'Implementation-Title' : project.name, - 'Implementation-Version' : mod_build_version, - 'Implementation-Vendor' : mod_author, - 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), - 'Timestampe' : System.currentTimeMillis(), - 'Built-On-Java' : "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})", - 'Build-On-Minecraft' : minecraft_version + 'Specification-Title' : mod_name, + 'Specification-Vendor' : mod_author, + 'Specification-Version' : mod_version, + 'Implementation-Title' : project.name, + 'Implementation-Version' : mod_version, + 'Implementation-Vendor' : mod_author, + 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), + 'Timestamp' : System.currentTimeMillis(), + 'Built-On-Java' : "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})", + 'Build-On-Minecraft' : minecraft_version ]) } } - + repositories { mavenCentral() maven { @@ -37,7 +56,7 @@ subprojects { tasks.withType(JavaCompile).configureEach { it.options.encoding = 'UTF-8' - it.options.release = 17 + it.options.release.set(17) } // Disables Gradle's custom module metadata from being published to maven. The diff --git a/gradle.properties b/gradle.properties index 1e7511d..7037e97 100644 --- a/gradle.properties +++ b/gradle.properties @@ -27,4 +27,4 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false # Dependencies -nightconfig_version=3.6.4 +nightconfig_version=3.6.7 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180..d64cd49 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 ae04661..1af9e09 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index c53aefa..1aa94a4 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -32,10 +32,10 @@ # Busybox and similar reduced shells will NOT work, because this script # requires all of these POSIX shell features: # * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». # # Important for patching: # @@ -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,11 @@ 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"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,22 +131,29 @@ 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. 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=SC2039,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=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then done fi -# 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 -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# 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, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ @@ -205,6 +214,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index 107acd3..93e3f59 100755 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/settings.gradle b/settings.gradle index 20bf1fe..a7052d9 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,16 +1,18 @@ -pluginManagement { - repositories { - gradlePluginPortal() - maven { - name = 'Fabric' - url = 'https://maven.fabricmc.net/' - } - maven { - name = 'Sponge Snapshots' - url = 'https://repo.spongepowered.org/repository/maven-public/' - } +pluginManagement.repositories { + gradlePluginPortal() + maven { + name = "Fabric" + url = "https://maven.fabricmc.net/" + } + maven { + name = "Forge" + url = "https://maven.minecraftforge.net" + } + maven { + name = "Sponge Snapshots" + url = "https://repo.spongepowered.org/repository/maven-public/" } } -rootProject.name = 'TerraBlender' +rootProject.name = "TerraBlender" include("Common", "Fabric", "Forge") \ No newline at end of file