Compare commits

..
1 Commits
Author SHA1 Message Date
Raven Szewczyk 581d497c9b Only use GTNH CT APIs when GTNH CraftTweaker is present (#46)
* Update buildscript&dependencies

* Only use GTNH CT APIs when GTNH CraftTweaker is present

* Clean up post-rfg migration

* Add warning to the log
2023-07-04 22:11:37 +01:00
7 changed files with 85 additions and 56 deletions

No files matched your search

-27
View File
@@ -1,27 +0,0 @@
if [[ -d "run/crash-reports" ]]; then
echo "Crash reports detected:"
cat $directory/*
exit 1
fi
if grep --quiet "Fatal errors were detected" server.log; then
echo "Fatal errors detected:"
cat server.log
exit 1
fi
if grep --quiet "The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED" server.log; then
echo "Server force stopped:"
cat server.log
exit 1
fi
if grep --quiet 'Done .+ For help, type "help" or "?"' server.log; then
echo "Server didn't finish startup:"
cat server.log
exit 1
fi
echo "No crash reports detected"
exit 0
+39 -4
View File
@@ -1,4 +1,4 @@
//version: 1682616243 //version: 1685785062
/* /*
DO NOT CHANGE THIS FILE! DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available. Also, you may replace this file at any time if there is an update available.
@@ -69,8 +69,11 @@ plugins {
id 'com.diffplug.spotless' version '6.13.0' apply false // 6.13.0 is the last jvm8 supporting version 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.modrinth.minotaur' version '2.+' apply false
id 'com.matthewprenger.cursegradle' version '1.4.0' apply false id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.7' id 'com.gtnewhorizons.retrofuturagradle' version '1.3.14'
} }
print("You might want to check out './gradlew :faq' if your build fails.\n")
boolean settingsupdated = verifySettingsGradle() boolean settingsupdated = verifySettingsGradle()
settingsupdated = verifyGitAttributes() || settingsupdated settingsupdated = verifyGitAttributes() || settingsupdated
if (settingsupdated) if (settingsupdated)
@@ -219,6 +222,8 @@ if (enableModernJavaSyntax.toBoolean()) {
dependencies { dependencies {
annotationProcessor 'com.github.bsideup.jabel:jabel-javac-plugin:1.0.0' annotationProcessor 'com.github.bsideup.jabel:jabel-javac-plugin:1.0.0'
// workaround for https://github.com/bsideup/jabel/issues/174
annotationProcessor 'net.java.dev.jna:jna-platform:5.13.0'
compileOnly('com.github.bsideup.jabel:jabel-javac-plugin:1.0.0') { compileOnly('com.github.bsideup.jabel:jabel-javac-plugin:1.0.0') {
transitive = false // We only care about the 1 annotation class transitive = false // We only care about the 1 annotation class
} }
@@ -564,9 +569,10 @@ repositories {
def mixinProviderGroup = "io.github.legacymoddingmc" def mixinProviderGroup = "io.github.legacymoddingmc"
def mixinProviderModule = "unimixins" def mixinProviderModule = "unimixins"
def mixinProviderVersion = "0.1.6" def mixinProviderVersion = "0.1.7.1"
def mixinProviderSpecNoClassifer = "${mixinProviderGroup}:${mixinProviderModule}:${mixinProviderVersion}" def mixinProviderSpecNoClassifer = "${mixinProviderGroup}:${mixinProviderModule}:${mixinProviderVersion}"
def mixinProviderSpec = "${mixinProviderSpecNoClassifer}:dev" def mixinProviderSpec = "${mixinProviderSpecNoClassifer}:dev"
ext.mixinProviderSpec = mixinProviderSpec
dependencies { dependencies {
if (usesMixins.toBoolean()) { if (usesMixins.toBoolean()) {
@@ -724,7 +730,7 @@ dependencies {
java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}") java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}")
} }
if (modId != 'hodgepodge') { if (modId != 'hodgepodge') {
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.2.8') java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.2.13')
} }
java17PatchDependencies('net.minecraft:launchwrapper:1.15') {transitive = false} java17PatchDependencies('net.minecraft:launchwrapper:1.15') {transitive = false}
@@ -817,6 +823,18 @@ public abstract class RunHotswappableMinecraftTask extends RunMinecraftTask {
} }
this.classpath(project.java17DependenciesCfg) this.classpath(project.java17DependenciesCfg)
} }
public void setup(Project project) {
super.setup(project)
if (project.usesMixins.toBoolean()) {
this.extraJvmArgs.addAll(project.provider(() -> {
def mixinCfg = project.configurations.detachedConfiguration(project.dependencies.create(project.mixinProviderSpec))
mixinCfg.canBeConsumed = false
mixinCfg.transitive = false
enableHotswap ? ["-javaagent:" + mixinCfg.singleFile.absolutePath] : []
}))
}
}
} }
def runClient17Task = tasks.register("runClient17", RunHotswappableMinecraftTask, Distribution.CLIENT, "runClient") def runClient17Task = tasks.register("runClient17", RunHotswappableMinecraftTask, Distribution.CLIENT, "runClient")
@@ -1252,6 +1270,23 @@ if (!project.getGradle().startParameter.isOffline() && !Boolean.getBoolean('DISA
} }
} }
// If you want to add more cases to this task, implement them as arguments if total amount to print gets too large
tasks.register('faq') {
group = 'GTNH Buildscript'
description = 'Prints frequently asked questions about building a project'
doLast {
print("If your build fails to fetch dependencies, run './gradlew updateDependencies'. " +
"Or you can manually check if the versions are still on the distributing sites - " +
"the links can be found in repositories.gradle and build.gradle:repositories, " +
"but not build.gradle:buildscript.repositories - those ones are for gradle plugin metadata.\n\n" +
"If your build fails to recognize the syntax of new Java versions, enable Jabel in your " +
"gradle.properties. See how it's done in GTNH ExampleMod/gradle.properties. " +
"However, keep in mind that Jabel enables only syntax features, but not APIs that were introduced in " +
"Java 9 or later.")
}
}
static URL availableBuildScriptUrl() { static URL availableBuildScriptUrl() {
new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/master/build.gradle") new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/master/build.gradle")
} }
+8 -9
View File
@@ -23,20 +23,19 @@
*/ */
dependencies { dependencies {
api("com.github.GTNewHorizons:waila:1.5.24:dev") api("com.github.GTNewHorizons:waila:1.6.0:dev")
api("com.github.GTNewHorizons:CodeChickenLib:1.1.8:dev") api("com.github.GTNewHorizons:NotEnoughItems:2.3.63-GTNH:dev")
api("com.github.GTNewHorizons:NotEnoughItems:2.3.43-GTNH:dev")
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.42.51:dev") {transitive = false } compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.43.111:dev") {transitive = false }
compileOnly("com.github.GTNewHorizons:Botania:1.9.16-GTNH:api") {transitive = false } compileOnly("com.github.GTNewHorizons:Botania:1.9.23-GTNH:api") {transitive = false }
compileOnly("com.github.GTNewHorizons:ForestryMC:4.6.5:api") {transitive = false } compileOnly("com.github.GTNewHorizons:ForestryMC:4.6.10:api") {transitive = false }
compileOnly("com.github.GTNewHorizons:ForgeMultipart:1.3.2:dev") {transitive = false } compileOnly("com.github.GTNewHorizons:ForgeMultipart:1.3.4:dev") {transitive = false }
compileOnly("com.github.GTNewHorizons:Chisel:2.10.17-GTNH:api") {transitive = false } compileOnly("com.github.GTNewHorizons:Chisel:2.11.3-GTNH:api") {transitive = false }
compileOnly("com.github.GTNewHorizons:ZenScript:1.0.0-GTNH") {transitive = false } compileOnly("com.github.GTNewHorizons:ZenScript:1.0.0-GTNH") {transitive = false }
compileOnly("com.github.GTNewHorizons:CraftTweaker:3.2.11:dev") {transitive = false } compileOnly("com.github.GTNewHorizons:CraftTweaker:3.2.12:dev") {transitive = false }
compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") {transitive = false } compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") {transitive = false }
compileOnly("curse.maven:guide-api-228832:2287185") {transitive = false } compileOnly("curse.maven:guide-api-228832:2287185") {transitive = false }
+11 -7
View File
@@ -21,16 +21,20 @@ forgeVersion = 10.13.4.1614
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty # Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
developmentEnvironmentUserName = "Developer" developmentEnvironmentUserName = "Developer"
# Define a source file of your project with:
# public static final String VERSION = "GRADLETOKEN_VERSION"; # Generate a class with String fields for the mod id, name, version and group name named with the fields below
# The string's content will be replaced with your mods version when compiled. You should use this to specify your mod's generateGradleTokenClass =WayofTime.alchemicalWizardry.Tags
# version in @Mod([...], version = VERSION, [...])
# Leave these properties empty to skip individual token replacements
replaceGradleTokenInFile = AlchemicalWizardry.java
gradleTokenModId = gradleTokenModId =
gradleTokenModName = gradleTokenModName =
gradleTokenVersion = GRADLETOKEN_VERSION gradleTokenVersion = VERSION
gradleTokenGroupName = gradleTokenGroupName =
# [DEPRECATED]
# Multiple source files can be defined here by providing a comma-seperated list: Class1.java,Class2.java,Class3.java
# public static final String VERSION = "GRADLETOKEN_VERSION";
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
# version in @Mod([...], version = VERSION, [...])
# Leave these properties empty to skip individual token replacements
replaceGradleTokenInFile =
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise you can # In case your mod provides an API for other mods to implement you may declare its package here. Otherwise you can
# leave this property empty. # leave this property empty.
-7
View File
@@ -1,11 +1,4 @@
// Add any additional repositories for your dependencies here // Add any additional repositories for your dependencies here
repositories { repositories {
maven {
name = "GTNH Maven"
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
}
maven {
url "https://cursemaven.com"
}
} }
@@ -300,7 +300,7 @@ import thaumcraft.api.aspects.AspectList;
@Mod( @Mod(
modid = "AWWayofTime", modid = "AWWayofTime",
name = "AlchemicalWizardry", name = "AlchemicalWizardry",
version = "GRADLETOKEN_VERSION", version = Tags.VERSION,
dependencies = "after:CodeChickenLib@[1.1.5.7,);" + "after:NotEnoughItems@[2.3.20-GTNH,)", dependencies = "after:CodeChickenLib@[1.1.5.7,);" + "after:NotEnoughItems@[2.3.20-GTNH,)",
guiFactory = "WayofTime.alchemicalWizardry.client.gui.ConfigGuiFactory") guiFactory = "WayofTime.alchemicalWizardry.client.gui.ConfigGuiFactory")
public class AlchemicalWizardry { public class AlchemicalWizardry {
@@ -1,7 +1,13 @@
package WayofTime.alchemicalWizardry.common.tweaker; package WayofTime.alchemicalWizardry.common.tweaker;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.versioning.ArtifactVersion;
import cpw.mods.fml.common.versioning.InvalidVersionSpecificationException;
import cpw.mods.fml.common.versioning.VersionRange;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.MineTweakerImplementationAPI; import minetweaker.MineTweakerImplementationAPI;
import minetweaker.mc1710.MineTweakerMod;
import minetweaker.util.IEventHandler; import minetweaker.util.IEventHandler;
/** /**
@@ -17,8 +23,27 @@ public class MineTweakerIntegration {
MineTweakerAPI.registerClass(FallingTower.class); MineTweakerAPI.registerClass(FallingTower.class);
MineTweakerAPI.registerClass(HarvestMoon.class); MineTweakerAPI.registerClass(HarvestMoon.class);
MineTweakerImplementationAPI.onRollbackEvent(new HandleLateAdditionsAndRemovals());
MineTweakerImplementationAPI.onPostReload(new HandleLateAdditionsAndRemovals()); MineTweakerImplementationAPI.onPostReload(new HandleLateAdditionsAndRemovals());
// GTNH-Only features (post 3.1.0)
final ArtifactVersion mtVersion = Loader.instance().getIndexedModList().get(MineTweakerMod.MODID)
.getProcessedVersion();
try {
if (VersionRange.createFromVersionSpec("[3.2.4,)").containsVersion(mtVersion)) {
GTNHIntegration.register();
} else {
AlchemicalWizardry.logger.warn(
"Non-GTNH MineTweaker (CraftTweaker) version detected, late recipe additions and removals won't work correctly");
}
} catch (InvalidVersionSpecificationException e) {
throw new RuntimeException(e);
}
}
public static class GTNHIntegration {
public static void register() {
MineTweakerImplementationAPI.onRollbackEvent(new HandleLateAdditionsAndRemovals());
}
} }
public static class HandleLateAdditionsAndRemovals public static class HandleLateAdditionsAndRemovals