halcyon / asdf-java

A Java plugin for asdf-vm.
MIT License
454 stars 86 forks source link

Use platform specific cache files to store java release data #157

Closed jgenunez closed 3 years ago

jgenunez commented 3 years ago

asdf list all java and other asdf plugin commands could run with rosetta emulation for X86_64 on apple silicon using the shell arch command so we need to make sure the cache file is invalidated when we target different architectures otherwise we would incorrectly use the cached file created from previous runs

nedtwigg commented 3 years ago

I just checked-out this PR on my M1 mac, and it works great, but not quite how I expected. Sharing my experience for anyone else interested in #156 who gets confused. Until this gets merged, you can switch to this branch with:

asdf plugin remove java
asdf plugin add java https://github.com/nunezger/asdf-java
asdf plugin update java fix-cache-file

If you then run asdf list all java, it's going to show only the ARM vms, just like before, so it will seem like it isn't working. But if you do arch -x86_64 /bin/zsh, you will now be inside a zsh running within rosetta. And now if you do asdf list all java, you'll get all x86_64 VMs. And if you do asdf global java [[SOME_x86_64_JVM]] it will stick around even in fresh terminals that aren't started with the arch -x86_64 mumbo-jumbo.

joschi commented 3 years ago

@nunezger Could you write an explanation of what @nedtwigg described into the README file?

Otherwise people might run into the same questions when trying out asdf-java. 😄

halcyon commented 3 years ago

LGTM! Thank you!