Skip to content

Conversation

@Jonathing
Copy link
Member

This PR marks the start of GradleUtils 3.4.0, with the main change being a rework to the Tools system provided by GradleUtils shared. Specifically, the ability to define a tool through it's maven coordinate as opposed to a hard-coded download URL. This also includes an attempt to try and download the tool through Gradle before falling back to trying the Forge Maven (or whatever Maven URL was passed in as the tool's Maven URL).

There are also some additional changes and cleanup to the main plugin, but the main plugin remains binary compatible. As a reminder, binary breaking changes to GradleUtils Shared are fair game no matter the version number, as GradleUtils Shared must always be shadowed and relocated by the consuming plugin.

@Jonathing Jonathing requested a review from LexManos December 28, 2025 00:01
@Jonathing Jonathing self-assigned this Dec 28, 2025
@Jonathing Jonathing added the enhancement New feature or request label Dec 28, 2025

//region Dependency Information

public record SimpleModuleIdentifier(String getGroup, String getName) implements ModuleIdentifier {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My be worth stealing this its tried and tested.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

artifact-utils :P

@LexManos
Copy link
Member

Alright, so quick pass, lots of changes and class shuffleing around but looks fine to me.
To be clear im mainly focused on the usage experience.
Currently we have:
static final Tool MAVENIZER = Tool.of(Constants.MAVENIZER_NAME, Constants.MAVENIZER_VERSION, Constants.MAVENIZER_DL_URL, Constants.MAVENIZER_JAVA_VERSION, Constants.MAVENIZER_MAIN);
I'd prefer something smaller like:
static final Tool MAVENIZER = Tool.ofForge("mavenizer", "net.minecraftforge:mavenizer:1.0:all", JAVA_8); (ofForge tells it to use the forge maven by default for the download)

Also currently we have:

fgtools {
    configure('mavenizer') {
        classpath = configurations.detachedConfiguration(dependencies.create('net.minecraftforge:minecraft-mavenizer:0.4.19'))
    }
}

Preferribly we would be able to do:

fgtools {
    configure('mavenizer') {
        version = '2.0'
        // Ideally this would allow for setting any of the variables, extension, classifier, url, java verion
    }
}

Or, if possible:

fgtools {
    mavenizer.version = '2.0'
}

As 'use the same exact tool, but with a updated version, would be the number one use case.

As for the ToolExec task (this is just reiterating what we've already talk about)
having it find the Main-Class from any executable jar would be nice.

@Jonathing
Copy link
Member Author

having it find the Main-Class from any executable jar would be nice.

While it makes sense on paper, I'm not seeing why this would be necessary. The logic you wrote in MinecraftForge/ForgeAutoRenamingTool#32 makes it look for Main-Class if and only if the classpath only has a single JAR file. This is redundant because Java itself will look for Main-Class if there is only one JAR file run. That is how ToolExec has worked in the past.

@LexManos
Copy link
Member

LexManos commented Dec 28, 2025

Well you beed to not error when there isnt a main class. And i thought it only looked for a main class when passed in the classpath as -jar not as -cp.
How would java know the first argument is not a classname? Does JavaExec silently translate the two is only one file is specified?

Either way if it works it works.

@Jonathing
Copy link
Member Author

JavaExec silently translates the execution call, yes. See JavaExecSpec#getMainClass.

@LexManos
Copy link
Member

LexManos commented Jan 7, 2026

Pushed my changes to allow for users to do:

renamerTools {
    configure('mavenizer') {
        version = '2.0' // results in net.minecraftforge:minecraft-mavenizer:2.0
        artifact = 'some.other:tool:1.0' // this will be used before version is, so only specify one.
    }
}

You can still specify the full classpath, which will override all of this, but for the average use case. This is far easier then setting the configurations.

Because the intended use of shared is to be shaded in, I dont think there is a sane way to share the same "tools" extension. So we can set that as a future goal. For now each plugin have its own tools extension is fine.

I have opted to not care about adding a helper for setting the java version:

renamerTools {
    configure('mavenizer') {
        javaVersion = 21
    }
}

the current version is a little verbose but good enough for now:

renamerTools {
    configure('mavenizer') {
        javaLauncher = javaToolchains.launcherFor {
            languageVersion = JavaLanguageVersion.of(21)
        }
    }
}

This is mostly a GradleUtils Shared change, but was large enough to warrant a minor version bump. This also includes some deprecations and (binary compatible) structural changes to GradleUtils itself.

Co-authored-by: LexManos <LexManos@gmail.com>
@Jonathing Jonathing force-pushed the feat/jonathing/3.4/tools-rework branch from ad7b957 to 6c1203a Compare January 8, 2026 01:25
@Jonathing
Copy link
Member Author

Splitting SimpleModule(Version)Identifier into another project (such as artifact-utils) can be done/discussed at a later time.

@Jonathing Jonathing merged commit 6c1203a into MinecraftForge:main Jan 8, 2026
Jonathing added a commit that referenced this pull request Jan 8, 2026
This is mostly a GradleUtils Shared change, but was large enough to warrant a minor version bump. This also includes some deprecations and (binary compatible) structural changes to GradleUtils itself.

Co-authored-by: LexManos <LexManos@gmail.com>
Jonathing added a commit that referenced this pull request Jan 8, 2026
This is mostly a GradleUtils Shared change, but was large enough to
warrant a minor version bump. This also includes some deprecations and
(binary compatible) structural changes to GradleUtils itself.

Co-authored-by: LexManos <LexManos@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants