diff options
-rwxr-xr-x | .github/scripts/test_no_error_reports | 51 | ||||
-rw-r--r-- | build.gradle | 185 | ||||
-rw-r--r-- | dependencies.gradle | 37 | ||||
-rw-r--r-- | gradle/wrapper/gradle-wrapper.jar | bin | 61608 -> 62076 bytes | |||
-rw-r--r-- | gradle/wrapper/gradle-wrapper.properties | 2 | ||||
-rwxr-xr-x | gradlew | 7 | ||||
-rw-r--r-- | repositories.gradle | 19 | ||||
-rw-r--r-- | src/main/java/com/elisis/gtnhlanth/loader/RecipeLoader.java | 33 |
8 files changed, 138 insertions, 196 deletions
diff --git a/.github/scripts/test_no_error_reports b/.github/scripts/test_no_error_reports deleted file mode 100755 index 1fcc7396c6..0000000000 --- a/.github/scripts/test_no_error_reports +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env bash - -# bashsupport disable=BP5006 # Global environment variables -RUNDIR="run" \ - CRASH="crash-reports" \ - SERVERLOG="server.log" - -# enable nullglob to get 0 results when no match rather than the pattern -shopt -s nullglob - -# store matches in array -crash_reports=("$RUNDIR/$CRASH/crash"*.txt) - -# if array not empty there are crash_reports -if [ "${#crash_reports[@]}" -gt 0 ]; then - # get the latest crash_report from array - latest_crash_report="${crash_reports[-1]}" - { - printf 'Latest crash report detected %s:\n' "${latest_crash_report##*/}" - cat "$latest_crash_report" - } >&2 - exit 1 -fi - -if grep --quiet --fixed-strings 'Fatal errors were detected' "$SERVERLOG"; then - { - printf 'Fatal errors detected:\n' - cat server.log - } >&2 - exit 1 -fi - -if grep --quiet --fixed-strings 'The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED' \ - "$SERVERLOG"; then - { - printf 'Server force stopped:' - cat server.log - } >&2 - exit 1 -fi - -if ! grep --quiet --perl-regexp --only-matching '.+Done \(.+\)\! For help, type "help" or "\?"' "$SERVERLOG"; then - { - printf 'Server did not finish startup:' - cat server.log - } >&2 - exit 1 -fi - -printf 'No crash reports detected' -exit 0 diff --git a/build.gradle b/build.gradle index 3930990407..1aaadcce85 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1685785062 +//version: 1690104383 /* DO NOT CHANGE THIS FILE! Also, you may replace this file at any time if there is an update available. @@ -69,7 +69,7 @@ plugins { id 'com.diffplug.spotless' version '6.13.0' apply false // 6.13.0 is the last jvm8 supporting version id 'com.modrinth.minotaur' version '2.+' apply false id 'com.matthewprenger.cursegradle' version '1.4.0' apply false - id 'com.gtnewhorizons.retrofuturagradle' version '1.3.14' + id 'com.gtnewhorizons.retrofuturagradle' version '1.3.21' } print("You might want to check out './gradlew :faq' if your build fails.\n") @@ -115,6 +115,8 @@ propertyDefaultIfUnset("usesMixinDebug", project.usesMixins) propertyDefaultIfUnset("forceEnableMixins", false) propertyDefaultIfUnset("channel", "stable") propertyDefaultIfUnset("mappingsVersion", "12") +propertyDefaultIfUnset("usesMavenPublishing", true) +propertyDefaultIfUnset("mavenPublishUrl", "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases") propertyDefaultIfUnset("modrinthProjectId", "") propertyDefaultIfUnset("modrinthRelations", "") propertyDefaultIfUnset("curseForgeProjectId", "") @@ -357,7 +359,27 @@ catch (Exception ignored) { String identifiedVersion String versionOverride = System.getenv("VERSION") ?: null try { - identifiedVersion = versionOverride == null ? gitVersion() : versionOverride + // Produce a version based on the tag, or for branches something like 0.2.2-configurable-maven-and-extras.38+43090270b6-dirty + if (versionOverride == null) { + def gitDetails = versionDetails() + def isDirty = gitVersion().endsWith(".dirty") // No public API for this, isCleanTag has a different meaning + String branchName = gitDetails.branchName ?: (System.getenv('GIT_BRANCH') ?: 'git') + if (branchName.startsWith('origin/')) { + branchName = branchName.minus('origin/') + } + branchName = branchName.replaceAll("[^a-zA-Z0-9-]+", "-") // sanitize branch names for semver + identifiedVersion = gitDetails.lastTag ?: '${gitDetails.gitHash}' + if (gitDetails.commitDistance > 0) { + identifiedVersion += "-${branchName}.${gitDetails.commitDistance}+${gitDetails.gitHash}" + if (isDirty) { + identifiedVersion += "-dirty" + } + } else if (isDirty) { + identifiedVersion += "-${branchName}+${gitDetails.gitHash}-dirty" + } + } else { + identifiedVersion = versionOverride + } } catch (Exception ignored) { out.style(Style.Failure).text( @@ -465,10 +487,19 @@ sourceSets { } } -if (file('addon.gradle').exists()) { +if (file('addon.gradle.kts').exists()) { + apply from: 'addon.gradle.kts' +} else if (file('addon.gradle').exists()) { apply from: 'addon.gradle' } +// File for local tweaks not commited to Git +if (file('addon.local.gradle.kts').exists()) { + apply from: 'addon.local.gradle.kts' +} else if (file('addon.local.gradle').exists()) { + apply from: 'addon.local.gradle' +} + // Allow unsafe repos but warn repositories.configureEach { repo -> if (repo instanceof org.gradle.api.artifacts.repositories.UrlArtifactRepository) { @@ -479,7 +510,14 @@ repositories.configureEach { repo -> } } -apply from: 'repositories.gradle' +if (file('repositories.gradle.kts').exists()) { + apply from: 'repositories.gradle.kts' +} else if (file('repositories.gradle').exists()) { + apply from: 'repositories.gradle' +} else { + logger.error("Neither repositories.gradle.kts nor repositories.gradle was found, make sure you extracted the full ExampleMod template.") + throw new RuntimeException("Missing repositories.gradle[.kts]") +} configurations { runtimeClasspath.extendsFrom(runtimeOnlyNonPublishable) @@ -537,13 +575,28 @@ repositories { } } if (includeWellKnownRepositories.toBoolean()) { - maven { - name "CurseMaven" - url "https://cursemaven.com" - content { + exclusiveContent { + forRepository { + maven { + name "CurseMaven" + url "https://cursemaven.com" + } + } + filter { includeGroup "curse.maven" } } + exclusiveContent { + forRepository { + maven { + name = "Modrinth" + url = "https://api.modrinth.com/maven" + } + } + filter { + includeGroup "maven.modrinth" + } + } maven { name = "ic2" url = "https://maven.ic2.player.to/" @@ -585,7 +638,7 @@ dependencies { } } if (usesMixins.toBoolean()) { - implementation(mixinProviderSpec) + implementation(modUtils.enableMixins(mixinProviderSpec)) } else if (forceEnableMixins.toBoolean()) { runtimeOnlyNonPublishable(mixinProviderSpec) } @@ -611,12 +664,34 @@ configurations.all { } } -apply from: 'dependencies.gradle' +dependencies { + constraints { + def minGtnhLibVersion = "0.0.13" + implementation("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") { + because("fixes duplicate mod errors in java 17 configurations using old gtnhlib") + } + runtimeOnly("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") { + because("fixes duplicate mod errors in java 17 configurations using old gtnhlib") + } + devOnlyNonPublishable("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") { + because("fixes duplicate mod errors in java 17 configurations using old gtnhlib") + } + runtimeOnlyNonPublishable("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") { + because("fixes duplicate mod errors in java 17 configurations using old gtnhlib") + } + } +} + +if (file('dependencies.gradle.kts').exists()) { + apply from: 'dependencies.gradle.kts' +} else if (file('dependencies.gradle').exists()) { + apply from: 'dependencies.gradle' +} else { + logger.error("Neither dependencies.gradle.kts nor dependencies.gradle was found, make sure you extracted the full ExampleMod template.") + throw new RuntimeException("Missing dependencies.gradle[.kts]") +} def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json' -def mixinTmpDir = buildDir.path + File.separator + 'tmp' + File.separator + 'mixins' -def refMap = "${mixinTmpDir}" + File.separator + mixingConfigRefMap -def mixinSrg = "${mixinTmpDir}" + File.separator + "mixins.srg" tasks.register('generateAssets') { group = "GTNH Buildscript" @@ -648,46 +723,17 @@ tasks.register('generateAssets') { } if (usesMixins.toBoolean()) { - tasks.named("reobfJar", ReobfuscatedJar).configure { - extraSrgFiles.from(mixinSrg) - } - tasks.named("processResources").configure { dependsOn("generateAssets") } tasks.named("compileJava", JavaCompile).configure { - doFirst { - new File(mixinTmpDir).mkdirs() - } options.compilerArgs += [ - "-AreobfSrgFile=${tasks.reobfJar.srg.get().asFile}", - "-AoutSrgFile=${mixinSrg}", - "-AoutRefMapFile=${refMap}", // Elan: from what I understand they are just some linter configs so you get some warning on how to properly code "-XDenableSunApiLintControl", "-XDignore.symbol.file" ] } - - pluginManager.withPlugin('org.jetbrains.kotlin.kapt') { - kapt { - correctErrorTypes = true - javacOptions { - option("-AreobfSrgFile=${tasks.reobfJar.srg.get().asFile}") - option("-AoutSrgFile=$mixinSrg") - option("-AoutRefMapFile=$refMap") - } - } - tasks.configureEach { task -> - if (task.name == "kaptKotlin") { - task.doFirst { - new File(mixinTmpDir).mkdirs() - } - } - } - } - } tasks.named("processResources", ProcessResources).configure { @@ -705,7 +751,6 @@ tasks.named("processResources", ProcessResources).configure { } if (usesMixins.toBoolean()) { - from refMap dependsOn("compileJava", "compileScala") } } @@ -724,13 +769,13 @@ ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies" } dependencies { - def lwjgl3ifyVersion = '1.3.5' + def lwjgl3ifyVersion = '1.4.0' def asmVersion = '9.4' if (modId != 'lwjgl3ify') { java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}") } if (modId != 'hodgepodge') { - java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.2.13') + java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.2.19') } java17PatchDependencies('net.minecraft:launchwrapper:1.15') {transitive = false} @@ -979,6 +1024,9 @@ idea { } } runConfigurations { + "0. Build and Test"(Gradle) { + taskNames = ["build"] + } "1. Run Client"(Gradle) { taskNames = ["runClient"] } @@ -1098,6 +1146,11 @@ tasks.named("processIdeaSettings").configure { dependsOn("injectTags") } +tasks.named("ideVirtualMainClasses").configure { + // Make IntelliJ "Build project" build the mod jars + dependsOn("jar", "reobfJar", "spotlessCheck") +} + // workaround variable hiding in pom processing def projectConfigs = project.configurations @@ -1118,12 +1171,14 @@ publishing { } repositories { - maven { - url = "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases" - allowInsecureProtocol = true - credentials { - username = System.getenv("MAVEN_USER") ?: "NONE" - password = System.getenv("MAVEN_PASSWORD") ?: "NONE" + if (usesMavenPublishing.toBoolean()) { + maven { + url = mavenPublishUrl + allowInsecureProtocol = mavenPublishUrl.startsWith("http://") // Mostly for the GTNH maven + credentials { + username = System.getenv("MAVEN_USER") ?: "NONE" + password = System.getenv("MAVEN_PASSWORD") ?: "NONE" + } } } } @@ -1238,7 +1293,7 @@ def addCurseForgeRelation(String type, String name) { // Updating -def buildscriptGradleVersion = "8.1.1" +def buildscriptGradleVersion = "8.2.1" tasks.named('wrapper', Wrapper).configure { gradleVersion = buildscriptGradleVersion @@ -1344,8 +1399,14 @@ boolean isNewBuildScriptVersionAvailable() { String currentBuildScript = getFile("build.gradle").getText() String currentBuildScriptHash = getVersionHash(currentBuildScript) - String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText() - String availableBuildScriptHash = getVersionHash(availableBuildScript) + String availableBuildScriptHash + try { + String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText() + availableBuildScriptHash = getVersionHash(availableBuildScript) + } catch (IOException e) { + logger.warn("Could not check for buildscript update availability: {}", e.message) + return false + } boolean isUpToDate = currentBuildScriptHash.empty || availableBuildScriptHash.empty || currentBuildScriptHash == availableBuildScriptHash return !isUpToDate @@ -1510,3 +1571,17 @@ def getSecondaryArtifacts() { if (apiPackage) secondaryArtifacts += [apiJar] return secondaryArtifacts } + +// For easier scripting of things that require variables defined earlier in the buildscript +if (file('addon.late.gradle.kts').exists()) { + apply from: 'addon.late.gradle.kts' +} else if (file('addon.late.gradle').exists()) { + apply from: 'addon.late.gradle' +} + +// File for local tweaks not commited to Git +if (file('addon.late.local.gradle.kts').exists()) { + apply from: 'addon.late.local.gradle.kts' +} else if (file('addon.late.local.gradle').exists()) { + apply from: 'addon.late.local.gradle' +} diff --git a/dependencies.gradle b/dependencies.gradle index f523fa1a16..ba82fdf142 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,38 +1,7 @@ // Add your dependencies here dependencies { - compile('com.github.GTNewHorizons:GT5-Unofficial:5.09.43.73:dev') - compile('com.github.GTNewHorizons:NewHorizonsCoreMod:2.1.45:dev') - compile('com.github.GTNewHorizons:StructureLib:1.2.7:dev') - compile('com.github.GTNewHorizons:GTplusplus:1.9.33:dev') - compile('com.github.GTNewHorizons:GoodGenerator:0.6.9:dev') - compile('com.github.GTNewHorizons:TecTech:5.2.21:dev') - compile('com.github.GTNewHorizons:ForestryMC:4.6.7:dev') - compile('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-217-GTNH:dev') - compile('com.github.GTNewHorizons:bartworks:0.7.16:dev') - compile('com.github.GTNewHorizons:BuildCraft:7.1.33:dev') - compile('com.github.GTNewHorizons:NotEnoughItems:2.3.54-GTNH:dev') - - compile('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev') - - compileOnly('com.github.GTNewHorizons:EnderCore:0.2.14:dev') {transitive=false} - compileOnly('com.github.GTNewHorizons:AppleCore:3.2.10:dev') {transitive = false} - compileOnly('com.github.GTNewHorizons:Railcraft:9.14.3:dev') {transitive = false} - compileOnly('com.github.GTNewHorizons:EnderIO:2.4.18:dev') {transitive=false} - compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.34:dev') {transitive=false} - - compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev') {transitive=false} - - //compile('com.github.GTNewHorizons:GalacticGregGT5:1.0.9:dev') - //compile('com.github.GTNewHorizons:TecTech:5.2.21:dev') - //compile('com.github.GTNewHorizons:Galacticraft:3.0.68-GTNH:dev') - - //compileOnly('com.github.GTNewHorizons:Avaritia:1.42 - - //compile files('ThaumicTinkerer-1.7.10-2.7-0-dev.jar') - - //runtimeOnly('com.github.GTNewHorizons:Baubles:1.0.1.16:dev') - //runtimeOnly('com.github.GTNewHorizons:Yamcl:0.5.86:dev') - runtimeOnly('curse.maven:cofh-core-69162:2388751') //for GT++ - runtimeOnly('curse.maven:advsolar-362768:2885953') //for GT++ + api('com.github.GTNewHorizons:GT5-Unofficial:5.09.43.151:dev') + implementation('com.github.GTNewHorizons:GTplusplus:1.9.67:dev') + implementation('com.github.GTNewHorizons:GoodGenerator:0.6.27:dev') } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar Binary files differindex ccebba7710..c1962a79e2 100644 --- a/gradle/wrapper/gradle-wrapper.jar +++ b/gradle/wrapper/gradle-wrapper.jar diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 37aef8d3f0..17a8ddce2d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists @@ -85,9 +85,6 @@ done APP_BASE_NAME=${0##*/} APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit -# 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"' - # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -197,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/repositories.gradle b/repositories.gradle index 800e92f372..c227b16ec2 100644 --- a/repositories.gradle +++ b/repositories.gradle @@ -1,23 +1,4 @@ // Add any additional repositories for your dependencies here repositories { - maven { - name 'GTNH Maven' - url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/' - allowInsecureProtocol - } - maven { - name 'ic2' - url 'https://maven.ic2.player.to/' - metadataSources { - mavenPom() - artifact() - } - } - maven { - url 'https://cursemaven.com' - content { - includeGroup 'curse.maven' - } - } } diff --git a/src/main/java/com/elisis/gtnhlanth/loader/RecipeLoader.java b/src/main/java/com/elisis/gtnhlanth/loader/RecipeLoader.java index f21b23b738..67dbbc3fbe 100644 --- a/src/main/java/com/elisis/gtnhlanth/loader/RecipeLoader.java +++ b/src/main/java/com/elisis/gtnhlanth/loader/RecipeLoader.java @@ -1619,39 +1619,6 @@ public class RecipeLoader { GT_Log.out.print("Chemical Bath done!\n"); - // For ByProduct List - for (GT_Recipe recipe : GT_Recipe.GT_Recipe_Map.sByProductList.mRecipeList) { - ItemStack input = recipe.mInputs[0]; - if (GT_Utility.isStackValid(input)) { - int[] oreDict = OreDictionary.getOreIDs(input); - for (int oreDictID : oreDict) { - if (OreDictionary.getOreName(oreDictID).startsWith("ore") - && OreDictionary.getOreName(oreDictID).contains("Cerium")) { - GT_Recipe tRecipe = recipe.copy(); - for (int i = 0; i < tRecipe.mOutputs.length; i++) { - if (!GT_Utility.isStackValid(tRecipe.mOutputs[i])) continue; - if (tRecipe.mOutputs[i].isItemEqual(Materials.Cerium.getDust(1))) { - remove.add(tRecipe); - } else if (tRecipe.mOutputs[i].isItemEqual(Materials.Samarium.getDust(1))) { - remove.add(tRecipe); - } - } - break; - } - } - } - } - GT_Recipe.GT_Recipe_Map.sByProductList.mRecipeList.removeAll(remove); - GT_Recipe.GT_Recipe_Map.sByProductList.mRecipeList.addAll(reAdd); - GT_Recipe.GT_Recipe_Map.sByProductList.reInit(); - - GT_Log.out.print(Tags.MODID + ": Replace " + remove.size() + "! "); - - remove.clear(); - reAdd.clear(); - - GT_Log.out.print("ByProduct List done!\n"); - // For Cauldron Wash registerCauldronCleaningFor(Materials.Cerium, WerkstoffMaterialPool.CeriumRichMixture.getBridgeMaterial()); registerCauldronCleaningFor( |