vigna / fastutil

fastutil extends the Java™ Collections Framework by providing type-specific maps, sets, lists and queues.
Apache License 2.0
1.76k stars 196 forks source link

find-deps.sh #271

Closed IWareQ closed 2 years ago

IWareQ commented 2 years ago

How use find-deps.sh?

i use find-deps.sh find C:\example\path\TestProject

return -->.class

hierarchy: TestProject.src.iwareq.testpr.Main.java

incaseoftrouble commented 2 years ago

Which shell are you using? MinGW or WSL?

IWareQ commented 2 years ago

Which shell are you using? MinGW or WSL?

PowerShell (default in Windows 10)

incaseoftrouble commented 2 years ago

Well, its a bash skript (.sh) not a powershell script (.ps1), this won't work. Install WSL and run it from bash. Or replicate the script. Its not doing much besides calling jdeps -recursive -regex "it\.unimi\.dsi\.fastutil\..*" -verbose:class -cp "<your jar>"

IWareQ commented 2 years ago

I installed WSL but it didn't work for me, it still returns ->.class. But jdeps ...

image what next?

incaseoftrouble commented 2 years ago

interesting. Which distribution? I guess Ubuntu from the looks of it.

Probably jdeps slightly changed their output format. You can extract the list of classes in the middle (all the "it.unimi..." being referenced) and pack that into a file (dependencies.txt) and then do find-deps.sh minimize yourjar.jar dependencies.txt if I remember correctly

IWareQ commented 2 years ago

interesting. Which distribution? I guess Ubuntu from the looks of it.

Probably jdeps slightly changed their output format. You can extract the list of classes in the middle (all the "it.unimi..." being referenced) and pack that into a file (dependencies.txt) and then do find-deps.sh minimize yourjar.jar dependencies.txt if I remember correctly

Yes, Ubuntu. Returned "Resolving transitive dependencies​"

incaseoftrouble commented 2 years ago

Hm, it seems jdeps significantly changed its functionality. I can't find a way to restrict it to only analysing the given classes as roots.

To fix this, one would need to write something that parses the complete output of jdeps (essentially, a list of all dependencies in fastutil) and then build the dependency tree for the given dependencies.

Doable, but its probably easier to just minimize the final jar with proguard or similar.

IWareQ commented 2 years ago

Why not fix the script?

vigna commented 2 years ago

Hey, why not capitalize on split.sh? It does exactly what you need (I think).

incaseoftrouble commented 2 years ago

Why not fix the script?

As I just said, jdeps changed how it works apparently.

IWareQ commented 2 years ago

Hey, why not capitalize on split.sh? It does exactly what you need (I think).

If it creates an archive with the files that I use the project, then - yes, this is what I need. How use this script?

IWareQ commented 2 years ago

maybe open issue?)

incaseoftrouble commented 2 years ago

split.sh separates fastutil in the native datatypes (int long double Object). Just run it in fastutil source folder after compiling. You'll save ~15 MB.

find-deps.sh won't work because of change in jdeps behaviour. Considering the minimal benefits and many caveats of this script I don't see a reason to fix it (PR is welcome of course).

IWareQ commented 2 years ago

split.sh separates fastutil in the native datatypes (int long double Object). Just run it in fastutil source folder after compiling. You'll save ~15 MB.

find-deps.sh won't work because of change in jdeps behaviour. Considering the minimal benefits and many caveats of this script I don't see a reason to fix it (PR is welcome of course).

thx