Skip to content

Conversation

@Technici4n
Copy link
Contributor

@Technici4n Technici4n commented Nov 11, 2023

Add SecureJarBuilder

In preparation for the package exclusions and other future additional SecureJar parameters, deprecate the old from methods for removal, and add a builder instead.

Split implementation across new JarContents and JarSigningData

The motivation for this change is that usually we need access to some of the jar's contents when building the JarMetadata. Before this change, this is done by passing an incomplete SecureJar to the jar metadata factory in the constructor of SecureJar. This makes it very hard to reason about the code, because we don't know which parts of SecureJar can be safely referenced in the metadata construction, and we also don't know when the metadata can be used inside of SecureJar.

To fix this, I moved the methods needed for constructing the metadata to a new interface called JarContents. The builder was updated accordingly.

Add option to exclude some folder from the package scan

Finally, I also added the option to exclude some folders from the package scan. This will be useful to skip the assets and data folders of some mods. Some mods have a LOT of assets (for example Continuity+), and scanning those can take a few seconds of startup time.

Allow instantiating JarContents separately and remove SecureJarBuilder

After a bit of testing in FML I noticed that it is convenient to have a builder for JarContents instead of SecureJar.

Documentation

I tried to document many methods I encountered, to break the tradition of SJH being completely undocumented... :)

Future work

I will make another PR to make the package scan parallel (across different jars)... but for now I think this PR is large enough. :)

TODO

  • Actually test with mods. EDIT: Done, tested on ATM 9 with 400 mods, skipping the assets and data scanning worked. :)

Copy link
Member

@Matyrobbrt Matyrobbrt left a comment

Choose a reason for hiding this comment

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

Mostly pendantic documentation complaints.

@sciwhiz12 sciwhiz12 added the enhancement New feature or request label Nov 12, 2023
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.

4 participants