Package com.gtnewhorizons.gtnhgradle
Class PropertiesConfiguration
java.lang.Object
com.gtnewhorizons.gtnhgradle.PropertiesConfiguration
A helper for accessing gradle Properties entries configuring the GTNH plugins.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Separate factory functions forPropertiesConfiguration
construction to allow isolated loading of the parent class.static @interface
Property metadata -
Field Summary
FieldsModifier and TypeFieldDescription@NotNull String
See annotation@NotNull String
See annotationboolean
See annotation@NotNull String
See annotation@NotNull String
See annotationboolean
See annotation@NotNull String
See annotation@NotNull String
See annotation@NotNull String
See annotation@NotNull String
See annotation@NotNull String
See annotation@NotNull String
See annotation@NotNull String
See annotation@NotNull String
See annotationboolean
See annotationboolean
See annotation@org.jetbrains.annotations.NotNull boolean
See annotationboolean
See annotationboolean
See annotation@NotNull String
See annotation@NotNull String
See annotation@NotNull String
See annotationboolean
See annotationboolean
See annotation@NotNull String
See annotation@NotNull String
See annotation@NotNull String
See annotationboolean
See annotation@NotNull String
See annotationboolean
See annotation@NotNull String
See annotation@NotNull String
See annotation@NotNull String
See annotationboolean
See annotation@NotNull String
See annotation@NotNull String
See annotation@NotNull String
See annotation@NotNull String
See annotation@NotNull String
See annotation@NotNull String
See annotation@NotNull String
See annotationboolean
See annotationboolean
See annotationboolean
See annotationboolean
See annotationboolean
See annotationboolean
See annotationboolean
See annotationboolean
See annotationboolean
See annotationboolean
See annotationboolean
See annotationboolean
See annotationboolean
See annotationboolean
See annotationboolean
See annotationboolean
See annotation@NotNull String
See annotation@NotNull String
See annotationSee annotationboolean
See annotationboolean
See annotationboolean
See annotationboolean
See annotationboolean
See annotationboolean
See annotation@NotNull String
See annotation -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongenerateUpdatedProperties
(Path settingsPath, Map<String, String> originalValues) void
initFromProperties
(Map<?, ?> props, BiConsumer<String, Object> onMissing) Initializes the properties based on the given datastatic void
Prints documentation for all the available properties
-
Field Details
-
exampleModGithubOwner
@Prop(name="gtnh.settings.exampleModGithubOwner", isSettings=true, preferPopulated=false, required=false, hidden=true, docComment="Github owner of the ExampleMod repo to use") @NotNull public @NotNull String exampleModGithubOwnerSee annotation -
exampleModGithubProject
@Prop(name="gtnh.settings.exampleModGithubProject", isSettings=true, preferPopulated=false, required=false, hidden=true, docComment="Github project name of the ExampleMod repo to use") @NotNull public @NotNull String exampleModGithubProjectSee annotation -
blowdryerTag
@Prop(name="gtnh.settings.blowdryerTag", isSettings=true, preferPopulated=true, required=false, docComment="ExampleMod tag to use as Blowdryer (Spotless, etc.) settings version, leave empty to disable.\nLOCAL to test local config updates.\n") @NotNull public @NotNull String blowdryerTagSee annotation -
dynamicSpotlessVersion
@Prop(name="gtnh.settings.dynamicSpotlessVersion", isSettings=true, preferPopulated=false, required=false, hidden=true, docComment="Whether to enable a pluginManagement spotless version resolution rule to use a newer spotless build on new JVMs.\n") @NotNull public @org.jetbrains.annotations.NotNull boolean dynamicSpotlessVersionSee annotation -
moduleGitVersion
@Prop(name="gtnh.modules.gitVersion", isSettings=false, preferPopulated=false, required=false, hidden=true, docComment="Whether to automatically set the version based on the VERSION environment variable or the current git status.\nIf not used, make sure to set project.ext.modVersion to a String with a correct version number during project evaluation.\n") public boolean moduleGitVersionSee annotation -
moduleCodeStyle
@Prop(name="gtnh.modules.codeStyle", isSettings=false, preferPopulated=false, required=false, hidden=true, docComment="Sets up code style plugins like Spotless and Checkstyle.") public boolean moduleCodeStyleSee annotation -
moduleToolchain
@Prop(name="gtnh.modules.toolchain", isSettings=false, preferPopulated=false, required=false, hidden=true, docComment="Sets up the Java/Kotlin toolchain for mod compilation.") public boolean moduleToolchainSee annotation -
moduleScala
@Prop(name="gtnh.modules.scala", isSettings=false, preferPopulated=false, required=false, hidden=true, docComment="Sets up the Scala toolchain for mod compilation if src/main/scala is present.") public boolean moduleScalaSee annotation -
forceEnableScala
@Prop(name="gtnh.modules.scala.forceEnable", isSettings=false, preferPopulated=false, required=false, hidden=true, docComment="Sets up the Scala toolchain for mod compilation unconditionally if the Scala module is enabled.") public boolean forceEnableScalaSee annotation -
moduleStructureCheck
@Prop(name="gtnh.modules.structureCheck", isSettings=false, preferPopulated=false, required=false, hidden=true, docComment="Checks the project structure for obvious mistakes.") public boolean moduleStructureCheckSee annotation -
moduleAccessTransformers
@Prop(name="gtnh.modules.accessTransformers", isSettings=false, preferPopulated=false, required=false, hidden=true, docComment="Loads and packages access transformers.") public boolean moduleAccessTransformersSee annotation -
moduleMixin
@Prop(name="gtnh.modules.mixin", isSettings=false, preferPopulated=false, required=false, hidden=true, docComment="Easy UniMixins support.") public boolean moduleMixinSee annotation -
moduleStandardScripts
@Prop(name="gtnh.modules.standardScripts", isSettings=false, preferPopulated=false, required=false, hidden=true, docComment="Standard script loading, like addon.gradle.") public boolean moduleStandardScriptsSee annotation -
moduleOldGradleEmulation
@Prop(name="gtnh.modules.oldGradleEmulation", isSettings=false, preferPopulated=false, required=false, hidden=true, docComment="Emulates various old gradle version behaviours for backwards compatibility - HTTP protocol support, \"compile\" configuration, etc.") public boolean moduleOldGradleEmulationSee annotation -
moduleModernJava
@Prop(name="gtnh.modules.modernJava", isSettings=false, preferPopulated=false, required=false, hidden=true, docComment="Modern Java run support via lwjgl3ify.") public boolean moduleModernJavaSee annotation -
moduleIdeIntegration
@Prop(name="gtnh.modules.ideIntegration", isSettings=false, preferPopulated=false, required=false, hidden=true, docComment="IDE Integration (IntelliJ, Eclipse)") public boolean moduleIdeIntegrationSee annotation -
modulePublishing
@Prop(name="gtnh.modules.publishing", isSettings=false, preferPopulated=false, required=false, hidden=true, docComment="Publishing targets (Maven, mod hosting platforms).") public boolean modulePublishingSee annotation -
moduleUtility
@Prop(name="gtnh.modules.utility", isSettings=false, preferPopulated=false, required=false, hidden=true, docComment="Utility tasks and functions.") public boolean moduleUtilitySee annotation -
moduleUpdater
@Prop(name="gtnh.modules.updater", isSettings=false, preferPopulated=false, required=false, hidden=true, docComment="Buildscript updater module.") public boolean moduleUpdaterSee annotation -
modName
@Prop(name="modName", isSettings=false, preferPopulated=true, required=true, docComment="Human-readable mod name, available for mcmod.info population.\n") @NotNull public @NotNull String modNameSee annotation -
modId
@Prop(name="modId", isSettings=false, preferPopulated=true, required=true, docComment="Case-sensitive identifier string, available for mcmod.info population and used for automatic mixin JSON generation.\nConventionally lowercase.\n") @NotNull public @NotNull String modIdSee annotation -
modGroup
@Prop(name="modGroup", isSettings=false, preferPopulated=true, required=true, docComment="Root package of the mod, used to find various classes in other properties,\nmcmod.info substitution, enabling assertions in run tasks, etc.\n") @NotNull public @NotNull String modGroupSee annotation -
useModGroupForPublishing
@Prop(name="useModGroupForPublishing", isSettings=false, preferPopulated=true, required=false, docComment="Whether to use modGroup as the maven publishing group.\nWhen false, com.github.GTNewHorizons is used.\n") public boolean useModGroupForPublishingSee annotation -
autoUpdateBuildScript
@Prop(name="autoUpdateBuildScript", isSettings=false, preferPopulated=true, required=false, docComment="Updates your build.gradle and settings.gradle automatically whenever an update is available.\n") public boolean autoUpdateBuildScriptSee annotation -
minecraftVersion
@Prop(name="minecraftVersion", isSettings=false, preferPopulated=true, required=false, docComment="Version of Minecraft to target\n") @NotNull public @NotNull String minecraftVersionSee annotation -
forgeVersion
@Prop(name="forgeVersion", isSettings=false, preferPopulated=true, required=false, docComment="Version of Minecraft Forge to target\n") @NotNull public @NotNull String forgeVersionSee annotation -
channel
@Prop(name="channel", isSettings=false, preferPopulated=true, required=false, docComment="Specify an MCP channel for dependency deobfuscation and the deobfParams task.\n") @NotNull public @NotNull String channelSee annotation -
mappingsVersion
@Prop(name="mappingsVersion", isSettings=false, preferPopulated=true, required=false, docComment="Specify an MCP mappings version for dependency deobfuscation and the deobfParams task.\n") @NotNull public @NotNull String mappingsVersionSee annotation -
remoteMappings
@Prop(name="remoteMappings", isSettings=false, preferPopulated=true, required=false, docComment="Defines other MCP mappings for dependency deobfuscation.\n") @NotNull public @NotNull String remoteMappingsSee annotation -
developmentEnvironmentUserName
@Prop(name="developmentEnvironmentUserName", isSettings=false, preferPopulated=true, required=false, docComment="Select a default username for testing your mod. You can always override this per-run by running\n`./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.\n") @NotNull public @NotNull String developmentEnvironmentUserNameSee annotation -
enableModernJavaSyntax
@Prop(name="enableModernJavaSyntax", isSettings=false, preferPopulated=true, required=false, docComment="Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.\nSee https://github.com/bsideup/jabel for details on how this works.\n") public boolean enableModernJavaSyntaxSee annotation -
enableGenericInjection
@Prop(name="enableGenericInjection", isSettings=false, preferPopulated=true, required=false, docComment="Enables injecting missing generics into the decompiled source code for a better coding experience.\nTurns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.\n") public boolean enableGenericInjectionSee annotation -
generateGradleTokenClass
@Prop(name="generateGradleTokenClass", isSettings=false, preferPopulated=true, required=false, docComment="Generate a class with a String field for the mod version named as defined below.\nIf generateGradleTokenClass is empty or not missing, no such class will be generated.\nIf gradleTokenVersion is empty or missing, the field will not be present in the class.\n") @NotNull public @NotNull String generateGradleTokenClassSee annotation -
gradleTokenVersion
@Prop(name="gradleTokenVersion", isSettings=false, preferPopulated=true, required=false, docComment="Name of the token containing the project\'s current version to generate/replace.\n") @NotNull public @NotNull String gradleTokenVersionSee annotation -
deprecatedGradleTokenModId
@Prop(name="gradleTokenModId", isSettings=false, preferPopulated=true, required=false, hidden=true, docComment="[DEPRECATED] Mod ID replacement token.\n") @NotNull public @NotNull String deprecatedGradleTokenModIdSee annotation -
deprecatedGradleTokenModName
@Prop(name="gradleTokenModName", isSettings=false, preferPopulated=true, required=false, hidden=true, docComment="[DEPRECATED] Mod name replacement token.\n") @NotNull public @NotNull String deprecatedGradleTokenModNameSee annotation -
deprecatedGradleTokenGroupName
@Prop(name="gradleTokenGroupName", isSettings=false, preferPopulated=true, required=false, hidden=true, docComment="[DEPRECATED] Mod Group replacement token.\n") @NotNull public @NotNull String deprecatedGradleTokenGroupNameSee annotation -
replaceGradleTokenInFile
@Prop(name="replaceGradleTokenInFile", isSettings=false, preferPopulated=false, required=false, docComment="[DEPRECATED]\nMultiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java\npublic static final String VERSION = \"GRADLETOKEN_VERSION\";\nThe string\'s content will be replaced with your mod\'s version when compiled. You should use this to specify your mod\'s\nversion in @Mod([...], version = VERSION, [...]).\nLeave these properties empty to skip individual token replacements.\n") @NotNull public @NotNull String replaceGradleTokenInFileSee annotation -
apiPackage
@Prop(name="apiPackage", isSettings=false, preferPopulated=true, required=false, docComment="In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can\nleave this property empty.\nExample value: (apiPackage = api) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.api\n") @NotNull public @NotNull String apiPackageSee annotation -
accessTransformersFile
@Prop(name="accessTransformersFile", isSettings=false, preferPopulated=true, required=false, docComment="Specify the configuration file for Forge\'s access transformers here. It must be placed into /src/main/resources/META-INF/\nThere can be multiple files in a space-separated list.\nExample value: mymodid_at.cfg nei_at.cfg\n") @NotNull public @NotNull String accessTransformersFileSee annotation -
usesMixins
@Prop(name="usesMixins", isSettings=false, preferPopulated=true, required=false, docComment="Provides setup for Mixins if enabled. If you don\'t know what mixins are: Keep it disabled!\n") public boolean usesMixinsSee annotation -
separateMixinSourceSet
@Prop(name="separateMixinSourceSet", isSettings=false, preferPopulated=true, required=false, docComment="Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.\nThis can speed up compile times thanks to not running the mixin annotation processor on all input sources.\nMixin classes will have access to \"main\" classes, but not the other way around.\n") public String separateMixinSourceSetSee annotation -
usesMixinDebug
@Prop(name="usesMixinDebug", isSettings=false, preferPopulated=true, required=false, docComment="Adds some debug arguments like verbose output and class export.\n") public boolean usesMixinDebugSee annotation -
mixinPlugin
@Prop(name="mixinPlugin", isSettings=false, preferPopulated=true, required=false, docComment="Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.\n") @NotNull public @NotNull String mixinPluginSee annotation -
mixinsPackage
@Prop(name="mixinsPackage", isSettings=false, preferPopulated=true, required=false, docComment="Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!\n") @NotNull public @NotNull String mixinsPackageSee annotation -
coreModClass
@Prop(name="coreModClass", isSettings=false, preferPopulated=true, required=false, docComment="Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!\nThis parameter is for legacy compatibility only\nExample value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin\n") @NotNull public @NotNull String coreModClassSee annotation -
containsMixinsAndOrCoreModOnly
@Prop(name="containsMixinsAndOrCoreModOnly", isSettings=false, preferPopulated=true, required=false, docComment="If your project is only a consolidation of mixins or a core mod and does NOT contain a \'normal\' mod ( = some class\nthat is annotated with @Mod) you want this to be true. When in doubt: leave it on false!\n") public boolean containsMixinsAndOrCoreModOnlySee annotation -
forceEnableMixins
@Prop(name="forceEnableMixins", isSettings=false, preferPopulated=true, required=false, docComment="Enables Mixins even if this mod doesn\'t use them, useful if one of the dependencies uses mixins.\n") public boolean forceEnableMixinsSee annotation -
usesShadowedDependencies
@Prop(name="usesShadowedDependencies", isSettings=false, preferPopulated=true, required=false, docComment="If enabled, you may use \'shadowCompile\' for dependencies. They will be integrated into your jar. It is your\nresponsibility to check the license and request permission for distribution if required.\n") public boolean usesShadowedDependenciesSee annotation -
minimizeShadowedDependencies
@Prop(name="minimizeShadowedDependencies", isSettings=false, preferPopulated=true, required=false, docComment="If disabled, won\'t remove unused classes from shadowed dependencies. Some libraries use reflection to access\ntheir own classes, making the minimization unreliable.\n") public boolean minimizeShadowedDependenciesSee annotation -
relocateShadowedDependencies
@Prop(name="relocateShadowedDependencies", isSettings=false, preferPopulated=true, required=false, docComment="If disabled, won\'t rename the shadowed classes.\n") public boolean relocateShadowedDependenciesSee annotation -
includeWellKnownRepositories
@Prop(name="includeWellKnownRepositories", isSettings=false, preferPopulated=true, required=false, docComment="Adds CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.\n") public boolean includeWellKnownRepositoriesSee annotation -
excludeWellKnownRepositories
@Prop(name="excludeWellKnownRepositories", isSettings=false, preferPopulated=true, required=false, docComment="A list of repositories to exclude from the includeWellKnownRepositories setting. Should be a space separated\nlist of strings, with the acceptable keys being(case does not matter):\ncursemaven\nmodrinth\n") @NotNull public @NotNull String excludeWellKnownRepositoriesSee annotation -
useIC2FromCurseforge
@Prop(name="useIC2FromCurseforge", isSettings=false, preferPopulated=false, required=false, hidden=true, docComment="Adds a dependency override rule to use RFG-deobfuscated https://www.curseforge.com/minecraft/mc-mods/industrial-craft/files/2353971 instead of net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev\n") public boolean useIC2FromCurseforgeSee annotation -
usesMavenPublishing
@Prop(name="usesMavenPublishing", isSettings=false, preferPopulated=true, required=false, docComment="Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.\nAuthenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables.\nIf you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.\n") public boolean usesMavenPublishingSee annotation -
mavenPublishUrl
@Prop(name="mavenPublishUrl", isSettings=false, preferPopulated=false, required=false, docComment="Maven repository to publish the mod to.\n") @NotNull public @NotNull String mavenPublishUrlSee annotation -
modrinthProjectId
@Prop(name="modrinthProjectId", isSettings=false, preferPopulated=true, required=false, docComment="Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token.\n\nThe project\'s ID on Modrinth. Can be either the slug or the ID.\nLeave this empty if you don\'t want to publish to Modrinth.\n") @NotNull public @NotNull String modrinthProjectIdSee annotation -
modrinthRelations
@Prop(name="modrinthRelations", isSettings=false, preferPopulated=true, required=false, docComment="The project\'s relations on Modrinth. You can use this to refer to other projects on Modrinth.\nSyntax: scope1-type1:name1;scope2-type2:name2;...\nWhere scope can be one of [required, optional, incompatible, embedded],\n type can be one of [project, version],\n and the name is the Modrinth project or version slug/id of the other mod.\nExample: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech\nNote: GTNH Mixins is automatically set as a required dependency if usesMixins = true\n") @NotNull public @NotNull String modrinthRelationsSee annotation -
curseForgeProjectId
@Prop(name="curseForgeProjectId", isSettings=false, preferPopulated=true, required=false, docComment="Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.\n\nThe project\'s numeric ID on CurseForge. You can find this in the About Project box.\nLeave this empty if you don\'t want to publish on CurseForge.\n") @NotNull public @NotNull String curseForgeProjectIdSee annotation -
curseForgeRelations
@Prop(name="curseForgeRelations", isSettings=false, preferPopulated=true, required=false, docComment="The project\'s relations on CurseForge. You can use this to refer to other projects on CurseForge.\nSyntax: type1:name1;type2:name2;...\nWhere type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],\n and the name is the CurseForge project slug of the other mod.\nExample: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft\nNote: UniMixins is automatically set as a required dependency if usesMixins = true.\n") @NotNull public @NotNull String curseForgeRelationsSee annotation -
customArchiveBaseName
@Prop(name="customArchiveBaseName", isSettings=false, preferPopulated=false, required=false, docComment="Optional parameter to customize the produced artifacts. Use this to preserve artifact naming when migrating older\nprojects. New projects should not use this parameter.\n") @NotNull public @NotNull String customArchiveBaseNameSee annotation -
versionPattern
@Prop(name="versionPattern", isSettings=false, preferPopulated=false, required=false, docComment="Optional parameter to have the build automatically fail if an illegal version is used.\nThis can be useful if you e.g. only want to allow versions in the form of \'1.1.xxx\'.\nThe check is ONLY performed if the version is a git tag.\nNote: the specified string must be escaped, so e.g. 1\\\\.1\\\\.\\\\d+ instead of 1\\.1\\.\\d+\n") @NotNull public @NotNull String versionPatternSee annotation -
noPublishedSources
@Prop(name="noPublishedSources", isSettings=false, preferPopulated=false, required=false, defaultInComment="true", docComment="Uncomment to prevent the source code from being published.\n") public boolean noPublishedSourcesSee annotation -
disableSpotless
@Prop(name="disableSpotless", isSettings=false, preferPopulated=false, required=false, defaultInComment="true", docComment="Uncomment this to disable Spotless checks.\nThis should only be uncommented to keep it easier to sync with upstream/other forks.\nThat is, if there is no other active fork/upstream, NEVER change this.\n") public boolean disableSpotlessSee annotation -
disableCheckstyle
@Prop(name="disableCheckstyle", isSettings=false, preferPopulated=false, required=false, defaultInComment="true", docComment="Uncomment this to disable Checkstyle checks (currently wildcard import check).\n") public boolean disableCheckstyleSee annotation -
ideaOverrideBuildType
@Prop(name="ideaOverrideBuildType", isSettings=false, preferPopulated=false, required=false, defaultInComment="idea", docComment="Override the IDEA build type. Valid values are: \"\" (leave blank, do not override), \"idea\" (force use native IDEA build), \"gradle\"\n(force use delegated build).\nThis is meant to be set in $HOME/.gradle/gradle.properties.\ne.g. add \"systemProp.org.gradle.project.ideaOverrideBuildType=idea\" will override the build type to be native build.\nWARNING: If you do use this option, it will overwrite whatever you have in your existing projects. This might not be what you want!\nUsually there is no need to uncomment this here as other developers do not necessarily use the same build type as you.\n") @NotNull public @NotNull String ideaOverrideBuildTypeSee annotation -
ideaCheckSpotlessOnBuild
@Prop(name="ideaCheckSpotlessOnBuild", isSettings=false, preferPopulated=false, required=false, docComment="Whether IDEA should run spotless checks when pressing the Build button.\nThis is meant to be set in $HOME/.gradle/gradle.properties.\n") public boolean ideaCheckSpotlessOnBuildSee annotation
-
-
Constructor Details
-
PropertiesConfiguration
public PropertiesConfiguration()Fills all properties with default values.
-
-
Method Details
-
initFromProperties
Initializes the properties based on the given data- Parameters:
props
- Input propertiesonMissing
- Function to call if a property was found to be missing
-
generateUpdatedProperties
public String generateUpdatedProperties(Path settingsPath, Map<String, String> originalValues) throws Throwable- Parameters:
settingsPath
- Path to the settings.gradle fileoriginalValues
- The old parsed properties- Returns:
- An updated properties file contents
- Throws:
Throwable
- for convenience
-
printPropertyDocs
Prints documentation for all the available properties- Parameters:
out
- The stream to write to.
-