libgdx / gdx-liftoff

A modern setup tool for libGDX Gradle projects
Apache License 2.0
524 stars 48 forks source link

Include more extensions in Graal's resource config file #143

Closed rafaskb closed 9 months ago

rafaskb commented 9 months ago

This PR adds a few extensions to the list of resources included in Graal native images, namely:

Just for the sake of it I printed all extensions present inside my game's .jar, and here's the result:

// Already included in the regex
.atlas=2
.fnt=5
.frag=24
.glsl=6
.json=4
.png=10
.properties=19
.vert=6
.xml=21

// Not included in the regex
.class=6850
.dll=21
.dylib=22
.git=30
.ico=1
.LIST=1
.MF=1
.rl=2
.ser=1
.sha1=58
.so=19
.txt=132

Perhaps .ico would be a good addition as well? Maybe .txt as well?

tommyettinger commented 9 months ago

Agreed about .ico and .txt, since .ico files are tiny and .txt files are common for data (and licenses, though those should always be present in a readable form). I think .toml, .csv and .tsv would be good too, while we're adding data formats like XML and JSON. I could merge this now and make these changes myself, or you could do it; either way there are certainly formats neither of us has yet thought of that might make sense here.

tommyettinger commented 9 months ago

I'm thinking about this and testing the sizes with different settings... an issue is that this filter applies to everything, even JARs that aren't the current core JAR (I could be wrong on this though). I'm intermittently looking for ways to get just the assets I want to keep with this very limited filter...

tommyettinger commented 9 months ago

Sorry, but I found a better approach! Using code based on Lyze's asset listing task, I now make the nativeCompile task generate a resources-config.json file (in the right place) filled with matches for the file names in assets/. This was quite hard to get going, but I didn't want to include the apparently-large amount of .properties files present in JARs somewhere. The new Graal config needs to be tested more, but I should be able to close this now (since all of the wanted files should be included, and you can still add more patterns if needed). I think I can release a new Liftoff version once this gets some testing, and it will use Gradle 8.5 (now you can use Java 21!).