Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 32-bit arm architecture detection missing #1773

Merged
merged 3 commits into from
Mar 31, 2024

Conversation

sxa
Copy link
Contributor

@sxa sxa commented Mar 18, 2024

The initial jbang shell script can download it's default JDK (Unless it detects an existing JDK on the system, when it will use the java version).

In all other cases, it sets the architecture to unknown so this PR will allow it to detect the 32-bit arm architecture properly.

Noting that this will generate a merge conflict with my riscv64 PR due to the Arch list but it's an easy merge :-)

Initially draft as I haven't test built it.

@sxa sxa marked this pull request as ready for review March 18, 2024 17:46
@sxa sxa marked this pull request as draft March 18, 2024 17:47
Signed-off-by: Stewart X Addison <[email protected]>
@sxa sxa marked this pull request as ready for review March 18, 2024 17:50
@sxa
Copy link
Contributor Author

sxa commented Mar 18, 2024

Before fix (copying jbang.jar into place from the build):

jb@odroid-2:~$ jbang jdk list --available --verbose
[jbang] [3:286] jbang version 0.115.0
[jbang] [3:328] Unknown Arch: arm
[jbang] [4:385] Requesting HTTP GET https://api.foojay.io/disco/v3.0/packages?distro=temurin&javafx_bundled=false&libc_type=glibc&directly_downloadable=true&archive_type=tar.gz&operating_system=linux&package_type=jdk&release_status=ga%2Cea&architecture=unknown&latest=available
[jbang] [4:386] Headers {User-Agent=[JBang/0.115.0 (Linux/5.4.156-234/arm) Java/17.0.1/Eclipse Adoptium]}
[jbang] [11:411] HTTP: 400 - {
  "result":[],
  "message":"invalid architecture"
}
[jbang] [11:567] Couldn't list available JDKs
java.io.IOException: Server returned HTTP response code: 400 for URL: https://api.foojay.io/disco/v3.0/packages?distro=temurin&javafx_bundled=false&libc_type=glibc&directly_downloadable=true&archive_type=tar.gz&operating_system=linux&package_type=jdk&release_status=ga%2Cea&architecture=unknown&latest=available with message: invalid architecture
	at dev.jbang.util.Util$ResultHandler.lambda$throwOnError$1(Util.java:933)
	at dev.jbang.util.Util$ResultHandler.lambda$redirects$0(Util.java:894)

After fix:

jb@odroid-2:~$ jbang jdk list --available
   8 (8.0.402+6)
   9 (9-ea)
   10 (10.0.2)
   11 (11.0.22+7)
   12 (12.0.2)
   13 (13.0.2)
   14 (14.0.2)
   15 (15.0.2)
   16 (16.0.2+7)
   17 (17.0.10+7)
   18 (18.0.2.1+1)
   19 (19.0.2+7)
   20 (20.0.2-ea+9)
   21 (21.0.1-ea+12)
   22 (22-ea+23)
   23 (23-ea+4)
jb@odroid-2:~$ 

(I'm glossing over the fact here that JDK21+ do not have a GA version on the platform, so while the early access ones are downloadable they

@quintesse
Copy link
Contributor

(I'm glossing over the fact here that JDK21+ do not have a GA version on the platform, so while the early access ones are downloadable they

they....? The suspense is killing me! :-)

@sxa
Copy link
Contributor Author

sxa commented Mar 19, 2024

(I'm glossing over the fact here that JDK21+ do not have a GA version on the platform, so while the early access ones are downloadable they

they....? The suspense is killing me! :-)

I know what happened there - I went to confirn something and didn't come back to finish the thought ...

They ... are not likely to get updated from the ea versions listed in the jbang jdk list output shown above.

@quintesse
Copy link
Contributor

quintesse commented Mar 19, 2024

Btw, for something completely unrelated:

Before fix (copying jbang.jar into place from the build):

After doing a gradle build of the code you can actually run the jbang script from the target/install/jbang/bin folder and it will pick up the .jar file from the same place, that way there's no need to copy anything.

@sxa
Copy link
Contributor Author

sxa commented Mar 20, 2024

Btw, for something completely unrelated:

Before fix (copying jbang.jar into place from the build):

After doing a gradle build of the code you can actually run the jbang script from the target/install/jbang/bin folder and it will pick up the .jar file from the same place, that way there's no need to copy anything.

Thanks! I figured there was almost certainly a more "normal" workflow for this but didn't find it in the docs - I might submit a small PR for that too to help others

@quintesse
Copy link
Contributor

I might submit a small PR for that too to help others

That would be awesome! For completeness sake I'll then mention that the jbang script (well, "scripts", for bash-likes, CMD and Powershell) will actually use any jbang.jar that's found in the same folder (or in a .jbang subfolder) as the script itself.

maxandersen
maxandersen previously approved these changes Mar 31, 2024
@maxandersen
Copy link
Collaborator

@all-contributors please add @sxa for code

Copy link
Contributor

@maxandersen

@sxa already contributed before to code

@maxandersen maxandersen merged commit c26de98 into jbangdev:main Mar 31, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants