diff --git a/build.gradle b/build.gradle index d54c719..b5a70b0 100644 --- a/build.gradle +++ b/build.gradle @@ -68,7 +68,7 @@ plugins { id 'com.diffplug.spotless' version '6.7.2' apply false id 'com.modrinth.minotaur' version '2.+' apply false id 'com.matthewprenger.cursegradle' version '1.4.0' apply false - id 'com.gtnewhorizons.retrofuturagradle' version '1.0.9' + id 'com.gtnewhorizons.retrofuturagradle' version '1.0.9-1-g25eba7e' } boolean settingsupdated = verifySettingsGradle() settingsupdated = verifyGitAttributes() || settingsupdated @@ -111,6 +111,7 @@ checkPropertyExists("containsMixinsAndOrCoreModOnly") checkPropertyExists("usesShadowedDependencies") checkPropertyExists("developmentEnvironmentUserName") +propertyDefaultIfUnset("generateGradleTokenClass", "") propertyDefaultIfUnset("includeWellKnownRepositories", true) propertyDefaultIfUnset("noPublishedSources", false) propertyDefaultIfUnset("usesMixinDebug", project.usesMixins) @@ -330,18 +331,18 @@ minecraft { for (f in replaceGradleTokenInFile.split(',')) { tagReplacementFiles.add f } - if (gradleTokenModId) { - injectedTags.put gradleTokenModId, modId - } - if (gradleTokenModName) { - injectedTags.put gradleTokenModName, modName - } - if (gradleTokenVersion) { - injectedTags.put gradleTokenVersion, modVersion - } - if (gradleTokenGroupName) { - injectedTags.put gradleTokenGroupName, modGroup - } + } + if (gradleTokenModId) { + injectedTags.put gradleTokenModId, modId + } + if (gradleTokenModName) { + injectedTags.put gradleTokenModName, modName + } + if (gradleTokenVersion) { + injectedTags.put gradleTokenVersion, modVersion + } + if (gradleTokenGroupName) { + injectedTags.put gradleTokenGroupName, modGroup } if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { @@ -361,6 +362,10 @@ minecraft { groupsToExcludeFromAutoReobfMapping.addAll(["com.diffplug", "com.diffplug.durian", "net.industrial-craft"]) } +if (generateGradleTokenClass) { + tasks.injectTags.outputClassName.set(generateGradleTokenClass) +} + // Custom reobf auto-mappings configurations.configureEach { dependencies.configureEach { dep -> diff --git a/dependencies.gradle b/dependencies.gradle index badfc1e..2f9d6e8 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,33 +1,7 @@ -project.ext.lwjglVersion = "3.3.1" - -//switch (OperatingSystem.current()) { -// case OperatingSystem.LINUX: -// def osArch = System.getProperty("os.arch") -// project.ext.lwjglNatives = osArch.startsWith("arm") || osArch.startsWith("aarch64") -// ? "natives-linux-${osArch.contains("64") || osArch.startsWith("armv8") ? "arm64" : "arm32"}" -// : "natives-linux" -// break -// case OperatingSystem.MAC_OS: -// project.ext.lwjglNatives = System.getProperty("os.arch").startsWith("aarch64") ? "natives-macos-arm64" : "natives-macos" -// break -// case OperatingSystem.WINDOWS: -// def osArch = System.getProperty("os.arch") -// project.ext.lwjglNatives = osArch.contains("64") -// ? "natives-windows${osArch.startsWith("aarch64") ? "-arm64" : ""}" -// : "natives-windows-x86" -// break -//} +minecraft { + lwjglVersion.set("3.3.1") +} dependencies { - implementation platform("org.lwjgl:lwjgl-bom:$lwjglVersion") - - implementation "org.lwjgl:lwjgl" - implementation "org.lwjgl:lwjgl-glfw" - implementation "org.lwjgl:lwjgl-openal" - implementation "org.lwjgl:lwjgl-opengl" -// runtimeOnly "org.lwjgl:lwjgl::$lwjglNatives" -// runtimeOnly "org.lwjgl:lwjgl-glfw::$lwjglNatives" -// runtimeOnly "org.lwjgl:lwjgl-openal::$lwjglNatives" -// runtimeOnly "org.lwjgl:lwjgl-opengl::$lwjglNatives" } diff --git a/gradle.properties b/gradle.properties index f99eb8c..d3f40bd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -28,16 +28,19 @@ remoteMappings = https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/con # Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty developmentEnvironmentUserName = Developer -# Define a source file of your project with: +# Generate a class with String fields for the mod id, name, version and group name named with the fields below +generateGradleTokenClass = me.eigenraven.lwjgl3ify.Tags +gradleTokenModId = MODID +gradleTokenModName = MODNAME +gradleTokenVersion = VERSION +gradleTokenGroupName = GROUPNAME +# [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 = Tags.java -gradleTokenModId = GRADLETOKEN_MODID -gradleTokenModName = GRADLETOKEN_MODNAME -gradleTokenVersion = GRADLETOKEN_VERSION -gradleTokenGroupName = GRADLETOKEN_GROUPNAME +replaceGradleTokenInFile = # 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. diff --git a/src/main/java/me/eigenraven/lwjgl3ify/Tags.java b/src/main/java/me/eigenraven/lwjgl3ify/Tags.java deleted file mode 100644 index 0257b94..0000000 --- a/src/main/java/me/eigenraven/lwjgl3ify/Tags.java +++ /dev/null @@ -1,12 +0,0 @@ -package me.eigenraven.lwjgl3ify; - -// Use this class for Strings only. Do not import any classes here. It will lead to issues with Mixins if in use! - -public class Tags { - - // GRADLETOKEN_* will be replaced by your configuration values at build time - public static final String MODID = "lwjgl3ify"; - public static final String MODNAME = "lwjgl3ify"; - public static final String VERSION = "GRADLETOKEN_VERSION"; - public static final String GROUPNAME = "GRADLETOKEN_GROUPNAME"; -}