Add helper methods to access files inside zip files - #1081
Draft
LexManos wants to merge 1 commit into
Draft
Conversation
LexManos
marked this pull request as draft
August 7, 2026 04:19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is a first draft of what I had in mind for addressing #1080
This just adds helper methods for converting a FileCollection of archives, to a FileCollection of files from those archives.
Example usages (untested, but should work):
configurations { mods implementation.extendsFrom mods } dependencies { mods renamer.dependency(libs.modA) mods renamer.dependency(libs.modB) implementation minecraft.dependency(forge) { facades.from('src/main/resources/META-INF/facades.cfg') facades.from(fg.mapFacades(configurations.mods)) accessTransformers.from('src/main/resources/META-INF/at.cfg') accessTransformers.from(fg.mapAccessTransformers(configurations.mods)) } }Its fairly generic, so you can do something like this:
configurations { sharedLibs } dependencies { sharedLibs 'org.json:json:20260719' } fg.mapZip(configurations.sharedLibs, 'META-INF/MANIFEST.MF').forEach { file -> logger.lifecycle('File: ' + file.absolutePath) }Outputs a nice:
File: Z:\test\_test\build\minecraftforge\forgegradle\zip_data\82390308e0b67205bf0d0d507dc48e0d71410bf7\json-20260719\META-INF\MANIFEST.MFIn addition this defacto standardizes the Facade files in deps to:
A space separated list in the
FORGE_FACADEmanifest attribute ORMETA-INF/facades.cfgJavadocs need to be written.
Do you think I should promote the
BiFunction<File, JarFile, List<ZipEntry>>to a properEntryFinderinterface and expose amapZip(FileCollection, EntryFinder)?Adding support for the access transformer helper requires parsing the mods.toml, as such I have to add a TOML dependency, so I add Jezza Toml which adds ~30kb to the jar. Same library I use for Renamer.
The functions that take Object instead of FileCollection just pass it directly to
project.filesas a small helper to make cleaner build files.mapZip(files, name)just grabs the explicit file from any archive that has itmapAccessTransformers(files)tries to find ATs from the manifest, toml, and default locationmapFacace(files)tries to find the facade config from the manifest, or default location