Skip to content

Commit

Permalink
update buildscript
Browse files Browse the repository at this point in the history
  • Loading branch information
brachy84 committed Jul 24, 2024
1 parent c929c7e commit d94e3f4
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 9 deletions.
50 changes: 42 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//version: 1718246243
//version: 1720840170
/*
* DO NOT CHANGE THIS FILE!
* Also, you may replace this file at any time if there is an update available.
Expand Down Expand Up @@ -33,9 +33,9 @@ plugins {
id 'base'
id 'eclipse'
id 'maven-publish'
id 'org.jetbrains.gradle.plugin.idea-ext' version '1.1.7'
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.33'
id 'net.darkhax.curseforgegradle' version '1.1.18' apply false
id 'org.jetbrains.gradle.plugin.idea-ext' version '1.1.8'
id 'com.gtnewhorizons.retrofuturagradle' version '1.4.0'
id 'net.darkhax.curseforgegradle' version '1.1.24' apply false
id 'com.modrinth.minotaur' version '2.8.7' apply false
id 'com.diffplug.spotless' version '6.13.0' apply false
id 'com.palantir.git-version' version '3.0.0' apply false
Expand Down Expand Up @@ -69,6 +69,7 @@ propertyDefaultIfUnset("includeMCVersionJar", false)
propertyDefaultIfUnset("autoUpdateBuildScript", false)
propertyDefaultIfUnset("modArchivesBaseName", project.modId)
propertyDefaultIfUnsetWithEnvVar("developmentEnvironmentUserName", "Developer", "DEV_USERNAME")
propertyDefaultIfUnset("additionalJavaArguments", "")
propertyDefaultIfUnset("enableJava17RunTasks", false)
propertyDefaultIfUnset("generateGradleTokenClass", "")
propertyDefaultIfUnset("gradleTokenModId", "")
Expand All @@ -77,8 +78,10 @@ propertyDefaultIfUnset("gradleTokenVersion", "")
propertyDefaultIfUnset("useSrcApiPath", false)
propertyDefaultIfUnset("includeWellKnownRepositories", true)
propertyDefaultIfUnset("includeCommonDevEnvMods", true)
propertyDefaultIfUnset("stripForgeRequirements", false)
propertyDefaultIfUnset("noPublishedSources", false)
propertyDefaultIfUnset("forceEnableMixins", false)
propertyDefaultIfUnset("mixinConfigRefmap", "mixins.${project.modId}.refmap.json")
propertyDefaultIfUnsetWithEnvVar("enableCoreModDebug", false, "CORE_MOD_DEBUG")
propertyDefaultIfUnset("generateMixinConfig", true)
propertyDefaultIfUnset("usesShadowedDependencies", false)
Expand Down Expand Up @@ -119,7 +122,7 @@ if (!getFile(targetPackageJava).exists() && !getFile(targetPackageScala).exists(

if (apiPackage) {
final String endApiPath = modGroupPath + '/' + apiPackagePath
if (useSrcApiPath) {
if (useSrcApiPath.toBoolean()) {
targetPackageJava = 'src/api/java/' + endApiPath
targetPackageScala = 'src/api/scala/' + endApiPath
targetPackageKotlin = 'src/api/kotlin/' + endApiPath
Expand Down Expand Up @@ -382,6 +385,10 @@ minecraft {
])
}

if (additionalJavaArguments.size() != 0) {
extraRunJvmArguments.addAll(additionalJavaArguments.split(';'))
}

if (enableJava17RunTasks.toBoolean()) {
lwjgl3Version = "3.3.2"
}
Expand Down Expand Up @@ -520,7 +527,7 @@ dependencies {
// should use 2.8.6 but 2.8.9+ has a vulnerability fix
annotationProcessor 'com.google.code.gson:gson:2.8.9'

mixinProviderSpec = modUtils.enableMixins(mixinProviderSpec, "mixins.${modId}.refmap.json")
mixinProviderSpec = modUtils.enableMixins(mixinProviderSpec, mixinConfigRefmap)
api (mixinProviderSpec) {
transitive = false
}
Expand Down Expand Up @@ -562,6 +569,10 @@ dependencies {
transitive = false
}

if ((usesMixins.toBoolean() || forceEnableMixins.toBoolean()) && stripForgeRequirements.toBoolean()) {
runtimeOnlyNonPublishable 'com.cleanroommc:strip-latest-forge-requirements:1.0'
}

if (includeCommonDevEnvMods.toBoolean()) {
if (!(modId.equals('jei'))) {
implementation 'mezz.jei:jei_1.12.2:4.16.1.302'
Expand Down Expand Up @@ -695,7 +706,6 @@ tasks.register('generateAssets') {
if (usesMixins.toBoolean() && generateMixinConfig.toBoolean()) {
def mixinConfigFile = getFile("src/main/resources/mixins.${modId}.json")
if (!mixinConfigFile.exists()) {
def mixinConfigRefmap = "mixins.${modId}.refmap.json"

mixinConfigFile.text = """{
"package": "${modGroup}.${mixinsPackage}",
Expand Down Expand Up @@ -999,7 +1009,7 @@ abstract class RunHotswappableMinecraftTask extends RunMinecraftTask {

if (project.usesMixins.toBoolean()) {
this.extraJvmArgs.addAll(project.provider(() -> {
def mixinCfg = project.configurations.detachedConfiguration(project.dependencies.create(project.mixinProviderSpec))
def mixinCfg = project.configurations.detachedConfiguration(project.dependencies.create('zone.rong:mixinbooter:9.1'))
mixinCfg.canBeConsumed = false
mixinCfg.canBeResolved = true
mixinCfg.transitive = false
Expand Down Expand Up @@ -1227,6 +1237,30 @@ if (cfApiKey.isPresent() || deploymentDebug.toBoolean()) {
additionalFile.changelog = changelogRaw
}
}
doLast {
// No File IDs in Debug Mode
if (!deploymentDebug.toBoolean()) {
def list = []
for (def artifact : tasks.curseforge.getUploadArtifacts()) {
list.add(artifact)
for (def additionalArtifact : artifact.getAdditionalArtifacts()) {
list.add(additionalArtifact)
}
}
def summary = "## CurseForge Build Summary (Mod ${modName} | Project ID ${curseForgeProjectId})"
for (def artifact : list) {
def fileId = artifact.getCurseFileId()
def fileName = artifact.getArtifact().getSingleFile().name
println("Uploaded File ${fileName}, With File ID: ${fileId}")
summary = summary + "\n - File: ${fileName} | File ID: ${fileId}"
}
println(summary)
def stepSummary = providers.environmentVariable("GITHUB_STEP_SUMMARY")
if (stepSummary.isPresent()) {
file(stepSummary.get()).write(summary)
}
}
}
}
tasks.curseforge.dependsOn(build)
tasks.curseforge.dependsOn('generateChangelog')
Expand Down
26 changes: 25 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,22 @@ minecraftVersion = 1.12.2
# Alternatively this can be set with the 'DEV_USERNAME' environment variable.
developmentEnvironmentUserName = Developer

# Additional arguments applied to the JVM when launching minecraft
# Syntax: -arg1=value1;-arg2=value2;...
# Example value: -Dmixin.debug.verify=true;-XX:+UnlockExperimentalVMOptions
additionalJavaArguments =

# Enables using modern java syntax (up to version 17) via Jabel, while still targeting JVM 8.
# See https://github.com/bsideup/jabel for details on how this works.
# Using this requires that you use a Java 17 JDK for development.
enableModernJavaSyntax = true

# Enables runClient/runServer tasks for Java 17 and Java 21 using LWJGL3ify.
# This is primarily used to test if your mod is compatible with platforms running
# Minecraft 1.12.2 on modern versions of Java and LWJGL, and assist in fixing any problems with it.
# Using this requires that you use a Java 17/Java 21 JDK for development.
enableJava17RunTasks = false

# Generate a class with String fields for the mod id, name and version named with the fields below
generateGradleTokenClass = com.cleanroommc.groovyscript.Tags
gradleTokenModId = MODID
Expand All @@ -117,6 +128,9 @@ gradleTokenVersion = VERSION
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
apiPackage =

# If you want to keep your API code in src/api instead of src/main
useSrcApiPath = false

# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/
# There can be multiple files in a comma-separated list.
# Example value: mymodid_at.cfg,jei_at.cfg
Expand All @@ -126,6 +140,8 @@ accessTransformersFile =
usesMixins = true
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
mixinsPackage = core.mixin
# Location of the mixin config refmap. If left, blank, defaults to "mixins.${modId}.refmap.json". Target file must have the "json" extension.
mixinConfigRefmap =
# Automatically generates a mixin config json if enabled, with the name mixins.modid.json
generateMixinConfig = false
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
Expand All @@ -151,6 +167,12 @@ includeWellKnownRepositories = true
# Overrides the above setting to be always true, as these repositories are needed to fetch the mods
includeCommonDevEnvMods = true

# Some mods require a specific forge version to launch in. When you need to use one of those mods as a dependency,
# and cannot launch with the forge version required, enable this to strip the forge version requirements from that mod.
# This will add 'strip-latest-forge-requirements' as 'runtimeOnlyNonPublishable'.
# Requires useMixins or forceEnableMixins to be true, as the mod uses mixins to function.
stripForgeRequirements = false


# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated in your jar. It is your
# responsibility check the licence and request permission for distribution, if required.
Expand All @@ -165,6 +187,9 @@ relocateShadowedDependencies = true
# Useful for debugging a server and client simultaneously. If not enabled, it will be in the standard location "run/"
separateRunDirectories = false

# The display name format of versions published to Curse and Modrinth. $MOD_NAME and $VERSION are available variables.
# Default: $MOD_NAME \u2212 $VERSION. \u2212 is the minus character which looks much better than the hyphen minus on Curse.
versionDisplayFormat = $MOD_NAME \u2212 $VERSION

# Publishing to modrinth requires you to set the MODRINTH_API_KEY environment variable to your current modrinth API token.

Expand Down Expand Up @@ -274,4 +299,3 @@ org.gradle.logging.stacktrace = all
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs = -Xmx3G

0 comments on commit d94e3f4

Please sign in to comment.