halcyon / asdf-java

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

Add support for aarch64 and armv7l machine architectures #129

Closed joschi closed 3 years ago

joschi commented 3 years ago

Closes #123 Closes #47

joschi commented 3 years ago

Demo on a Raspberry Pi 3 Model B+:

pi@raspberrypi:~ $ uname -a
Linux raspberrypi 5.4.51-v7+ #1333 SMP Mon Aug 10 16:45:19 BST 2020 armv7l GNU/Linux
pi@raspberrypi:~ $ git clone https://github.com/asdf-vm/asdf.git ~/.asdf
# [...]
pi@raspberrypi:~ $ . .asdf/asdf.sh
pi@raspberrypi:~ $ asdf plugin-add java https://github.com/joschi/asdf-java/
pi@raspberrypi:~ $ git -C ~/.asdf/plugins/java/ checkout aarch64-support
# [...]
Switched to a new branch 'aarch64-support'
pi@raspberrypi:~ $ asdf list-all java
# [...]
liberica-lite-15.0.2+10
pi@raspberrypi:~ $ asdf install java liberica-lite-15.0.2+10
###################################### 100.0%
###################################### 100.0%
bellsoft-jdk15.0.2+10-linux-arm32-vfp-hflt-lite.tar.gz
bellsoft-jdk15.0.2+10-linux-arm32-vfp-hflt-lite.tar.gz: OK
pi@raspberrypi:~ $ asdf shell java liberica-lite-15.0.2+10
pi@raspberrypi:~ $ java -version
openjdk version "15.0.2" 2021-01-19
OpenJDK Runtime Environment (build 15.0.2+10)
OpenJDK Server VM (build 15.0.2+10, mixed mode)
halcyon commented 3 years ago

@joschi Let me know when this is ready to be merged

joschi commented 3 years ago

@halcyon According to https://developer.apple.com/forums/thread/668206 (and other Google hits), macOS on Apple M1 hardware returns arm64 instead of aarch64 as its machine architecture.

This means that this PR would currently fail on Apple M1 hardware. Unfortunately I don't have any machine of that type at my disposal.

Other than that, I think we'd be good to go after reverting https://github.com/halcyon/asdf-java/pull/129/commits/b22682284b1eb842b04869a4e14a30d113fbacc5 in this branch.

rkrdo commented 3 years ago

@halcyon According to https://developer.apple.com/forums/thread/668206 (and other Google hits), macOS on Apple M1 hardware returns arm64 instead of aarch64 as its machine architecture.

This means that this PR would currently fail on Apple M1 hardware. Unfortunately I don't have any machine of that type at my disposal.

Other than that, I think we'd be good to go after reverting b226822 in this branch.

@joschi I have an M1 Mac and was able to run your branch and install a JDK successfully:

asdf-java [aarch64-support] % asdf list all asdf-java
liberica-8u282+8
liberica-11.0.10+9
liberica-15.0.2+8
liberica-15.0.2+10
liberica-javafx-8u282+8
liberica-javafx-11.0.10+9
liberica-javafx-15.0.2+8
liberica-javafx-15.0.2+10
liberica-lite-11.0.10+9
liberica-lite-15.0.2+8
liberica-lite-15.0.2+10
zulu-8.52.0.23
zulu-11.43.1017
zulu-11.43.1021
zulu-11.45.27
zulu-13.35.1019
zulu-13.35.1025
zulu-13.37.21
zulu-15.28.1013
zulu-15.29.15
zulu-javafx-8.52.0.23
zulu-javafx-11.45.27
zulu-javafx-13.37.21
zulu-javafx-15.29.15
asdf-java [aarch64-support] % asdf install asdf-java zulu-11.45.27
##################################################################################################################################################################################################### 100.0%
zulu11.45.27-ca-jdk11.0.10-macosx_aarch64.zip
zulu11.45.27-ca-jdk11.0.10-macosx_aarch64.zip: OK
Archive:  zulu11.45.27-ca-jdk11.0.10-macosx_aarch64.zip
# ...

In the master branch I can't get anything to show up when running asdf list all asdf-java

joschi commented 3 years ago

@rkrdo Thank you very much for verifying the PR! 😄

@halcyon I think we're good to go. I've reverted the commit to fetch the data files from my branch instead of master, so we can merge this PR when you're ready.