Add Gradle Plugin #32
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
First pass at making a gradle plugin.
This is functional. See the demo for the examples.
Need to speak with @Jonathing about a lot of the implementation.
I did not use ToolExecBase because I have a few issues with it.
Namely, the Tool object is very clunky to work with.
It doesn't auto-detect main classes.
It doesn't support maven coordinates, or downloading the tools from configured repositories.
My implementation in theory (gradle didn't yell at me) is compatible with the config cache.
It uses detached configurations to download the mappings and tool.
So a basic overview:
plugins { id 'net.minecraftforge.renamer' } renamer { mappings(channel, version) // Shorthand for mappings('net.minecraft:mappings_channel:version@tsrg.gz') mappings(string) // Shorthand for mappings(dependencies.create(string)) mappings(Dependency) // Will use this dependency as the mapping file for subsequent calls to renamer.rename(task) } // Creates a 'jarRename' task using the compileClasspath // input is set to task.archiveFile // output is set to a renamed task.archiveFile (adding -renamed before the extension) // map is set from the previous call to renamer.mappings (or null if unset) // tool is set to `net.minecraftforge:ForgeAutoRenamingTool:1.1.2:all` // args is set to "--input", "{input}", "--output", "{output}", "--map", "{map}", "--lib={library}" // javaLauncher is set to javaToolchains.launcherFor(java.toolchain) // Shorthand for renamer.rename(jar, jar.name + 'Rename', null) renamer.rename(jar) // It also support specifying a closure renamer.rename(jar) { map = file('map.tsrg') } // Or configuring the task itself tasks.named('jarRename') { map = file('map.tsrg') }I have not done anything to mark the task as an artifact/publish.