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.

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