Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Java plugin for [vfox](https://vfox.dev/).

It installs JDKs from 18 distributions, among them Temurin, Zulu, Liberica, Corretto, Microsoft and GraalVM, looked up through [Foojay](https://foojay.io/). On Linux loong64 it installs from the Loongnix archive instead.
It installs JDKs from 31 distributions, among them Temurin, Zulu, Liberica, Corretto, Microsoft and GraalVM, looked up through [Foojay](https://foojay.io/). On Linux loong64 it installs from the Loongnix archive instead.

## Install

Expand Down Expand Up @@ -32,6 +32,8 @@ java -version

`vfox search java tem` lists the Temurin releases, and in an interactive terminal it lets you pick one and installs it.

Behavior that only exists on `main` and not in the latest release is marked "Unreleased" in the pages below. [docs/changes.md](docs/changes.md) lists it, and [docs/install-from-source.md](docs/install-from-source.md) gets you `main`.

## Versions and names

A version is `<version>-<distribution>`, such as `21.0.8-tem`, with `-fx` after it for JavaFX. Without a distribution you get OpenJDK from jdk.java.net, which has nothing newer than 17.0.2 for 17 and 21.0.2 for 21. See [docs/versions.md](docs/versions.md) for details.
Expand All @@ -58,13 +60,23 @@ A version is `<version>-<distribution>`, such as `21.0.8-tem`, with `-fx` after
| `mandrel` | Mandrel (Red Hat) |
| `jb` | JetBrains Runtime |
| `trava` | TravaOpenJDK |
| `adpt`, `adptj9` | AdoptOpenJDK with HotSpot, with OpenJ9 |
| `eliya` | Eliya JDK (Asymm Systems) |
| `ojdkbld` | OJDKBuild |
| `opnlgc` | OpenLogic OpenJDK |
| `rdht` | Red Hat build of OpenJDK |
| `semcrt` | Semeru, certified edition (IBM) |
| `gln` | Gluon GraalVM |
| `grl8`, `grl11`, `grl16`, `grl17`, `grl19` | GraalVM CE for JDK 8 to 19 |
| `lnxabi1`, `lnxabi2` | Loongnix, Linux loong64 only |

See [docs/distributions.md](docs/distributions.md) for what each one is, and [docs/loongnix.md](docs/loongnix.md) for the last row.
Unreleased: release 0.6.2 has the rows up to `trava`, and the Loongnix one.

The short names follow SDKMAN's identifiers, with a few differences: SDKMAN calls JetBrains Runtime `jbr`, and it wrote the virtual machine or JDK of AdoptOpenJDK and GraalVM CE into the version (`11.0.10.j9-adpt`, `22.3.3.r17-grl`), where the plugin has a name for each (`adptj9`, `grl17`). Eliya, OJDKBuild, OpenLogic, Red Hat and Semeru certified have no SDKMAN identifier, so their short names are the plugin's own. See [docs/distributions.md](docs/distributions.md) for all the differences and for what each distribution is, and [docs/loongnix.md](docs/loongnix.md) for the last row.

## Platforms

Not every distribution has builds for arm64, Alpine or Windows on ARM. Only Temurin, Zulu, Liberica, Microsoft and JetBrains Runtime have Windows ARM64 builds, 10 of the 18 have Alpine x64 builds and 7 have Alpine arm64. GraalVM has neither Windows ARM64 nor Alpine. See [docs/platforms.md](docs/platforms.md) for the table.
Not every distribution has builds for arm64, Alpine or Windows on ARM. Only Temurin, Zulu, Liberica, Microsoft and JetBrains Runtime have Windows ARM64 builds, 11 of the 31 have Alpine x64 builds and 7 have Alpine arm64. GraalVM has neither Windows ARM64 nor Alpine. See [docs/platforms.md](docs/platforms.md) for the table.

## JavaFX

Expand Down
18 changes: 15 additions & 3 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

[vfox](https://vfox.dev/) 的 Java 插件。

它通过 [Foojay](https://foojay.io/) 查找并安装 18 个发行版的 JDK,包括 Temurin、Zulu、Liberica、Corretto、Microsoft、GraalVM 等。在 Linux loong64 上,则改从 Loongnix 归档安装。
它通过 [Foojay](https://foojay.io/) 查找并安装 31 个发行版的 JDK,包括 Temurin、Zulu、Liberica、Corretto、Microsoft、GraalVM 等。在 Linux loong64 上,则改从 Loongnix 归档安装。

## 安装

Expand Down Expand Up @@ -32,6 +32,8 @@ java -version

`vfox search java tem` 会列出 Temurin 的各个版本,在交互式终端里还可以直接选一个并安装。

只存在于 `main`、还没进入最新发布版的行为,在下面各页里标有“未发布”。完整列表见 [docs/zh-CN/changes.md](docs/zh-CN/changes.md),想直接用上 `main`,见 [docs/zh-CN/install-from-source.md](docs/zh-CN/install-from-source.md)。

## 版本与命名

版本写成 `<版本>-<发行版>`,例如 `21.0.8-tem`,后面加 `-fx` 表示带 JavaFX。不写发行版时得到的是 jdk.java.net 上的 OpenJDK,它的 17 只到 17.0.2,21 只到 21.0.2。详见 [docs/zh-CN/versions.md](docs/zh-CN/versions.md)。
Expand All @@ -58,13 +60,23 @@ java -version
| `mandrel` | Mandrel(Red Hat) |
| `jb` | JetBrains Runtime |
| `trava` | TravaOpenJDK |
| `adpt`、`adptj9` | AdoptOpenJDK,HotSpot 版和 OpenJ9 版 |
| `eliya` | Eliya JDK(Asymm Systems) |
| `ojdkbld` | OJDKBuild |
| `opnlgc` | OpenLogic OpenJDK |
| `rdht` | Red Hat build of OpenJDK |
| `semcrt` | Semeru 认证版(IBM) |
| `gln` | Gluon GraalVM |
| `grl8`、`grl11`、`grl16`、`grl17`、`grl19` | 基于 JDK 8 到 19 的 GraalVM CE |
| `lnxabi1`、`lnxabi2` | Loongnix,仅限 Linux loong64 |

每个发行版是什么,见 [docs/zh-CN/distributions.md](docs/zh-CN/distributions.md);最后一行见 [docs/zh-CN/loongnix.md](docs/zh-CN/loongnix.md)。
未发布:0.6.2 只有到 `trava` 为止的那些行,以及 Loongnix 那一行。

简称沿用 SDKMAN 的标识符,有几处不同:JetBrains Runtime 在 SDKMAN 里叫 `jbr`;AdoptOpenJDK 和 GraalVM CE 的虚拟机或 JDK 版本,SDKMAN 当时写在版本号里(`11.0.10.j9-adpt`、`22.3.3.r17-grl`),插件则给每种各起一个简称(`adptj9`、`grl17`)。Eliya、OJDKBuild、OpenLogic、Red Hat 和 Semeru 认证版在 SDKMAN 里没有标识符,简称是插件自己起的。全部差别以及每个发行版是什么,见 [docs/zh-CN/distributions.md](docs/zh-CN/distributions.md);最后一行见 [docs/zh-CN/loongnix.md](docs/zh-CN/loongnix.md)。

## 平台

并非每个发行版都有 arm64、Alpine 或 Windows ARM 的构建。只有 Temurin、Zulu、Liberica、Microsoft 和 JetBrains Runtime 有 Windows ARM64 的构建,18 个发行版里有 10 个有 Alpine x64 的构建,7 个有 Alpine arm64 的构建。GraalVM 既没有 Windows ARM64,也没有 Alpine。完整的表格见 [docs/zh-CN/platforms.md](docs/zh-CN/platforms.md)。
并非每个发行版都有 arm64、Alpine 或 Windows ARM 的构建。只有 Temurin、Zulu、Liberica、Microsoft 和 JetBrains Runtime 有 Windows ARM64 的构建,31 个发行版里有 11 个有 Alpine x64 的构建,7 个有 Alpine arm64 的构建。GraalVM 既没有 Windows ARM64,也没有 Alpine。完整的表格见 [docs/zh-CN/platforms.md](docs/zh-CN/platforms.md)。

## JavaFX

Expand Down
6 changes: 5 additions & 1 deletion docs/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

[中文](zh-CN/changes.md) | [English](changes.md)

What changed in each release, as a user notices it. GitHub's release pages list the pull requests.
What changed in each release, as a user notices it. GitHub's release pages list the pull requests. The newest release at the time of writing is 0.6.2, and `main` is ahead of it by everything under "Unreleased". [install-from-source.md](install-from-source.md) gets you those changes now.

## Unreleased

- 13 more distributions, the rest of what Foojay lists: AdoptOpenJDK (`adpt`, `adptj9`), Eliya (`eliya`), OJDKBuild (`ojdkbld`), OpenLogic (`opnlgc`), Red Hat (`rdht`), Semeru certified (`semcrt`), Gluon GraalVM (`gln`) and GraalVM CE for JDK 8 to 19 (`grl8`, `grl11`, `grl16`, `grl17`, `grl19`). Red Hat installs from tar.xz, and OJDKBuild on Linux, OpenLogic on macOS and Gluon GraalVM before 22.1 from zips. A `.sdkmanrc` takes SDKMAN's old identifiers for them, such as `11.0.10.j9-adpt` and `22.3.3.r17-grl`. See [distributions.md](distributions.md).

## 0.6.2 (2026-10-18)

Expand Down
44 changes: 26 additions & 18 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ hooks/env_keys.lua JAVA_HOME and PATH
hooks/pre_use.lua vfox use: map what was typed to an installed name
hooks/parse_legacy_file.lua .sdkmanrc
lib/distribution_version.lua distribution names, parsing of specs, GraalVM feature releases
lib/foojay.lua the Foojay request
lib/foojay.lua the Foojay request, and fixes to what it answers
lib/installed_version.lua matching against installed names
lib/loongnix.lua the Loongnix archive
tests/*_test.lua offline hook tests
Expand Down Expand Up @@ -46,13 +46,15 @@ A few contracts that cost time to find:

Installed names are `<java_version>[-<short name>][-fx]`, with no short name for OpenJDK ([versions.md](versions.md#installed-names)). `lib/distribution_version.lua` reads a spec into a version, a distribution and the JavaFX flag, in either order (`21-tem`, `tem-21`). `lib/installed_version.lua` turns a version the user typed into an installed name: the name itself first. A bare major then takes the newest installed release of it, and any other version takes the release itself or its newest build. `PreUse` stops there. `ParseLegacyFile` goes one step further and falls back to the newest installed release of the major.

SDKMAN spells some things differently (`jbr`, `21.0.12.fx-zulu`, `21.0.12-fx+1.1-librca`, `28.0.0+ea.19-open`), and `plugin_spelling` in `hooks/parse_legacy_file.lua` rewrites them into the plugin's before parsing. `installed_version.unpad` drops the zeros SDKMAN pads releases with (`27.0.0+36` is `27+36`). The plugin's short names are SDKMAN's, except `jb`.
SDKMAN spells some things differently (`jbr`, `21.0.12.fx-zulu`, `21.0.12-fx+1.1-librca`, `28.0.0+ea.19-open`), and `plugin_spelling` in `hooks/parse_legacy_file.lua` rewrites them into the plugin's before parsing. For the distributions SDKMAN no longer lists, `sdkman_flavours` there turns the virtual machine or JDK in SDKMAN's version into the short name (`22.3.3.r17-grl` is `22.3.3-grl17`). `installed_version.unpad` drops the zeros SDKMAN pads releases with (`27.0.0+36` is `27+36`). Where the short names differ from SDKMAN's is in [distributions.md](distributions.md#short-names-and-sdkman).

## Foojay

- A `+` in a query has to be percent-encoded. Foojay reads a bare one as a space and drops the build, so `21.0.5+63130` would match every 21.0.5 build.
- `version=21` is the GA build `21+35`. A bare major adds `latest=available` to get the newest 21.x.
- Windows asks for `zip` and `tar.gz` in one request. JetBrains Runtime ships Windows zips for its newer builds only. `PreInstall` takes the zip when a version has both.
- Elsewhere `other_archive_type` in `lib/foojay.lua` adds one archive type for the distributions that ship no tar.gz there for some or all releases: `tar.xz` for Red Hat, `zip` for OJDKBuild, OpenLogic and Gluon GraalVM. vfox unpacks both, and the zips carry their Unix permissions, so `bin/java` stays executable.
- `fixes` in `lib/foojay.lua` drops packages before the hooks see them: the JREs, installer bundles and RHEL 6 builds that Foojay lists among OJDKBuild's Windows JDKs, and the JDK 11 builds of Gluon GraalVM's 22.x releases, which share their version with the JDK 17 ones. For a bare major `latest=available` answers with one package per archive type, which can be one the fix drops, so for these two the plugin then asks for that release in full.
- `Available` lists a name once where Foojay has two records for it.
- Foojay marks GraalVM's monthly feature releases (`25.1.3` and on) as LTS. `is_feature_release` in `lib/distribution_version.lua` recognises them, by the minor number, and `Available` drops the note. It is for `graal` and `graalce` only: Mandrel and Liberica NIK numbered their releases after themselves up to 24 (`mandrel` `23.1.12` is LTS) and follow the JDK from 25 on.
- For a bare major of Oracle GraalVM (`graal`) only, `PreInstall` skips the feature releases, so the 25.0 line is installed. A major that has nothing but feature releases keeps them. GraalVM Community is not filtered, because its feature releases are what it still ships.
Expand All @@ -70,7 +72,7 @@ go run github.com/yuin/gopher-lua/cmd/glua@v1.1.1 tests/loongnix_test.lua
go run github.com/yuin/gopher-lua/cmd/glua@v1.1.1 tests/post_install_test.lua
```

Run them from the repository root. All five load `tests/support.lua`, which stubs `vfox.strings`, and `tests/pre_install_test.lua` and `tests/loongnix_test.lua` stub `http` and `json` themselves. `tests/pre_install_test.lua` keeps Foojay's answers in a table at the top, keyed by `<distribution> [<version>] [<latest>]`, with `windows` in front for Windows. Add the answer a new case needs there, and note the day you observed it. Lint, license headers and the container tests are in [e2e.md](e2e.md#local-checks).
Run them from the repository root. All five load `tests/support.lua`, which stubs `vfox.strings`, and `tests/pre_install_test.lua` and `tests/loongnix_test.lua` stub `http` and `json` themselves. `tests/pre_install_test.lua` keeps Foojay's answers in a table at the top, keyed by `<distribution> [<version>] [<latest>]`, with `windows` or `macos` in front for those systems. Add the answer a new case needs there, and note the day you observed it. Lint, license headers and the container tests are in [e2e.md](e2e.md#local-checks).

To call a single hook against the real Foojay, vfox 1.0.13 and later has `vfox plugin run`. It does not register the plugin, and `--os` and `--arch` answer for another platform:

Expand All @@ -85,40 +87,46 @@ vfox plugin run . ParseLegacyFile --input '{"filename":".sdkmanrc","filepath":"/
## Adding a distribution

1. Find its id in Foojay ([foojay.md](foojay.md)), and check that it has packages for the platforms you care about.
2. Add `["<short name>"] = "<foojay id>"` to `short_name` in `lib/distribution_version.lua`. Use SDKMAN's identifier when SDKMAN has the distribution. If SDKMAN spells it differently, map it in `plugin_spelling` in `hooks/parse_legacy_file.lua`.
3. If its version numbers or its LTS marks need special care, as GraalVM's do, handle that in `hooks/available.lua` and `hooks/pre_install.lua`.
2. Add `["<short name>"] = "<foojay id>"` to `short_name` in `lib/distribution_version.lua`. Use SDKMAN's identifier when SDKMAN has or had the distribution. Otherwise make one the way SDKMAN does: keep a short vendor name whole, and cut a longer one down, mostly by dropping vowels (`opnlgc`). If SDKMAN spells it differently, map it in `plugin_spelling` in `hooks/parse_legacy_file.lua`, and add the difference to [distributions.md](distributions.md#short-names-and-sdkman).
3. If its version numbers or its LTS marks need special care, as GraalVM's do, handle that in `hooks/available.lua` and `hooks/pre_install.lua`. If it ships no tar.gz outside Windows, add its archive type to `other_archive_type` in `lib/foojay.lua`, and if Foojay lists packages of it that do not install as they are, add a fix to `fixes` there.
4. Add a case to `tests/pre_install_test.lua`.
5. Update the tables in `README.md`, [distributions.md](distributions.md) and [platforms.md](platforms.md), and their translations in `README_CN.md` and `docs/zh-CN`.
6. For a new code path, also add it to the e2e matrix ([e2e.md](e2e.md)). Distributions outside the matrix still run every check except the `java.vendor` assertion and the asdf-style `PreUse` spelling.
6. For a new code path, also add it to the e2e matrix ([e2e.md](e2e.md)). Distributions outside the matrix still run every check except the `java.vendor` assertion and the asdf-style `PreUse` spelling. One that only brings a name goes into `nameOnly` in `tests/e2e/common/common.go` instead, with the runner platforms Foojay has it for.

## Refreshing the platform table

[platforms.md](platforms.md) was taken from Foojay. This prints, for each platform, which distributions have a build there, in 8 requests:
[platforms.md](platforms.md) was taken from Foojay. This prints, for each platform, which distributions have a build there, in 14 requests. Outside Windows a second request per platform asks for the archive types that Red Hat, OJDKBuild, OpenLogic and Gluon GraalVM ship there besides tar.gz, as the plugin does:

```bash
base='https://api.foojay.io/disco/v3.0/packages/jdks?directly_downloadable=true&latest=per_distro'
while read -r name query; do
printf '%-14s ' "$name"
curl -s "$base&$query" | jq -r '.result[].distribution' | sort -u | tr '\n' ' '; echo
{
curl -s "$base&$query&archive_type=tar.gz" | jq -r '.result[].distribution'
case $name in windows-*) ;; *)
curl -s "$base&$query&archive_type=tar.xz&archive_type=zip" | jq -r '.result[].distribution
| select(. == "redhat" or . == "ojdk_build" or . == "openlogic" or . == "gluon_graalvm")' ;;
esac
} | sort -u | tr '\n' ' '; echo
done <<'EOF'
linux-x64 architecture=amd64&operating_system=linux&lib_c_type=glibc&archive_type=tar.gz
linux-arm64 architecture=aarch64&operating_system=linux&lib_c_type=glibc&archive_type=tar.gz
alpine-x64 architecture=amd64&operating_system=linux&lib_c_type=musl&archive_type=tar.gz
alpine-arm64 architecture=aarch64&operating_system=linux&lib_c_type=musl&archive_type=tar.gz
macos-intel architecture=amd64&operating_system=macos&archive_type=tar.gz
macos-arm64 architecture=aarch64&operating_system=macos&archive_type=tar.gz
windows-x64 architecture=x64&operating_system=windows&archive_type=zip&archive_type=tar.gz
windows-arm64 architecture=aarch64&operating_system=windows&archive_type=zip&archive_type=tar.gz
linux-x64 architecture=amd64&operating_system=linux&lib_c_type=glibc
linux-arm64 architecture=aarch64&operating_system=linux&lib_c_type=glibc
alpine-x64 architecture=amd64&operating_system=linux&lib_c_type=musl
alpine-arm64 architecture=aarch64&operating_system=linux&lib_c_type=musl
macos-intel architecture=amd64&operating_system=macos
macos-arm64 architecture=aarch64&operating_system=macos
windows-x64 architecture=x64&operating_system=windows&archive_type=zip
windows-arm64 architecture=aarch64&operating_system=windows&archive_type=zip
EOF
```

The ids are Foojay's (`oracle_open_jdk` is `open`). The notes under "Only some releases" need one query per distribution and platform without `latest`, grouped by `major_version`.
The ids are Foojay's (`oracle_open_jdk` is `open`). It prints `redhat` for Linux arm64 and Windows x64 too, which the table leaves out, as those downloads answer 404. The notes under "Only some releases" need one query per distribution and platform without `latest`, grouped by `major_version`.

## Known gaps

- Downloads are not verified, see above.
- `vfox search` lists GA releases only. Early-access builds install by name.
- Foojay distributions without a short name ([distributions.md](distributions.md#foojay-distributions-the-plugin-does-not-offer)), and JRE packages, are not offered.
- JRE packages are not offered, and neither are the JDK 11 builds of Gluon GraalVM's 22.x releases.
- Only Linux loong64 has a source besides Foojay.

## Releasing
Expand Down
Loading
Loading