mirror of
https://github.com/actions/setup-java.git
synced 2026-11-20 03:13:05 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
60d2c8e17e | ||
|
|
3fc1c6e612 | ||
|
|
3c7a629527 | ||
|
|
d1374f8ac7 | ||
|
|
5fb63c9bc9 | ||
|
|
a1bf0b5568 | ||
|
|
a3c8068301 | ||
|
|
9ce5b12cb9 |
19
.github/workflows/e2e-versions.yml
vendored
19
.github/workflows/e2e-versions.yml
vendored
@@ -51,6 +51,15 @@ jobs:
|
|||||||
- distribution: microsoft
|
- distribution: microsoft
|
||||||
os: macos-latest
|
os: macos-latest
|
||||||
version: 25
|
version: 25
|
||||||
|
- distribution: microsoft
|
||||||
|
os: windows-latest
|
||||||
|
version: '25.0.5+0.2'
|
||||||
|
- distribution: microsoft
|
||||||
|
os: ubuntu-latest
|
||||||
|
version: '25.0.5+0.2'
|
||||||
|
- distribution: microsoft
|
||||||
|
os: macos-latest
|
||||||
|
version: '25.0.5+0.2'
|
||||||
- distribution: kona
|
- distribution: kona
|
||||||
os: windows-latest
|
os: windows-latest
|
||||||
version: 25
|
version: 25
|
||||||
@@ -71,10 +80,14 @@ jobs:
|
|||||||
version: 25
|
version: 25
|
||||||
- distribution: oracle
|
- distribution: oracle
|
||||||
os: macos-15-intel
|
os: macos-15-intel
|
||||||
version: 21
|
version: 25
|
||||||
- distribution: oracle
|
- distribution: oracle
|
||||||
os: windows-latest
|
os: windows-latest
|
||||||
version: 21
|
version: 25
|
||||||
|
- distribution: oracle
|
||||||
|
os: ubuntu-latest
|
||||||
|
version: 25
|
||||||
|
# Oracle no longer publishes JDK 21 under /latest, so a major-only request resolves to the archived GA build.
|
||||||
- distribution: oracle
|
- distribution: oracle
|
||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
version: 21
|
version: 21
|
||||||
@@ -118,7 +131,7 @@ jobs:
|
|||||||
JAVA_VERSION: ${{ matrix.version }}
|
JAVA_VERSION: ${{ matrix.version }}
|
||||||
JAVA_PATH: ${{ steps.setup-java.outputs.path }}
|
JAVA_PATH: ${{ steps.setup-java.outputs.path }}
|
||||||
SETUP_JAVA_VERSION: ${{ steps.setup-java.outputs.version }}
|
SETUP_JAVA_VERSION: ${{ steps.setup-java.outputs.version }}
|
||||||
REQUIRE_CONCRETE_VERSION: ${{ (matrix.distribution == 'oracle' || matrix.distribution == 'graalvm') && !contains(matrix.version, '.') && !contains(matrix.version, '-ea') }}
|
REQUIRE_CONCRETE_VERSION: ${{ ((matrix.distribution == 'oracle' && matrix.version != 21) || matrix.distribution == 'graalvm') && !contains(matrix.version, '.') && !contains(matrix.version, '-ea') }}
|
||||||
run: bash __tests__/verify-java.sh "$JAVA_VERSION" "$JAVA_PATH" "$SETUP_JAVA_VERSION" "$REQUIRE_CONCRETE_VERSION"
|
run: bash __tests__/verify-java.sh "$JAVA_VERSION" "$JAVA_PATH" "$SETUP_JAVA_VERSION" "$REQUIRE_CONCRETE_VERSION"
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
|
|||||||
225
.github/workflows/latest-jdk-versions.yml
vendored
Normal file
225
.github/workflows/latest-jdk-versions.yml
vendored
Normal file
@@ -0,0 +1,225 @@
|
|||||||
|
# Daily report of the exact JDK version each distribution currently resolves
|
||||||
|
# for every major from Java 6 through the newest GA release, and `latest`, on every operating
|
||||||
|
# system and architecture setup-java supports for it. Versions are resolved
|
||||||
|
# from vendor metadata only; no JDK is downloaded. Compare main and the latest
|
||||||
|
# v6/v5 tags using each revision's own installers and locked dependencies.
|
||||||
|
name: Latest JDK versions report
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '30 6 * * *'
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
java-versions:
|
||||||
|
description: 'Comma-separated java-version values (default: every major from Java 6 through the newest GA release, and latest)'
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- 'src/reports/**'
|
||||||
|
- 'scripts/build-report-resolver.mjs'
|
||||||
|
- '__tests__/latest-versions-report.test.ts'
|
||||||
|
- '.github/workflows/latest-jdk-versions.yml'
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build report tool
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v7
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v7
|
||||||
|
with:
|
||||||
|
node-version: '24.x'
|
||||||
|
cache: npm
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm ci
|
||||||
|
- name: Bundle report tool
|
||||||
|
run: npm run build:latest-versions-report
|
||||||
|
- name: Upload report tool
|
||||||
|
uses: actions/upload-artifact@v7
|
||||||
|
with:
|
||||||
|
name: latest-versions-report-tool
|
||||||
|
path: lib/latest-versions-report/
|
||||||
|
retention-days: 1
|
||||||
|
|
||||||
|
build-resolvers:
|
||||||
|
name: Build resolver (${{ matrix.setup-java }})
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
setup-java: [main, v6, v5]
|
||||||
|
steps:
|
||||||
|
- name: Checkout report tooling
|
||||||
|
uses: actions/checkout@v7
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
- name: Checkout setup-java revision
|
||||||
|
uses: actions/checkout@v7
|
||||||
|
with:
|
||||||
|
repository: actions/setup-java
|
||||||
|
ref: ${{ matrix.setup-java }}
|
||||||
|
path: resolver-source
|
||||||
|
persist-credentials: false
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v7
|
||||||
|
with:
|
||||||
|
node-version: '24.x'
|
||||||
|
cache: npm
|
||||||
|
cache-dependency-path: resolver-source/package-lock.json
|
||||||
|
- name: Install revision dependencies
|
||||||
|
working-directory: resolver-source
|
||||||
|
run: npm ci
|
||||||
|
- name: Bundle revision metadata resolver
|
||||||
|
run: node scripts/build-report-resolver.mjs resolver-source "$SETUP_JAVA_REF" resolver
|
||||||
|
env:
|
||||||
|
SETUP_JAVA_REF: ${{ matrix.setup-java }}
|
||||||
|
- name: Upload revision metadata resolver
|
||||||
|
uses: actions/upload-artifact@v7
|
||||||
|
with:
|
||||||
|
name: jdk-metadata-resolver-${{ matrix.setup-java }}
|
||||||
|
path: resolver/
|
||||||
|
retention-days: 1
|
||||||
|
|
||||||
|
resolve:
|
||||||
|
name: Resolve versions (${{ matrix.setup-java }}, ${{ matrix.platform }})
|
||||||
|
needs: [build, build-resolvers]
|
||||||
|
if: ${{ !cancelled() && needs.build.result == 'success' }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
timeout-minutes: 30
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
setup-java: [main, v6, v5]
|
||||||
|
platform: [linux, macos, windows, solaris]
|
||||||
|
include:
|
||||||
|
- os: ubuntu-latest
|
||||||
|
platform: linux
|
||||||
|
- os: macos-latest
|
||||||
|
platform: macos
|
||||||
|
- os: windows-latest
|
||||||
|
platform: windows
|
||||||
|
# Liberica's Solaris metadata is queried without running a Solaris JDK.
|
||||||
|
- os: ubuntu-latest
|
||||||
|
platform: solaris
|
||||||
|
steps:
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v7
|
||||||
|
with:
|
||||||
|
node-version: '24.x'
|
||||||
|
- name: Download report tool
|
||||||
|
uses: actions/download-artifact@v8
|
||||||
|
with:
|
||||||
|
name: latest-versions-report-tool
|
||||||
|
path: tool
|
||||||
|
- name: Download revision metadata resolver
|
||||||
|
uses: actions/download-artifact@v8
|
||||||
|
with:
|
||||||
|
name: jdk-metadata-resolver-${{ matrix.setup-java }}
|
||||||
|
path: resolver
|
||||||
|
- name: Resolve latest versions without downloading
|
||||||
|
run: node tool/index.js resolve "results/$SETUP_JAVA_REF-$REPORT_PLATFORM.json"
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
|
REPORT_VERSIONS: ${{ inputs.java-versions }}
|
||||||
|
REPORT_PLATFORM: ${{ matrix.platform }}
|
||||||
|
REPORT_RESOLVER: resolver
|
||||||
|
SETUP_JAVA_REF: ${{ matrix.setup-java }}
|
||||||
|
- name: Upload resolved versions
|
||||||
|
uses: actions/upload-artifact@v7
|
||||||
|
with:
|
||||||
|
name: latest-jdk-versions-${{ matrix.setup-java }}-${{ matrix.platform }}
|
||||||
|
path: results/
|
||||||
|
retention-days: 1
|
||||||
|
|
||||||
|
# Installers pick musl builds on Alpine, which can resolve to other versions.
|
||||||
|
resolve-alpine:
|
||||||
|
name: Resolve versions (${{ matrix.setup-java }}, alpine)
|
||||||
|
needs: [build, build-resolvers]
|
||||||
|
if: ${{ !cancelled() && needs.build.result == 'success' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 30
|
||||||
|
container:
|
||||||
|
image: node:24-alpine
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
setup-java: [main, v6, v5]
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: sh
|
||||||
|
steps:
|
||||||
|
- name: Download report tool
|
||||||
|
uses: actions/download-artifact@v8
|
||||||
|
with:
|
||||||
|
name: latest-versions-report-tool
|
||||||
|
path: tool
|
||||||
|
- name: Download revision metadata resolver
|
||||||
|
uses: actions/download-artifact@v8
|
||||||
|
with:
|
||||||
|
name: jdk-metadata-resolver-${{ matrix.setup-java }}
|
||||||
|
path: resolver
|
||||||
|
- name: Resolve latest versions without downloading
|
||||||
|
run: node tool/index.js resolve "results/$SETUP_JAVA_REF-alpine.json"
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
|
REPORT_VERSIONS: ${{ inputs.java-versions }}
|
||||||
|
REPORT_RESOLVER: resolver
|
||||||
|
SETUP_JAVA_REF: ${{ matrix.setup-java }}
|
||||||
|
- name: Upload resolved versions
|
||||||
|
uses: actions/upload-artifact@v7
|
||||||
|
with:
|
||||||
|
name: latest-jdk-versions-${{ matrix.setup-java }}-alpine
|
||||||
|
path: results/
|
||||||
|
retention-days: 1
|
||||||
|
|
||||||
|
report:
|
||||||
|
name: Report
|
||||||
|
needs: [build, build-resolvers, resolve, resolve-alpine]
|
||||||
|
if: ${{ !cancelled() && needs.build.result == 'success' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v7
|
||||||
|
with:
|
||||||
|
node-version: '24.x'
|
||||||
|
- name: Download report tool
|
||||||
|
uses: actions/download-artifact@v8
|
||||||
|
with:
|
||||||
|
name: latest-versions-report-tool
|
||||||
|
path: tool
|
||||||
|
- name: Download resolved versions
|
||||||
|
uses: actions/download-artifact@v8
|
||||||
|
with:
|
||||||
|
pattern: latest-jdk-versions-*
|
||||||
|
path: results
|
||||||
|
merge-multiple: true
|
||||||
|
- name: Write report
|
||||||
|
if: ${{ !cancelled() }}
|
||||||
|
run: node tool/index.js summarize results latest-jdk-versions.md
|
||||||
|
env:
|
||||||
|
REPORT_REFS: main,v6,v5
|
||||||
|
- name: Upload report
|
||||||
|
if: ${{ !cancelled() }}
|
||||||
|
uses: actions/upload-artifact@v7
|
||||||
|
with:
|
||||||
|
name: latest-jdk-versions-report
|
||||||
|
path: |
|
||||||
|
latest-jdk-versions.md
|
||||||
|
results/
|
||||||
|
retention-days: 30
|
||||||
2
.licenses/npm/fast-xml-builder.dep.yml
generated
2
.licenses/npm/fast-xml-builder.dep.yml
generated
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: fast-xml-builder
|
name: fast-xml-builder
|
||||||
version: 1.3.0
|
version: 1.3.1
|
||||||
type: npm
|
type: npm
|
||||||
summary: Build XML from JSON without C/C++ based libraries
|
summary: Build XML from JSON without C/C++ based libraries
|
||||||
homepage:
|
homepage:
|
||||||
|
|||||||
2
.licenses/npm/fast-xml-parser.dep.yml
generated
2
.licenses/npm/fast-xml-parser.dep.yml
generated
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: fast-xml-parser
|
name: fast-xml-parser
|
||||||
version: 5.11.2
|
version: 5.12.0
|
||||||
type: npm
|
type: npm
|
||||||
summary: Validate XML, Parse XML, Build XML without C/C++ based libraries
|
summary: Validate XML, Parse XML, Build XML without C/C++ based libraries
|
||||||
homepage:
|
homepage:
|
||||||
|
|||||||
2
.licenses/npm/is-unsafe.dep.yml
generated
2
.licenses/npm/is-unsafe.dep.yml
generated
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: is-unsafe
|
name: is-unsafe
|
||||||
version: 2.0.0
|
version: 2.0.3
|
||||||
type: npm
|
type: npm
|
||||||
summary: Zero-dependency, DOM-free, pure predicate for detecting unsafe strings across
|
summary: Zero-dependency, DOM-free, pure predicate for detecting unsafe strings across
|
||||||
HTML, XML, SVG, SQL, SHELL, and REGEX contexts
|
HTML, XML, SVG, SQL, SHELL, and REGEX contexts
|
||||||
|
|||||||
2
.licenses/npm/strnum.dep.yml
generated
2
.licenses/npm/strnum.dep.yml
generated
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: strnum
|
name: strnum
|
||||||
version: 2.4.2
|
version: 2.5.1
|
||||||
type: npm
|
type: npm
|
||||||
summary: Parse String to Number based on configuration
|
summary: Parse String to Number based on configuration
|
||||||
homepage:
|
homepage:
|
||||||
|
|||||||
10
README.md
10
README.md
@@ -3,6 +3,7 @@
|
|||||||
[](https://github.com/actions/setup-java/actions/workflows/basic-validation.yml)
|
[](https://github.com/actions/setup-java/actions/workflows/basic-validation.yml)
|
||||||
[](https://github.com/actions/setup-java/actions/workflows/e2e-versions.yml)
|
[](https://github.com/actions/setup-java/actions/workflows/e2e-versions.yml)
|
||||||
[](https://github.com/actions/setup-java/actions/workflows/e2e-cache.yml)
|
[](https://github.com/actions/setup-java/actions/workflows/e2e-cache.yml)
|
||||||
|
[](https://github.com/actions/setup-java/actions/workflows/latest-jdk-versions.yml)
|
||||||
|
|
||||||
Set up Java for GitHub Actions workflows. `setup-java` installs a requested Java distribution, adds it to `PATH`, configures `JAVA_HOME`, and can optionally cache build dependencies for Apache Maven, Gradle, and sbt; generate Maven publishing configuration, verify JDK package signatures, manage multiple JDKs, and manage Maven toolchains.
|
Set up Java for GitHub Actions workflows. `setup-java` installs a requested Java distribution, adds it to `PATH`, configures `JAVA_HOME`, and can optionally cache build dependencies for Apache Maven, Gradle, and sbt; generate Maven publishing configuration, verify JDK package signatures, manage multiple JDKs, and manage Maven toolchains.
|
||||||
|
|
||||||
@@ -59,7 +60,7 @@ steps:
|
|||||||
- Warm JDK-cached jobs can reuse cached release metadata, avoiding vendor API calls while retaining a stale-metadata fallback for vendor outages and rate limits.
|
- Warm JDK-cached jobs can reuse cached release metadata, avoiding vendor API calls while retaining a stale-metadata fallback for vendor outages and rate limits.
|
||||||
- Maven configuration now supports multiple server credentials and custom dependency-resolution repositories.
|
- Maven configuration now supports multiple server credentials and custom dependency-resolution repositories.
|
||||||
- Maven signing keys are imported into an isolated temporary GPG home instead of the runner's default keyring.
|
- Maven signing keys are imported into an isolated temporary GPG home instead of the runner's default keyring.
|
||||||
- Set `problem-matcher: false` to disable Java compiler and uncaught-exception annotations.
|
- Java compiler and uncaught-exception annotations are now disabled by default. Set `problem-matcher: true` to enable them.
|
||||||
- GraalVM distributions now set `GRAALVM_HOME` in addition to `JAVA_HOME`.
|
- GraalVM distributions now set `GRAALVM_HOME` in addition to `JAVA_HOME`.
|
||||||
- Invalid boolean values, unsupported distribution/package/platform combinations, and mismatched Maven toolchain ID counts now fail with targeted errors.
|
- Invalid boolean values, unsupported distribution/package/platform combinations, and mismatched Maven toolchain ID counts now fail with targeted errors.
|
||||||
- Renamed environment-variable-name inputs so they are not mistaken for secret values:
|
- Renamed environment-variable-name inputs so they are not mistaken for secret values:
|
||||||
@@ -155,7 +156,7 @@ steps:
|
|||||||
| `check-latest` | Check remote metadata for the latest version satisfying the version spec before using the runner tool cache. | `false` |
|
| `check-latest` | Check remote metadata for the latest version satisfying the version spec before using the runner tool cache. | `false` |
|
||||||
| `force-download` | Always download Java and replace any matching version in the tool cache. | `false` |
|
| `force-download` | Always download Java and replace any matching version in the tool cache. | `false` |
|
||||||
| `set-default` | Add Java to `PATH` and set `JAVA_HOME`. When `false`, only version-specific `JAVA_HOME_<major>_<arch>` variables are set. | `true` |
|
| `set-default` | Add Java to `PATH` and set `JAVA_HOME`. When `false`, only version-specific `JAVA_HOME_<major>_<arch>` variables are set. | `true` |
|
||||||
| `problem-matcher` | Register Java compiler and uncaught exception problem matchers. | `true` |
|
| `problem-matcher` | Register Java compiler and uncaught exception problem matchers. | `false` |
|
||||||
| `verify-signature` | Verify downloaded Java package signatures when supported. Explicitly setting this to `true` makes verification failures fatal. | Distribution-dependent; see [Download integrity and signatures](#download-integrity-and-signatures) |
|
| `verify-signature` | Verify downloaded Java package signatures when supported. Explicitly setting this to `true` makes verification failures fatal. | Distribution-dependent; see [Download integrity and signatures](#download-integrity-and-signatures) |
|
||||||
| `verify-signature-public-key` | One or more ASCII-armored GPG public keys used for signature verification. Concatenate multiple armored key blocks. Custom keys replace the bundled distribution keys. | |
|
| `verify-signature-public-key` | One or more ASCII-armored GPG public keys used for signature verification. Concatenate multiple armored key blocks. Custom keys replace the bundled distribution keys. | |
|
||||||
| `token` | Token for fetching GitHub.com-hosted version manifests, useful on GitHub Enterprise Server when unauthenticated requests are rate-limited. | `${{ github.token }}` on GitHub.com; empty string on GHES |
|
| `token` | Token for fetching GitHub.com-hosted version manifests, useful on GitHub Enterprise Server when unauthenticated requests are rate-limited. | `${{ github.token }}` on GitHub.com; empty string on GHES |
|
||||||
@@ -225,6 +226,7 @@ Additional distribution notes:
|
|||||||
|
|
||||||
- Oracle OpenJDK builds are archived after a limited number of releases and no longer receive security updates. To continue receiving security patches, use Oracle JDK or another vendor.
|
- Oracle OpenJDK builds are archived after a limited number of releases and no longer receive security updates. To continue receiving security patches, use Oracle JDK or another vendor.
|
||||||
- Azul Zulu maps `arm64` to `aarch64` when querying the Azul Metadata API.
|
- Azul Zulu maps `arm64` to `aarch64` when querying the Azul Metadata API.
|
||||||
|
- Microsoft Build of OpenJDK uses Microsoft's live version manifest, falling back to the bundled version list when no release matches. Version `25.0.5.0.2` can also be requested as `25.0.5+0.2`.
|
||||||
- GraalVM Community is available as `distribution: graalvm-community` for stable JDK 17 and later releases.
|
- GraalVM Community is available as `distribution: graalvm-community` for stable JDK 17 and later releases.
|
||||||
- On Ubuntu runners, commands executed with `sudo` do not inherit the `JAVA_HOME` and `PATH` set by `setup-java` and may fall back to the system-default JDK.
|
- On Ubuntu runners, commands executed with `sudo` do not inherit the `JAVA_HOME` and `PATH` set by `setup-java` and may fall back to the system-default JDK.
|
||||||
|
|
||||||
@@ -244,6 +246,10 @@ When `check-latest` is `false`, the action first tries the runner tool cache for
|
|||||||
|
|
||||||
GitHub-hosted runners primarily pre-cache Eclipse Temurin JDKs. See the installed Java versions for [Ubuntu](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md#java), [Windows](https://github.com/actions/runner-images/blob/main/images/windows/Windows2025-Readme.md#java), and [macOS](https://github.com/actions/runner-images/blob/main/images/macos/macos-15-Readme.md#java). On a fresh GitHub-hosted runner, requests for other distributions usually miss the tool cache and resolve from remote metadata. For broad version ranges such as a major version (`21`, `25`), this often behaves similarly to `check-latest: true` because the action downloads the latest available release that satisfies the range.
|
GitHub-hosted runners primarily pre-cache Eclipse Temurin JDKs. See the installed Java versions for [Ubuntu](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md#java), [Windows](https://github.com/actions/runner-images/blob/main/images/windows/Windows2025-Readme.md#java), and [macOS](https://github.com/actions/runner-images/blob/main/images/macos/macos-15-Readme.md#java). On a fresh GitHub-hosted runner, requests for other distributions usually miss the tool cache and resolve from remote metadata. For broad version ranges such as a major version (`21`, `25`), this often behaves similarly to `check-latest: true` because the action downloads the latest available release that satisfies the range.
|
||||||
|
|
||||||
|
To see which exact version a request resolves to today, open the summary of the latest run of the daily [Latest JDK versions report](https://github.com/actions/setup-java/actions/workflows/latest-jdk-versions.yml) workflow. It compares `setup-java@main`, the latest `setup-java@v6`, and the latest `setup-java@v5`, with separate sections and the exact commit checked for each. Each revision uses its own installers and locked dependencies to resolve vendor metadata for every major from Java 6 through the newest stable GA release (including non-LTS releases), plus `latest`, across its distributions, operating systems and architectures, including Alpine Linux and Solaris. Older revisions without capability maps probe all candidate architectures; unsupported combinations and version syntax (such as `latest` in v5) are marked `n/a`. Distribution support and resolved versions can differ between action revisions as well as platforms. Missing reports and lookup failures are shown explicitly. The report doesn't download any JDKs. Floating vendor URLs are marked when their exact version cannot be established from metadata alone. It shows what a job installs on a tool-cache miss or with `check-latest: true`.
|
||||||
|
|
||||||
|
The `latest-jdk-versions-report` artifact contains the full Markdown report and per-revision/platform JSON results. If the combined report exceeds GitHub's job-summary size limit, the summary shows an overview pointing to this artifact instead.
|
||||||
|
|
||||||
## Download integrity and signatures
|
## Download integrity and signatures
|
||||||
|
|
||||||
`setup-java` automatically verifies downloaded archive checksums when a selected distribution publishes an authoritative checksum. Automatic checksum verification currently applies to `temurin`, `semeru`, `corretto`, `dragonwell`, `kona`, `sapmachine`, `graalvm`, `graalvm-community`, `zulu`, `oracle`, `oracle-openjdk`, `microsoft`, and `jetbrains`.
|
`setup-java` automatically verifies downloaded archive checksums when a selected distribution publishes an authoritative checksum. Automatic checksum verification currently applies to `temurin`, `semeru`, `corretto`, `dragonwell`, `kona`, `sapmachine`, `graalvm`, `graalvm-community`, `zulu`, `oracle`, `oracle-openjdk`, `microsoft`, and `jetbrains`.
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ import {
|
|||||||
afterAll
|
afterAll
|
||||||
} from '@jest/globals';
|
} from '@jest/globals';
|
||||||
import https from 'https';
|
import https from 'https';
|
||||||
|
import fs from 'fs';
|
||||||
|
import os from 'os';
|
||||||
|
import path from 'path';
|
||||||
import {HttpClient, HttpClientResponse} from '@actions/http-client';
|
import {HttpClient, HttpClientResponse} from '@actions/http-client';
|
||||||
import type {IncomingMessage} from 'http';
|
import type {IncomingMessage} from 'http';
|
||||||
import {Readable} from 'stream';
|
import {Readable} from 'stream';
|
||||||
@@ -476,6 +479,109 @@ describe('findPackageForDownload', () => {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
describe('hotfix releases', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
jest.spyOn(HttpClient.prototype, 'getJson').mockResolvedValue({
|
||||||
|
statusCode: 200,
|
||||||
|
headers: {},
|
||||||
|
result: [
|
||||||
|
release('jbr-release-25.0.4b508.27', false),
|
||||||
|
release('jbr-release-25.0.4.1b635.9', false),
|
||||||
|
release('jbr-release-25.0.4.1b635.79', false),
|
||||||
|
release('jbr-release-25.0.3.2b1000.1', false)
|
||||||
|
]
|
||||||
|
});
|
||||||
|
jest.spyOn(HttpClient.prototype, 'head').mockResolvedValue(response(200));
|
||||||
|
});
|
||||||
|
|
||||||
|
it.each(['linux', 'osx', 'windows'])(
|
||||||
|
'selects the patched JBR archive and checksum on %s',
|
||||||
|
async platform => {
|
||||||
|
const distribution = new JetBrainsDistribution({
|
||||||
|
version: '25',
|
||||||
|
architecture: 'x64',
|
||||||
|
packageType: 'jdk',
|
||||||
|
checkLatest: true
|
||||||
|
});
|
||||||
|
distribution['getPlatformOption'] = () => platform;
|
||||||
|
const url = `https://cache-redirector.jetbrains.com/intellij-jbr/jbrsdk-25.0.4.1-${platform}-x64-b635.79.tar.gz`;
|
||||||
|
|
||||||
|
const result = await distribution['findPackageForDownload']('25');
|
||||||
|
|
||||||
|
expect(result).toEqual({
|
||||||
|
version: '25.0.4+1.635.79',
|
||||||
|
url,
|
||||||
|
checksum: {
|
||||||
|
algorithm: 'sha512',
|
||||||
|
value: JETBRAINS_CHECKSUM,
|
||||||
|
source: `${url}.checksum`
|
||||||
|
}
|
||||||
|
});
|
||||||
|
expect(HttpClient.prototype.head).toHaveBeenCalledWith(url);
|
||||||
|
expect(spyHttpClientGet).toHaveBeenCalledTimes(1);
|
||||||
|
expect(spyHttpClientGet).toHaveBeenCalledWith(`${url}.checksum`);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
it.each([
|
||||||
|
['latest', '25.0.4+1.635.79'],
|
||||||
|
['25.0.4', '25.0.4+1.635.79'],
|
||||||
|
['25.0.4.0', '25.0.4+508.27'],
|
||||||
|
['25.0.4.1', '25.0.4+1.635.79'],
|
||||||
|
['25.0.4.1+635.79', '25.0.4+1.635.79'],
|
||||||
|
['25.0.4+1.635.9', '25.0.4+1.635.9'],
|
||||||
|
['25.0.4+508.27', '25.0.4+508.27']
|
||||||
|
])('resolves %s to %s', async (input, expected) => {
|
||||||
|
const distribution = new JetBrainsDistribution({
|
||||||
|
version: input,
|
||||||
|
architecture: 'x64',
|
||||||
|
packageType: 'jdk',
|
||||||
|
checkLatest: true
|
||||||
|
});
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
distribution['findPackageForDownload'](distribution['version'])
|
||||||
|
).resolves.toMatchObject({version: expected});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('resolves early-access hotfix releases separately', async () => {
|
||||||
|
jest.spyOn(HttpClient.prototype, 'getJson').mockResolvedValue({
|
||||||
|
statusCode: 200,
|
||||||
|
headers: {},
|
||||||
|
result: [
|
||||||
|
release('jbr-release-25.0.4.1b635.79', true),
|
||||||
|
release('jbr-release-25.0.4.2b636.1', false)
|
||||||
|
]
|
||||||
|
});
|
||||||
|
const distribution = new JetBrainsDistribution({
|
||||||
|
version: '25.0.4.1-ea',
|
||||||
|
architecture: 'x64',
|
||||||
|
packageType: 'jdk',
|
||||||
|
checkLatest: true
|
||||||
|
});
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
distribution['findPackageForDownload'](distribution['version'])
|
||||||
|
).resolves.toMatchObject({version: '25.0.4+1.635.79'});
|
||||||
|
});
|
||||||
|
|
||||||
|
it.each(['25.0.4.2', '25.0.4.1+635.80'])(
|
||||||
|
'does not substitute another patch or build for %s',
|
||||||
|
async input => {
|
||||||
|
const distribution = new JetBrainsDistribution({
|
||||||
|
version: input,
|
||||||
|
architecture: 'x64',
|
||||||
|
packageType: 'jdk',
|
||||||
|
checkLatest: true
|
||||||
|
});
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
distribution['findPackageForDownload'](distribution['version'])
|
||||||
|
).rejects.toThrow(/No matching version found/);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('version is not found', async () => {
|
it('version is not found', async () => {
|
||||||
const distribution = new JetBrainsDistribution({
|
const distribution = new JetBrainsDistribution({
|
||||||
version: '8.0.452',
|
version: '8.0.452',
|
||||||
@@ -569,4 +675,84 @@ describe('findPackageForDownload', () => {
|
|||||||
source: `${result.url}.checksum`
|
source: `${result.url}.checksum`
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('compareVersions', () => {
|
||||||
|
it.each([
|
||||||
|
['25.0.4+1.635.79', '25.0.4+508.27', 1],
|
||||||
|
['25.0.5+1.1', '25.0.4+1.635.79', 1],
|
||||||
|
['25.0.4+10.1.1', '25.0.4+2.999.99', 1],
|
||||||
|
['25.0.4+1.635.79', '25.0.4+1.635.9', 1],
|
||||||
|
['25.0.4+1.636.1', '25.0.4+1.635.79', 1],
|
||||||
|
['25.0.4+0.635.79', '25.0.4+635.79', 0],
|
||||||
|
['11.0.11+1522', '11.0.11+1522.1', -1],
|
||||||
|
['25.0.4', '25.0.4+508.27', -1]
|
||||||
|
])('compares %s with %s', (first, second, expected) => {
|
||||||
|
const distribution = new JetBrainsDistribution({
|
||||||
|
version: '25',
|
||||||
|
architecture: 'x64',
|
||||||
|
packageType: 'jdk',
|
||||||
|
checkLatest: false
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(Math.sign(distribution['compareVersions'](first, second))).toBe(
|
||||||
|
expected
|
||||||
|
);
|
||||||
|
expect(
|
||||||
|
Math.sign(distribution['compareVersions'](second, first)) || 0
|
||||||
|
).toBe(-expected || 0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('hotfix releases in the tool cache', () => {
|
||||||
|
let cacheRoot: string;
|
||||||
|
const previousToolcache = process.env['RUNNER_TOOL_CACHE'];
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
cacheRoot = await fs.promises.mkdtemp(
|
||||||
|
path.join(os.tmpdir(), 'jetbrains-')
|
||||||
|
);
|
||||||
|
process.env['RUNNER_TOOL_CACHE'] = cacheRoot;
|
||||||
|
for (const version of ['25.0.4-508.27', '25.0.4-1.635.79']) {
|
||||||
|
const javaPath = path.join(
|
||||||
|
cacheRoot,
|
||||||
|
'Java_JetBrains_jdk',
|
||||||
|
version,
|
||||||
|
'x64'
|
||||||
|
);
|
||||||
|
await fs.promises.mkdir(javaPath, {recursive: true});
|
||||||
|
await fs.promises.writeFile(`${javaPath}.complete`, '');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(async () => {
|
||||||
|
if (previousToolcache === undefined) {
|
||||||
|
delete process.env['RUNNER_TOOL_CACHE'];
|
||||||
|
} else {
|
||||||
|
process.env['RUNNER_TOOL_CACHE'] = previousToolcache;
|
||||||
|
}
|
||||||
|
await fs.promises.rm(cacheRoot, {recursive: true, force: true});
|
||||||
|
});
|
||||||
|
|
||||||
|
it.each(['25', '25.0.4.1', '25.0.4.1+635.79'])(
|
||||||
|
'reuses the patched JBR for %s',
|
||||||
|
input => {
|
||||||
|
const distribution = new JetBrainsDistribution({
|
||||||
|
version: input,
|
||||||
|
architecture: 'x64',
|
||||||
|
packageType: 'jdk',
|
||||||
|
checkLatest: false
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(distribution['findInToolcache']()).toEqual({
|
||||||
|
version: '25.0.4+1.635.79',
|
||||||
|
path: path.join(
|
||||||
|
cacheRoot,
|
||||||
|
'Java_JetBrains_jdk',
|
||||||
|
'25.0.4-1.635.79',
|
||||||
|
'x64'
|
||||||
|
)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -216,6 +216,172 @@ describe('findPackageForDownload', () => {
|
|||||||
expect(result.signatureUrl).toBe(`${url}.sig`);
|
expect(result.signatureUrl).toBe(`${url}.sig`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe.each(['25.0.5.0.2', '25.0.5+0.2', '25.0.5'])(
|
||||||
|
'version %s missing from the live manifest',
|
||||||
|
version => {
|
||||||
|
it.each([
|
||||||
|
['darwin', 'x64', 'macos', 'tar.gz'],
|
||||||
|
['linux', 'x64', 'linux', 'tar.gz'],
|
||||||
|
['win32', 'x64', 'windows', 'zip'],
|
||||||
|
['darwin', 'aarch64', 'macos', 'tar.gz'],
|
||||||
|
['linux', 'aarch64', 'linux', 'tar.gz'],
|
||||||
|
['win32', 'aarch64', 'windows', 'zip']
|
||||||
|
])(
|
||||||
|
'resolves the bundled release for %s/%s',
|
||||||
|
async (platform, architecture, osType, extension) => {
|
||||||
|
mockOsPlatform.mockReturnValue(platform);
|
||||||
|
const distro = new MicrosoftDistributions({
|
||||||
|
version,
|
||||||
|
architecture,
|
||||||
|
packageType: 'jdk',
|
||||||
|
checkLatest: false
|
||||||
|
});
|
||||||
|
|
||||||
|
const result = await distro['findPackageForDownload'](
|
||||||
|
distro['version']
|
||||||
|
);
|
||||||
|
const url = `https://aka.ms/download-jdk/microsoft-jdk-25.0.5.0.2-${osType}-${architecture}.${extension}`;
|
||||||
|
|
||||||
|
expect(result).toEqual({
|
||||||
|
version: '25.0.5+0.2',
|
||||||
|
url,
|
||||||
|
signatureUrl: `${url}.sig`,
|
||||||
|
checksum: {
|
||||||
|
algorithm: 'sha256',
|
||||||
|
value: MICROSOFT_CHECKSUM,
|
||||||
|
source: `${url}.sha256sum.txt`
|
||||||
|
}
|
||||||
|
});
|
||||||
|
expect(spyHttpClientGet).toHaveBeenCalledWith(`${url}.sha256sum.txt`);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
it('prefers the live manifest when it contains the requested release', async () => {
|
||||||
|
mockOsPlatform.mockReturnValue('linux');
|
||||||
|
const url =
|
||||||
|
'https://example.test/microsoft-jdk-25.0.5.0.2-linux-x64.tar.gz';
|
||||||
|
spyGetManifestFromRepo.mockResolvedValue({
|
||||||
|
result: [
|
||||||
|
{
|
||||||
|
version: '25.0.5+0.2',
|
||||||
|
stable: true,
|
||||||
|
release_url: 'https://aka.ms/download-jdk',
|
||||||
|
files: [
|
||||||
|
{
|
||||||
|
filename: 'microsoft-jdk-25.0.5.0.2-linux-x64.tar.gz',
|
||||||
|
arch: 'x64',
|
||||||
|
platform: 'linux',
|
||||||
|
download_url: url
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
statusCode: 200,
|
||||||
|
headers: {}
|
||||||
|
});
|
||||||
|
|
||||||
|
const result = await distribution['findPackageForDownload']('25.0.5+0.2');
|
||||||
|
|
||||||
|
expect(result.version).toBe('25.0.5+0.2');
|
||||||
|
expect(result.url).toBe(url);
|
||||||
|
expect(spyGetManifestFromRepo).toHaveBeenCalledWith(
|
||||||
|
'https://aka.ms/download-jdk/microsoft-openjdk-versions.json',
|
||||||
|
{accept: 'application/json'}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('falls back to the bundled build when the live manifest has another build', async () => {
|
||||||
|
mockOsPlatform.mockReturnValue('linux');
|
||||||
|
spyGetManifestFromRepo.mockResolvedValue({
|
||||||
|
result: [
|
||||||
|
{
|
||||||
|
version: '25.0.5+0.3',
|
||||||
|
stable: true,
|
||||||
|
release_url: 'https://aka.ms/download-jdk',
|
||||||
|
files: [
|
||||||
|
{
|
||||||
|
filename: 'microsoft-jdk-25.0.5.0.3-linux-x64.tar.gz',
|
||||||
|
arch: 'x64',
|
||||||
|
platform: 'linux',
|
||||||
|
download_url:
|
||||||
|
'https://example.test/microsoft-jdk-25.0.5.0.3-linux-x64.tar.gz'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
statusCode: 200,
|
||||||
|
headers: {}
|
||||||
|
});
|
||||||
|
|
||||||
|
const result = await distribution['findPackageForDownload']('25.0.5+0.2');
|
||||||
|
|
||||||
|
expect(result.version).toBe('25.0.5+0.2');
|
||||||
|
expect(result.url).toBe(
|
||||||
|
'https://aka.ms/download-jdk/microsoft-jdk-25.0.5.0.2-linux-x64.tar.gz'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('matches dotted Java versions without falling back to the base release', async () => {
|
||||||
|
mockOsPlatform.mockReturnValue('linux');
|
||||||
|
spyGetManifestFromRepo.mockResolvedValue({
|
||||||
|
result: [
|
||||||
|
{
|
||||||
|
version: '17.0.8',
|
||||||
|
stable: true,
|
||||||
|
release_url: 'https://aka.ms/download-jdk',
|
||||||
|
files: [
|
||||||
|
{
|
||||||
|
filename: 'microsoft-jdk-17.0.8-linux-x64.tar.gz',
|
||||||
|
arch: 'x64',
|
||||||
|
platform: 'linux',
|
||||||
|
download_url: 'https://example.test/microsoft-jdk-17.0.8.tar.gz'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
version: '17.0.8.1',
|
||||||
|
stable: true,
|
||||||
|
release_url: 'https://aka.ms/download-jdk',
|
||||||
|
files: [
|
||||||
|
{
|
||||||
|
filename: 'microsoft-jdk-17.0.8.1-linux-x64.tar.gz',
|
||||||
|
arch: 'x64',
|
||||||
|
platform: 'linux',
|
||||||
|
download_url: 'https://example.test/microsoft-jdk-17.0.8.1.tar.gz'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
statusCode: 200,
|
||||||
|
headers: {}
|
||||||
|
});
|
||||||
|
distribution = new MicrosoftDistributions({
|
||||||
|
version: '17.0.8.1',
|
||||||
|
architecture: 'x64',
|
||||||
|
packageType: 'jdk',
|
||||||
|
checkLatest: false
|
||||||
|
});
|
||||||
|
|
||||||
|
const result = await distribution['findPackageForDownload'](
|
||||||
|
distribution['version']
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(result.version).toBe('17.0.8+1');
|
||||||
|
expect(result.url).toBe(
|
||||||
|
'https://example.test/microsoft-jdk-17.0.8.1.tar.gz'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('preserves the error when the live manifest cannot be loaded', async () => {
|
||||||
|
spyGetManifestFromRepo.mockRejectedValue(new Error('Network error'));
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
distribution['findPackageForDownload']('25.0.5+0.2')
|
||||||
|
).rejects.toThrow('Could not load manifest for Microsoft Build of OpenJDK');
|
||||||
|
});
|
||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
['amd64', 'x64'],
|
['amd64', 'x64'],
|
||||||
['arm64', 'aarch64']
|
['arm64', 'aarch64']
|
||||||
|
|||||||
@@ -185,6 +185,19 @@ describe('findPackageForDownload', () => {
|
|||||||
expect(spyHttpClientGet).toHaveBeenCalledTimes(1);
|
expect(spyHttpClientGet).toHaveBeenCalledTimes(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('warns when a major-only request falls back to the archived GA release', async () => {
|
||||||
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'head');
|
||||||
|
spyHttpClient
|
||||||
|
.mockResolvedValueOnce({message: {statusCode: 404}})
|
||||||
|
.mockResolvedValueOnce({message: {statusCode: 200}});
|
||||||
|
|
||||||
|
await distribution['findPackageForDownload']('21');
|
||||||
|
|
||||||
|
expect(core.warning).toHaveBeenCalledWith(
|
||||||
|
'Oracle JDK 21 is no longer available from the latest endpoint. Falling back to its archived GA release, which may not include security updates.'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('always resolves major-only requests remotely', () => {
|
it('always resolves major-only requests remotely', () => {
|
||||||
expect(distribution['requiresRemoteResolution']()).toBe(true);
|
expect(distribution['requiresRemoteResolution']()).toBe(true);
|
||||||
const exactDistribution = new OracleDistribution({
|
const exactDistribution = new OracleDistribution({
|
||||||
|
|||||||
@@ -272,7 +272,7 @@ describe('findPackageForDownload', () => {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
it.each(['zos', 'z/OS', 'z/os', 'test0987654321=', '++=++', 'myArch'])(
|
it.each(['zos', 'myArch'])(
|
||||||
'incorrect Semeru `%s` architecture throws',
|
'incorrect Semeru `%s` architecture throws',
|
||||||
async (arch: string) => {
|
async (arch: string) => {
|
||||||
const distribution = new SemeruDistribution({
|
const distribution = new SemeruDistribution({
|
||||||
|
|||||||
@@ -31,6 +31,36 @@ describe('Java platform capabilities', () => {
|
|||||||
expect(normalizeArchitecture(input)).toBe(expected);
|
expect(normalizeArchitecture(input)).toBe(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it.each(['constructor', 'Constructor'])(
|
||||||
|
'preserves custom architecture token %s for jdkfile',
|
||||||
|
architecture => {
|
||||||
|
expect(normalizeArchitecture(architecture)).toBe(architecture);
|
||||||
|
expect(validateJavaPlatform('jdkfile', 'linux', architecture, '17')).toBe(
|
||||||
|
architecture
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
it.each([
|
||||||
|
'x64<<end\nvalue\nend',
|
||||||
|
'z/OS',
|
||||||
|
'z/os',
|
||||||
|
'test0987654321=',
|
||||||
|
'++=++',
|
||||||
|
'../x64',
|
||||||
|
'x64\\other',
|
||||||
|
'x64 other',
|
||||||
|
'-x64',
|
||||||
|
'_x64'
|
||||||
|
])('rejects invalid architecture token %s', architecture => {
|
||||||
|
const message = `Unsupported architecture value: ${JSON.stringify(architecture)}`;
|
||||||
|
|
||||||
|
expect(() => normalizeArchitecture(architecture)).toThrow(message);
|
||||||
|
expect(() =>
|
||||||
|
validateJavaPlatform('jdkfile', 'linux', architecture, '17')
|
||||||
|
).toThrow(message);
|
||||||
|
});
|
||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
['linux', false, 'linux-glibc'],
|
['linux', false, 'linux-glibc'],
|
||||||
['linux', true, 'linux-musl'],
|
['linux', true, 'linux-musl'],
|
||||||
|
|||||||
658
__tests__/latest-versions-report.test.ts
Normal file
658
__tests__/latest-versions-report.test.ts
Normal file
@@ -0,0 +1,658 @@
|
|||||||
|
import {afterEach, describe, expect, it, jest} from '@jest/globals';
|
||||||
|
import {HttpClient, HttpClientResponse} from '@actions/http-client';
|
||||||
|
import fs from 'fs';
|
||||||
|
import os from 'os';
|
||||||
|
import path from 'path';
|
||||||
|
import {IncomingMessage} from 'http';
|
||||||
|
import {Socket} from 'net';
|
||||||
|
import {JavaBase} from '../src/distributions/base-installer.js';
|
||||||
|
import {
|
||||||
|
currentResolver,
|
||||||
|
loadMetadataResolver,
|
||||||
|
type MetadataResolver
|
||||||
|
} from '../src/reports/resolver.js';
|
||||||
|
import {
|
||||||
|
classifyResolutionError,
|
||||||
|
getDefaultVersions,
|
||||||
|
getSupportedArchitectures,
|
||||||
|
renderMarkdownReport,
|
||||||
|
ResolutionReport,
|
||||||
|
resolveLatestVersions,
|
||||||
|
VersionResolution
|
||||||
|
} from '../src/reports/latest-versions.js';
|
||||||
|
|
||||||
|
function result(
|
||||||
|
overrides: Partial<VersionResolution> &
|
||||||
|
Pick<VersionResolution, 'distribution' | 'versionSpec'>
|
||||||
|
): VersionResolution {
|
||||||
|
return {
|
||||||
|
platform: 'linux',
|
||||||
|
architecture: 'x64',
|
||||||
|
status: 'resolved',
|
||||||
|
...overrides
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function report(
|
||||||
|
platform: string,
|
||||||
|
results: VersionResolution[]
|
||||||
|
): ResolutionReport {
|
||||||
|
return {
|
||||||
|
source: {ref: 'main'},
|
||||||
|
platform,
|
||||||
|
generatedAt: '2026-11-18T06:30:00.000Z',
|
||||||
|
results
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function tableRows(markdown: string, distribution: string): string[] {
|
||||||
|
const section = markdown.split(`## \`${distribution}\``)[1].split('\n## ')[0];
|
||||||
|
return section.split('\n').filter(line => /^\| (?!Platform|---)/.test(line));
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('latest versions report', () => {
|
||||||
|
afterEach(() => {
|
||||||
|
jest.restoreAllMocks();
|
||||||
|
jest.useRealTimers();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('includes every major from Java 6 through GA, including non-LTS releases but not EA', async () => {
|
||||||
|
jest.spyOn(HttpClient.prototype, 'getJson').mockResolvedValue({
|
||||||
|
statusCode: 200,
|
||||||
|
headers: {},
|
||||||
|
result: {
|
||||||
|
most_recent_feature_release: 27,
|
||||||
|
most_recent_feature_version: 28,
|
||||||
|
most_recent_lts: 25
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
await expect(getDefaultVersions(new HttpClient())).resolves.toEqual([
|
||||||
|
'6',
|
||||||
|
'7',
|
||||||
|
'8',
|
||||||
|
'9',
|
||||||
|
'10',
|
||||||
|
'11',
|
||||||
|
'12',
|
||||||
|
'13',
|
||||||
|
'14',
|
||||||
|
'15',
|
||||||
|
'16',
|
||||||
|
'17',
|
||||||
|
'18',
|
||||||
|
'19',
|
||||||
|
'20',
|
||||||
|
'21',
|
||||||
|
'22',
|
||||||
|
'23',
|
||||||
|
'24',
|
||||||
|
'25',
|
||||||
|
'26',
|
||||||
|
'27',
|
||||||
|
'latest'
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('fails rather than publishing incomplete defaults when discovery fails', async () => {
|
||||||
|
jest
|
||||||
|
.spyOn(HttpClient.prototype, 'getJson')
|
||||||
|
.mockRejectedValue(new Error('Java release metadata is unavailable'));
|
||||||
|
|
||||||
|
await expect(getDefaultVersions(new HttpClient())).rejects.toThrow(
|
||||||
|
'Java release metadata is unavailable'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it.each([5, 27.5, Infinity])(
|
||||||
|
'rejects invalid newest major %s',
|
||||||
|
async major => {
|
||||||
|
jest.spyOn(HttpClient.prototype, 'getJson').mockResolvedValue({
|
||||||
|
statusCode: 200,
|
||||||
|
headers: {},
|
||||||
|
result: {most_recent_feature_release: major}
|
||||||
|
});
|
||||||
|
|
||||||
|
await expect(getDefaultVersions(new HttpClient())).rejects.toThrow(
|
||||||
|
'Invalid newest Java feature release'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
it('resolves Solaris metadata and combines its exact builds with every other platform', async () => {
|
||||||
|
const getJson = jest
|
||||||
|
.spyOn(HttpClient.prototype, 'getJson')
|
||||||
|
.mockResolvedValue({
|
||||||
|
statusCode: 200,
|
||||||
|
headers: {},
|
||||||
|
result: [
|
||||||
|
{
|
||||||
|
downloadUrl: 'https://example.com/solaris-jdk8-old.tar.gz',
|
||||||
|
version: '8.0.452+9',
|
||||||
|
featureVersion: 8,
|
||||||
|
interimVersion: 0,
|
||||||
|
updateVersion: 452,
|
||||||
|
buildVersion: 9
|
||||||
|
},
|
||||||
|
{
|
||||||
|
downloadUrl: 'https://example.com/solaris-jdk8.tar.gz',
|
||||||
|
version: '8.0.462+10',
|
||||||
|
featureVersion: 8,
|
||||||
|
interimVersion: 0,
|
||||||
|
updateVersion: 462,
|
||||||
|
buildVersion: 10
|
||||||
|
},
|
||||||
|
{
|
||||||
|
downloadUrl: 'https://example.com/solaris-jdk9.tar.gz',
|
||||||
|
version: '9.0.4+11',
|
||||||
|
featureVersion: 9,
|
||||||
|
interimVersion: 0,
|
||||||
|
updateVersion: 4,
|
||||||
|
buildVersion: 11
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
const install = jest
|
||||||
|
.spyOn(JavaBase.prototype, 'setupJava')
|
||||||
|
.mockRejectedValue(new Error('The report must not install a JDK'));
|
||||||
|
const network = jest
|
||||||
|
.spyOn(HttpClient.prototype, 'request')
|
||||||
|
.mockRejectedValue(
|
||||||
|
new Error('Only the mocked metadata request is permitted')
|
||||||
|
);
|
||||||
|
const hostPlatform = process.platform;
|
||||||
|
const solaris = await resolveLatestVersions({
|
||||||
|
distributions: ['liberica'],
|
||||||
|
versions: ['8', '9', '11', 'latest'],
|
||||||
|
platform: 'solaris'
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(solaris.platform).toBe('solaris');
|
||||||
|
expect(solaris.results).toEqual([
|
||||||
|
result({
|
||||||
|
distribution: 'liberica',
|
||||||
|
platform: 'solaris',
|
||||||
|
versionSpec: '8',
|
||||||
|
version: '8.0.462+10'
|
||||||
|
}),
|
||||||
|
result({
|
||||||
|
distribution: 'liberica',
|
||||||
|
platform: 'solaris',
|
||||||
|
versionSpec: '9',
|
||||||
|
version: '9.0.4+11'
|
||||||
|
}),
|
||||||
|
expect.objectContaining({
|
||||||
|
platform: 'solaris',
|
||||||
|
versionSpec: '11',
|
||||||
|
status: 'unavailable'
|
||||||
|
}),
|
||||||
|
result({
|
||||||
|
distribution: 'liberica',
|
||||||
|
platform: 'solaris',
|
||||||
|
versionSpec: 'latest',
|
||||||
|
version: '9.0.4+11'
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
expect(getJson).toHaveBeenCalledTimes(1);
|
||||||
|
const url = new URL(getJson.mock.calls[0][0]);
|
||||||
|
expect(url.origin).toBe('https://api.bell-sw.com');
|
||||||
|
expect(Object.fromEntries(url.searchParams)).toMatchObject({
|
||||||
|
os: 'solaris',
|
||||||
|
arch: 'x86',
|
||||||
|
bitness: '64',
|
||||||
|
'bundle-type': 'jdk',
|
||||||
|
'installation-type': 'archive'
|
||||||
|
});
|
||||||
|
expect(install).not.toHaveBeenCalled();
|
||||||
|
expect(network).not.toHaveBeenCalled();
|
||||||
|
expect(process.platform).toBe(hostPlatform);
|
||||||
|
|
||||||
|
const otherReports = ['linux', 'linux-musl', 'macos', 'windows'].map(
|
||||||
|
(platform, index) =>
|
||||||
|
report(
|
||||||
|
platform,
|
||||||
|
['8', '9', '11', 'latest'].map(versionSpec =>
|
||||||
|
result({
|
||||||
|
distribution: 'liberica',
|
||||||
|
platform,
|
||||||
|
versionSpec,
|
||||||
|
version: `${versionSpec === 'latest' ? '11' : versionSpec}.0.1+${index + 1}`
|
||||||
|
})
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
const markdown = renderMarkdownReport([solaris, ...otherReports]);
|
||||||
|
expect(tableRows(markdown, 'liberica')).toEqual([
|
||||||
|
'| Linux x64 | `8.0.1+1` | `9.0.1+1` | `11.0.1+1` | `11.0.1+1` |',
|
||||||
|
'| Alpine Linux x64 | `8.0.1+2` | `9.0.1+2` | `11.0.1+2` | `11.0.1+2` |',
|
||||||
|
'| macOS x64 | `8.0.1+3` | `9.0.1+3` | `11.0.1+3` | `11.0.1+3` |',
|
||||||
|
'| Windows x64 | `8.0.1+4` | `9.0.1+4` | `11.0.1+4` | `11.0.1+4` |',
|
||||||
|
'| Solaris x64 | `8.0.462+10` | `9.0.4+11` | — | `9.0.4+11` |'
|
||||||
|
]);
|
||||||
|
expect(markdown).not.toContain('Needs attention');
|
||||||
|
expect(markdown).not.toContain('Not checked');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('classifies missing releases separately from lookup failures', () => {
|
||||||
|
const notFound = new Error("No matching version found for SemVer '8'.");
|
||||||
|
notFound.name = 'VersionNotFoundError';
|
||||||
|
|
||||||
|
expect(classifyResolutionError(notFound)).toBe('unavailable');
|
||||||
|
expect(
|
||||||
|
classifyResolutionError(
|
||||||
|
new Error('Oracle JDK is only supported for JDK 17 and later')
|
||||||
|
)
|
||||||
|
).toBe('unsupported');
|
||||||
|
expect(
|
||||||
|
classifyResolutionError(
|
||||||
|
new Error(
|
||||||
|
'No Kona release for the specified version "27" on OS "macos" and arch "aarch64".'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
).toBe('unavailable');
|
||||||
|
expect(classifyResolutionError(new Error('socket hang up'))).toBe('error');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('resolves Alpine with the Linux architectures, including version-restricted ones', () => {
|
||||||
|
expect(getSupportedArchitectures('redhat', 'linux-musl')).toEqual([
|
||||||
|
'x64',
|
||||||
|
'aarch64',
|
||||||
|
'ppc64le'
|
||||||
|
]);
|
||||||
|
expect(getSupportedArchitectures('dragonwell', 'macos')).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('lists the exact version for every platform, ordered by operating system and architecture', () => {
|
||||||
|
const markdown = renderMarkdownReport([
|
||||||
|
report('macos', [
|
||||||
|
result({
|
||||||
|
distribution: 'temurin',
|
||||||
|
versionSpec: '21',
|
||||||
|
platform: 'macos',
|
||||||
|
architecture: 'aarch64',
|
||||||
|
version: '21.0.13+100000002.0.LTS'
|
||||||
|
})
|
||||||
|
]),
|
||||||
|
report('linux', [
|
||||||
|
result({
|
||||||
|
distribution: 'temurin',
|
||||||
|
versionSpec: '21',
|
||||||
|
architecture: 's390x',
|
||||||
|
version: '21.0.12+7'
|
||||||
|
}),
|
||||||
|
result({
|
||||||
|
distribution: 'temurin',
|
||||||
|
versionSpec: '21',
|
||||||
|
version: '21.0.13+9'
|
||||||
|
})
|
||||||
|
]),
|
||||||
|
report('linux-musl', [
|
||||||
|
result({
|
||||||
|
distribution: 'temurin',
|
||||||
|
versionSpec: '21',
|
||||||
|
platform: 'linux-musl',
|
||||||
|
version: '21.0.13+9'
|
||||||
|
})
|
||||||
|
])
|
||||||
|
]);
|
||||||
|
|
||||||
|
expect(tableRows(markdown, 'temurin')).toEqual([
|
||||||
|
'| Linux x64 | `21.0.13+9` |',
|
||||||
|
'| Linux s390x | `21.0.12+7` |',
|
||||||
|
'| Alpine Linux x64 | `21.0.13+9` |',
|
||||||
|
'| macOS aarch64 | `21.0.13+100000002.0.LTS` |'
|
||||||
|
]);
|
||||||
|
expect(markdown).not.toContain('Needs attention');
|
||||||
|
expect(markdown).toContain(
|
||||||
|
'Not checked, because no runner reported these platforms: Windows (x64, x86, aarch64).'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('distinguishes unsupported, unpublished, and floating releases', () => {
|
||||||
|
const markdown = renderMarkdownReport([
|
||||||
|
report('linux', [
|
||||||
|
result({
|
||||||
|
distribution: 'redhat',
|
||||||
|
versionSpec: '11',
|
||||||
|
architecture: 'aarch64',
|
||||||
|
version: '11.0.29'
|
||||||
|
}),
|
||||||
|
result({
|
||||||
|
distribution: 'redhat',
|
||||||
|
versionSpec: '25',
|
||||||
|
architecture: 'aarch64',
|
||||||
|
status: 'unsupported'
|
||||||
|
}),
|
||||||
|
result({
|
||||||
|
distribution: 'oracle',
|
||||||
|
versionSpec: '11',
|
||||||
|
status: 'unavailable'
|
||||||
|
}),
|
||||||
|
result({
|
||||||
|
distribution: 'oracle',
|
||||||
|
versionSpec: '25',
|
||||||
|
version: '25',
|
||||||
|
floating: true,
|
||||||
|
advertisedVersion: '25.0.5.1',
|
||||||
|
publishedAt: '2026-10-27'
|
||||||
|
})
|
||||||
|
])
|
||||||
|
]);
|
||||||
|
|
||||||
|
expect(tableRows(markdown, 'redhat')).toEqual([
|
||||||
|
'| Linux aarch64 | `11.0.29` | n/a |'
|
||||||
|
]);
|
||||||
|
expect(tableRows(markdown, 'oracle')).toEqual([
|
||||||
|
'| Linux x64 | — | `25.0.5.1` ¹ (published 2026-10-27) |'
|
||||||
|
]);
|
||||||
|
expect(markdown).toContain('¹ Major-only requests download');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('reports lookup errors and distributions that resolved nothing', () => {
|
||||||
|
const markdown = renderMarkdownReport([
|
||||||
|
report('linux', [
|
||||||
|
result({
|
||||||
|
distribution: 'oracle-openjdk',
|
||||||
|
versionSpec: '25',
|
||||||
|
status: 'unavailable'
|
||||||
|
}),
|
||||||
|
result({
|
||||||
|
distribution: 'zulu',
|
||||||
|
versionSpec: '25',
|
||||||
|
status: 'error',
|
||||||
|
message: 'socket hang up\nstack'
|
||||||
|
})
|
||||||
|
])
|
||||||
|
]);
|
||||||
|
|
||||||
|
expect(markdown).toContain('## `oracle-openjdk` ❗');
|
||||||
|
expect(tableRows(markdown, 'zulu')).toEqual(['| Linux x64 | ❗ error |']);
|
||||||
|
expect(markdown).toContain(
|
||||||
|
'| `oracle-openjdk` | all | all | No release matched any requested version'
|
||||||
|
);
|
||||||
|
expect(markdown).toContain(
|
||||||
|
'| `zulu` | `25` | Linux x64 | socket hang up |'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('uses the selected revision without substituting main for unsupported version syntax', async () => {
|
||||||
|
const mainFactory = jest.spyOn(currentResolver, 'getJavaDistribution');
|
||||||
|
const lookup = jest.fn(async () => ({
|
||||||
|
version: '21.0.8+9',
|
||||||
|
url: 'https://example.com/jdk.tar.gz'
|
||||||
|
}));
|
||||||
|
const legacy: MetadataResolver = {
|
||||||
|
source: {ref: 'v5', sha: 'a'.repeat(40), version: '5.6.0'},
|
||||||
|
distributions: ['adopt'],
|
||||||
|
getJavaDistribution: (_distribution, options) => {
|
||||||
|
if (options.version === 'latest') {
|
||||||
|
throw new Error("The string 'latest' is not valid SemVer notation");
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
version: options.version,
|
||||||
|
http: new HttpClient(),
|
||||||
|
findPackageForDownload: lookup
|
||||||
|
};
|
||||||
|
},
|
||||||
|
createSolarisInstaller: () => {
|
||||||
|
throw new Error('Unexpected Solaris lookup');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const resolved = await resolveLatestVersions({
|
||||||
|
resolver: legacy,
|
||||||
|
distributions: legacy.distributions,
|
||||||
|
versions: ['21', 'latest'],
|
||||||
|
architectures: ['x64']
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(resolved.source).toEqual(legacy.source);
|
||||||
|
expect(resolved.results).toEqual([
|
||||||
|
expect.objectContaining({
|
||||||
|
distribution: 'adopt',
|
||||||
|
versionSpec: '21',
|
||||||
|
version: '21.0.8+9'
|
||||||
|
}),
|
||||||
|
expect.objectContaining({
|
||||||
|
distribution: 'adopt',
|
||||||
|
versionSpec: 'latest',
|
||||||
|
status: 'unsupported'
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
expect(lookup).toHaveBeenCalledTimes(1);
|
||||||
|
expect(lookup).toHaveBeenCalledWith('21');
|
||||||
|
expect(mainFactory).not.toHaveBeenCalled();
|
||||||
|
expect(getSupportedArchitectures('adopt', 'linux', legacy)).toContain(
|
||||||
|
's390x'
|
||||||
|
);
|
||||||
|
expect(getSupportedArchitectures('redhat', 'linux', legacy)).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('marks legacy mutable Oracle URLs as floating instead of reporting a major as exact', async () => {
|
||||||
|
const response = new IncomingMessage(new Socket());
|
||||||
|
response.headers['last-modified'] = 'Tue, 27 Oct 2026 00:00:00 GMT';
|
||||||
|
jest
|
||||||
|
.spyOn(HttpClient.prototype, 'head')
|
||||||
|
.mockResolvedValue(new HttpClientResponse(response));
|
||||||
|
jest.spyOn(HttpClient.prototype, 'getJson').mockResolvedValue({
|
||||||
|
statusCode: 200,
|
||||||
|
headers: {},
|
||||||
|
result: {releaseVersion: '25.0.1', licenseDetails: {licenseType: 'NFTC'}}
|
||||||
|
});
|
||||||
|
const resolved = await resolveLatestVersions({
|
||||||
|
resolver: {
|
||||||
|
...currentResolver,
|
||||||
|
source: {ref: 'v5'},
|
||||||
|
getJavaDistribution: () => ({
|
||||||
|
version: '25',
|
||||||
|
http: new HttpClient(),
|
||||||
|
findPackageForDownload: async () => ({
|
||||||
|
version: '25',
|
||||||
|
url: 'https://download.oracle.com/java/25/latest/jdk-25_linux-x64_bin.tar.gz'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
distributions: ['oracle'],
|
||||||
|
versions: ['25'],
|
||||||
|
architectures: ['x64']
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(resolved.results[0]).toMatchObject({
|
||||||
|
status: 'resolved',
|
||||||
|
floating: true,
|
||||||
|
advertisedVersion: '25.0.1',
|
||||||
|
publishedAt: '2026-10-27'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('refuses to install if a revision crosses the metadata boundary', async () => {
|
||||||
|
const download = jest.fn();
|
||||||
|
const installer = {
|
||||||
|
version: '21',
|
||||||
|
http: new HttpClient(),
|
||||||
|
downloadTool: download,
|
||||||
|
async findPackageForDownload() {
|
||||||
|
this.downloadTool();
|
||||||
|
return {version: '21', url: 'https://example.com/jdk.tar.gz'};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const resolved = await resolveLatestVersions({
|
||||||
|
resolver: {...currentResolver, getJavaDistribution: () => installer},
|
||||||
|
distributions: ['temurin'],
|
||||||
|
versions: ['21'],
|
||||||
|
architectures: ['x64']
|
||||||
|
});
|
||||||
|
expect(resolved.results[0]).toMatchObject({
|
||||||
|
status: 'error',
|
||||||
|
message: 'JDK download/install is forbidden in the versions report.'
|
||||||
|
});
|
||||||
|
expect(download).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('records stalled legacy endpoints as errors and does not retry them for every major', async () => {
|
||||||
|
jest.useFakeTimers();
|
||||||
|
const request = jest
|
||||||
|
.spyOn(HttpClient.prototype, 'getJson')
|
||||||
|
.mockImplementation(() => new Promise(() => {}));
|
||||||
|
const dispose = jest.spyOn(HttpClient.prototype, 'dispose');
|
||||||
|
const pending = resolveLatestVersions({
|
||||||
|
resolver: {
|
||||||
|
...currentResolver,
|
||||||
|
getJavaDistribution: (_distribution, options) => ({
|
||||||
|
version: options.version,
|
||||||
|
http: new HttpClient(),
|
||||||
|
async findPackageForDownload() {
|
||||||
|
await this.http.getJson('https://example.com/retired-api');
|
||||||
|
throw new Error('Unreachable');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
distributions: ['temurin'],
|
||||||
|
versions: ['17', '21'],
|
||||||
|
architectures: ['x64']
|
||||||
|
});
|
||||||
|
await jest.advanceTimersByTimeAsync(60_000);
|
||||||
|
const resolved = await pending;
|
||||||
|
expect(resolved.results).toEqual([
|
||||||
|
expect.objectContaining({
|
||||||
|
versionSpec: '17',
|
||||||
|
status: 'error',
|
||||||
|
message: expect.stringContaining('Metadata request timed out')
|
||||||
|
}),
|
||||||
|
expect.objectContaining({
|
||||||
|
versionSpec: '21',
|
||||||
|
status: 'error',
|
||||||
|
message: expect.stringContaining('Metadata request timed out')
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
expect(request).toHaveBeenCalledTimes(1);
|
||||||
|
expect(dispose).toHaveBeenCalledTimes(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('keeps different revision results and failures separate, including missing runners', () => {
|
||||||
|
const main = report('linux', [
|
||||||
|
result({distribution: 'temurin', versionSpec: '21', version: '21.0.13+9'})
|
||||||
|
]);
|
||||||
|
const v6 = {
|
||||||
|
...report('linux', [
|
||||||
|
result({
|
||||||
|
distribution: 'temurin',
|
||||||
|
versionSpec: '21',
|
||||||
|
version: '21.0.12+7'
|
||||||
|
})
|
||||||
|
]),
|
||||||
|
source: {ref: 'v6', sha: 'b'.repeat(40), version: '6.0.0'}
|
||||||
|
};
|
||||||
|
const v5 = {
|
||||||
|
...report('linux', [
|
||||||
|
result({
|
||||||
|
distribution: 'adopt',
|
||||||
|
versionSpec: '21',
|
||||||
|
status: 'unavailable'
|
||||||
|
}),
|
||||||
|
result({
|
||||||
|
distribution: 'temurin',
|
||||||
|
versionSpec: '21',
|
||||||
|
status: 'error',
|
||||||
|
message: 'metadata failed'
|
||||||
|
})
|
||||||
|
]),
|
||||||
|
source: {ref: 'v5', sha: 'a'.repeat(40), version: '5.6.0'},
|
||||||
|
targets: {adopt: {linux: ['x64'], windows: ['x64']}}
|
||||||
|
};
|
||||||
|
const markdown = renderMarkdownReport([main, v6, v5]);
|
||||||
|
const mainSection = markdown
|
||||||
|
.split('<summary>setup-java@main</summary>')[1]
|
||||||
|
.split('</details>')[0];
|
||||||
|
const v6Section = markdown
|
||||||
|
.split('<summary>setup-java@v6</summary>')[1]
|
||||||
|
.split('</details>')[0];
|
||||||
|
const v5Section = markdown
|
||||||
|
.split('<summary>setup-java@v5</summary>')[1]
|
||||||
|
.split('</details>')[0];
|
||||||
|
expect(mainSection).toContain('`21.0.13+9`');
|
||||||
|
expect(mainSection).not.toContain('Needs attention');
|
||||||
|
expect(v6Section).toContain('`21.0.12+7`');
|
||||||
|
expect(v6Section).not.toContain('`21.0.13+9`');
|
||||||
|
expect(v5Section).toContain('metadata failed');
|
||||||
|
expect(v5Section).toContain('## `adopt` ❗');
|
||||||
|
expect(v5Section).toContain(
|
||||||
|
'Not checked, because no runner reported these platforms: Windows (x64).'
|
||||||
|
);
|
||||||
|
expect(markdown).toContain(
|
||||||
|
`https://github.com/actions/setup-java/commit/${'a'.repeat(40)}`
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('shows missing revisions and rejects mixed commits within one revision', () => {
|
||||||
|
const main = report('linux', []);
|
||||||
|
expect(
|
||||||
|
renderMarkdownReport([main], {expectedRefs: ['main', 'v6', 'v5']})
|
||||||
|
).toContain('| `v5` | - | - | Not checked: no reports received |');
|
||||||
|
expect(() =>
|
||||||
|
renderMarkdownReport([
|
||||||
|
{...main, source: {ref: 'v6', sha: 'a'.repeat(40)}},
|
||||||
|
{...main, source: {ref: 'v6', sha: 'b'.repeat(40)}}
|
||||||
|
])
|
||||||
|
).toThrow("Reports for 'v6' were produced from different revisions.");
|
||||||
|
});
|
||||||
|
|
||||||
|
it.each(['module', 'commonjs'])(
|
||||||
|
'loads a separate %s resolver with its provenance',
|
||||||
|
async type => {
|
||||||
|
const directory = fs.mkdtempSync(
|
||||||
|
path.join(os.tmpdir(), 'setup-java resolver-')
|
||||||
|
);
|
||||||
|
try {
|
||||||
|
fs.writeFileSync(
|
||||||
|
path.join(directory, 'package.json'),
|
||||||
|
JSON.stringify({type})
|
||||||
|
);
|
||||||
|
const source = {ref: 'v5', sha: 'a'.repeat(40), version: '5.6.0'};
|
||||||
|
fs.writeFileSync(
|
||||||
|
path.join(directory, 'index.js'),
|
||||||
|
`
|
||||||
|
const source = ${JSON.stringify(source)};
|
||||||
|
const distributions = ['adopt'];
|
||||||
|
const getJavaDistribution = () => 'selected checkout';
|
||||||
|
const createSolarisInstaller = () => null;
|
||||||
|
${type === 'module' ? 'export' : 'module.exports ='}
|
||||||
|
{source, distributions, getJavaDistribution, createSolarisInstaller};
|
||||||
|
`
|
||||||
|
);
|
||||||
|
const loaded = await loadMetadataResolver(directory);
|
||||||
|
expect(loaded.source).toEqual(source);
|
||||||
|
expect(
|
||||||
|
loaded.getJavaDistribution('adopt', {
|
||||||
|
version: '21',
|
||||||
|
architecture: 'x64',
|
||||||
|
packageType: 'jdk',
|
||||||
|
checkLatest: true
|
||||||
|
})
|
||||||
|
).toBe('selected checkout');
|
||||||
|
} finally {
|
||||||
|
fs.rmSync(directory, {recursive: true, force: true});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
it('fails explicitly instead of falling back to main when the resolver bundle is invalid', async () => {
|
||||||
|
const directory = fs.mkdtempSync(
|
||||||
|
path.join(os.tmpdir(), 'setup-java resolver-')
|
||||||
|
);
|
||||||
|
try {
|
||||||
|
fs.writeFileSync(
|
||||||
|
path.join(directory, 'package.json'),
|
||||||
|
'{"type":"module"}'
|
||||||
|
);
|
||||||
|
fs.writeFileSync(
|
||||||
|
path.join(directory, 'index.js'),
|
||||||
|
'export const source = {ref: "v5"};'
|
||||||
|
);
|
||||||
|
await expect(loadMetadataResolver(directory)).rejects.toThrow(
|
||||||
|
'Invalid metadata resolver bundle'
|
||||||
|
);
|
||||||
|
} finally {
|
||||||
|
fs.rmSync(directory, {recursive: true, force: true});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -27,7 +27,16 @@ describe('configureProblemMatcher', () => {
|
|||||||
jest.resetAllMocks();
|
jest.resetAllMocks();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('registers the Java problem matcher by default', () => {
|
it('does not register the Java problem matcher by default', () => {
|
||||||
|
configureProblemMatcher('/matchers/java.json');
|
||||||
|
|
||||||
|
expect(mockInfo).not.toHaveBeenCalled();
|
||||||
|
expect(mockDebug).toHaveBeenCalledWith('Java problem matcher is disabled');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('registers the Java problem matcher when explicitly enabled', () => {
|
||||||
|
inputs[INPUT_PROBLEM_MATCHER] = 'true';
|
||||||
|
|
||||||
configureProblemMatcher('/matchers/java.json');
|
configureProblemMatcher('/matchers/java.json');
|
||||||
|
|
||||||
expect(mockInfo).toHaveBeenCalledWith('##[add-matcher]/matchers/java.json');
|
expect(mockInfo).toHaveBeenCalledWith('##[add-matcher]/matchers/java.json');
|
||||||
|
|||||||
@@ -15,6 +15,13 @@ EXPECTED_PATH=$2
|
|||||||
SETUP_JAVA_VERSION=$3
|
SETUP_JAVA_VERSION=$3
|
||||||
REQUIRE_CONCRETE_VERSION=$4
|
REQUIRE_CONCRETE_VERSION=$4
|
||||||
|
|
||||||
|
if [[ $EXPECTED_JAVA_VERSION == *"+"* ]] && [ "$SETUP_JAVA_VERSION" != "$EXPECTED_JAVA_VERSION" ]; then
|
||||||
|
echo "::error::The version output does not match the requested build"
|
||||||
|
echo "Requested version: $EXPECTED_JAVA_VERSION"
|
||||||
|
echo "Version output: $SETUP_JAVA_VERSION"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
EXPECTED_JAVA_VERSION=$(echo $EXPECTED_JAVA_VERSION | cut -d'+' -f1)
|
EXPECTED_JAVA_VERSION=$(echo $EXPECTED_JAVA_VERSION | cut -d'+' -f1)
|
||||||
if [[ $EXPECTED_JAVA_VERSION == 8 ]] || [[ $EXPECTED_JAVA_VERSION == 8.* ]]; then
|
if [[ $EXPECTED_JAVA_VERSION == 8 ]] || [[ $EXPECTED_JAVA_VERSION == 8.* ]]; then
|
||||||
EXPECTED_JAVA_VERSION="1.${EXPECTED_JAVA_VERSION}"
|
EXPECTED_JAVA_VERSION="1.${EXPECTED_JAVA_VERSION}"
|
||||||
|
|||||||
@@ -138,9 +138,9 @@ inputs:
|
|||||||
required: false
|
required: false
|
||||||
default: false
|
default: false
|
||||||
problem-matcher:
|
problem-matcher:
|
||||||
description: 'Whether to register the Java problem matcher (compiler errors/warnings and uncaught exceptions). Set to "false" to disable annotations.'
|
description: 'Whether to register the Java problem matcher (compiler errors/warnings and uncaught exceptions). Disabled by default; set to "true" to enable annotations.'
|
||||||
required: false
|
required: false
|
||||||
default: true
|
default: false
|
||||||
outputs:
|
outputs:
|
||||||
distribution:
|
distribution:
|
||||||
description: 'Distribution of Java that has been installed'
|
description: 'Distribution of Java that has been installed'
|
||||||
|
|||||||
63446
dist/cleanup/230.index.js
vendored
Normal file
63446
dist/cleanup/230.index.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
4
dist/cleanup/314.index.js
vendored
4
dist/cleanup/314.index.js
vendored
@@ -21,8 +21,8 @@ var external_fs_default = /*#__PURE__*/__webpack_require__.n(external_fs_);
|
|||||||
// EXTERNAL MODULE: external "path"
|
// EXTERNAL MODULE: external "path"
|
||||||
var external_path_ = __webpack_require__(6928);
|
var external_path_ = __webpack_require__(6928);
|
||||||
var external_path_default = /*#__PURE__*/__webpack_require__.n(external_path_);
|
var external_path_default = /*#__PURE__*/__webpack_require__.n(external_path_);
|
||||||
// EXTERNAL MODULE: ./node_modules/@actions/cache/lib/cache.js + 322 modules
|
// EXTERNAL MODULE: ./node_modules/@actions/cache/lib/cache.js + 323 modules
|
||||||
var lib_cache = __webpack_require__(6080);
|
var lib_cache = __webpack_require__(8230);
|
||||||
// EXTERNAL MODULE: ./node_modules/@actions/core/lib/core.js + 7 modules
|
// EXTERNAL MODULE: ./node_modules/@actions/core/lib/core.js + 7 modules
|
||||||
var lib_core = __webpack_require__(3838);
|
var lib_core = __webpack_require__(3838);
|
||||||
// EXTERNAL MODULE: ./src/util.ts
|
// EXTERNAL MODULE: ./src/util.ts
|
||||||
|
|||||||
2
dist/cleanup/348.index.js
vendored
2
dist/cleanup/348.index.js
vendored
@@ -15,7 +15,7 @@ export const modules = {
|
|||||||
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_1__);
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_1__);
|
||||||
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6928);
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6928);
|
||||||
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_2__);
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_2__);
|
||||||
/* harmony import */ var _actions_cache__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6080);
|
/* harmony import */ var _actions_cache__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8230);
|
||||||
/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(3838);
|
/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(3838);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
2
dist/cleanup/377.index.js
vendored
2
dist/cleanup/377.index.js
vendored
@@ -13,7 +13,7 @@ export const modules = {
|
|||||||
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
|
||||||
/* harmony import */ var os__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(857);
|
/* harmony import */ var os__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(857);
|
||||||
/* harmony import */ var os__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(os__WEBPACK_IMPORTED_MODULE_1__);
|
/* harmony import */ var os__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(os__WEBPACK_IMPORTED_MODULE_1__);
|
||||||
/* harmony import */ var _actions_cache__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6080);
|
/* harmony import */ var _actions_cache__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8230);
|
||||||
/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3838);
|
/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3838);
|
||||||
/* harmony import */ var _actions_glob__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2377);
|
/* harmony import */ var _actions_glob__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2377);
|
||||||
/**
|
/**
|
||||||
|
|||||||
6
dist/cleanup/index.js
vendored
6
dist/cleanup/index.js
vendored
@@ -36343,12 +36343,12 @@ async function saveCaches() {
|
|||||||
}
|
}
|
||||||
const saves = [];
|
const saves = [];
|
||||||
if (cache) {
|
if (cache) {
|
||||||
const { save } = await Promise.all(/* import() */[__nccwpck_require__.e(80), __nccwpck_require__.e(377)]).then(__nccwpck_require__.bind(__nccwpck_require__, 7377));
|
const { save } = await Promise.all(/* import() */[__nccwpck_require__.e(230), __nccwpck_require__.e(377)]).then(__nccwpck_require__.bind(__nccwpck_require__, 7377));
|
||||||
saves.push(save(cache));
|
saves.push(save(cache));
|
||||||
}
|
}
|
||||||
if (cacheJdk) {
|
if (cacheJdk) {
|
||||||
const { saveJdkCaches } = await Promise.all(/* import() */[__nccwpck_require__.e(80), __nccwpck_require__.e(314)]).then(__nccwpck_require__.bind(__nccwpck_require__, 2314));
|
const { saveJdkCaches } = await Promise.all(/* import() */[__nccwpck_require__.e(230), __nccwpck_require__.e(314)]).then(__nccwpck_require__.bind(__nccwpck_require__, 2314));
|
||||||
const { saveJdkResolutionCaches } = await Promise.all(/* import() */[__nccwpck_require__.e(80), __nccwpck_require__.e(348)]).then(__nccwpck_require__.bind(__nccwpck_require__, 967));
|
const { saveJdkResolutionCaches } = await Promise.all(/* import() */[__nccwpck_require__.e(230), __nccwpck_require__.e(348)]).then(__nccwpck_require__.bind(__nccwpck_require__, 967));
|
||||||
saves.push(saveJdkCaches());
|
saves.push(saveJdkCaches());
|
||||||
saves.push(saveJdkResolutionCaches());
|
saves.push(saveJdkResolutionCaches());
|
||||||
}
|
}
|
||||||
|
|||||||
7
dist/setup/182.index.js
vendored
7
dist/setup/182.index.js
vendored
@@ -82,6 +82,7 @@ class OracleDistribution extends _base_installer_js__WEBPACK_IMPORTED_MODULE_3__
|
|||||||
possibleUrls.push(`${ORACLE_DL_BASE}/${major}/latest/jdk-${major}_${platform}-${arch}_bin.${extension}`);
|
possibleUrls.push(`${ORACLE_DL_BASE}/${major}/latest/jdk-${major}_${platform}-${arch}_bin.${extension}`);
|
||||||
}
|
}
|
||||||
const floatingUrl = isOnlyMajorProvided ? possibleUrls[0] : undefined;
|
const floatingUrl = isOnlyMajorProvided ? possibleUrls[0] : undefined;
|
||||||
|
let latestUrlNotFound = false;
|
||||||
possibleUrls.push(`${ORACLE_DL_BASE}/${major}/archive/jdk-${range}_${platform}-${arch}_bin.${extension}`);
|
possibleUrls.push(`${ORACLE_DL_BASE}/${major}/archive/jdk-${range}_${platform}-${arch}_bin.${extension}`);
|
||||||
if (parseInt(major) < 17) {
|
if (parseInt(major) < 17) {
|
||||||
throw new Error('Oracle JDK is only supported for JDK 17 and later');
|
throw new Error('Oracle JDK is only supported for JDK 17 and later');
|
||||||
@@ -90,6 +91,9 @@ class OracleDistribution extends _base_installer_js__WEBPACK_IMPORTED_MODULE_3__
|
|||||||
const response = await this.http.head(url);
|
const response = await this.http.head(url);
|
||||||
if (response.message.statusCode === _actions_http_client__WEBPACK_IMPORTED_MODULE_5__/* .HttpCodes */ .Hv.OK) {
|
if (response.message.statusCode === _actions_http_client__WEBPACK_IMPORTED_MODULE_5__/* .HttpCodes */ .Hv.OK) {
|
||||||
const floating = url === floatingUrl;
|
const floating = url === floatingUrl;
|
||||||
|
if (latestUrlNotFound) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .warning */ .$e(`Oracle JDK ${major} is no longer available from the latest endpoint. Falling back to its archived GA release, which may not include security updates.`);
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
url,
|
url,
|
||||||
version: range,
|
version: range,
|
||||||
@@ -100,6 +104,9 @@ class OracleDistribution extends _base_installer_js__WEBPACK_IMPORTED_MODULE_3__
|
|||||||
: undefined
|
: undefined
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
if (url === floatingUrl) {
|
||||||
|
latestUrlNotFound = true;
|
||||||
|
}
|
||||||
if (response.message.statusCode !== _actions_http_client__WEBPACK_IMPORTED_MODULE_5__/* .HttpCodes */ .Hv.NotFound) {
|
if (response.message.statusCode !== _actions_http_client__WEBPACK_IMPORTED_MODULE_5__/* .HttpCodes */ .Hv.NotFound) {
|
||||||
throw new Error(`Http request for Oracle JDK failed with status code: ${response.message.statusCode}`);
|
throw new Error(`Http request for Oracle JDK failed with status code: ${response.message.statusCode}`);
|
||||||
}
|
}
|
||||||
|
|||||||
41
dist/setup/219.index.js
vendored
41
dist/setup/219.index.js
vendored
@@ -15686,19 +15686,26 @@ var Matcher = __webpack_require__(8257);
|
|||||||
;// CONCATENATED MODULE: ./node_modules/fast-xml-builder/src/util.js
|
;// CONCATENATED MODULE: ./node_modules/fast-xml-builder/src/util.js
|
||||||
|
|
||||||
|
|
||||||
|
// String(val)/val.toString() drop the sign of -0 (e.g. String(-0) === '0'), silently
|
||||||
|
// corrupting a round-tripped negative-zero value. XML has no separate int/float syntax,
|
||||||
|
// so this is the single place every raw value gets turned into text.
|
||||||
|
function valToStr(val) {
|
||||||
|
return typeof val === 'number' && Object.is(val, -0) ? '-0' : String(val)
|
||||||
|
}
|
||||||
|
|
||||||
function safeComment(val) {
|
function safeComment(val) {
|
||||||
return String(val)
|
return valToStr(val)
|
||||||
.replace(/--/g, '- -') // -- is illegal anywhere in comment content
|
.replace(/--/g, '- -') // -- is illegal anywhere in comment content
|
||||||
.replace(/--/g, '- -') // handle the scenario when 2 consiucative dashes appears
|
.replace(/--/g, '- -') // handle the scenario when 2 consiucative dashes appears
|
||||||
.replace(/-$/, '- '); // trailing - would form -- with the closing -->
|
.replace(/-$/, '- '); // trailing - would form -- with the closing -->
|
||||||
}
|
}
|
||||||
|
|
||||||
function safeCdata(val) {
|
function safeCdata(val) {
|
||||||
return String(val).replace(/\]\]>/g, ']]]]><![CDATA[>')
|
return valToStr(val).replace(/\]\]>/g, ']]]]><![CDATA[>')
|
||||||
}
|
}
|
||||||
|
|
||||||
function escapeAttribute(val) {
|
function escapeAttribute(val) {
|
||||||
return String(val).replace(/"/g, '"').replace(/'/g, ''')
|
return valToStr(val).replace(/"/g, '"').replace(/'/g, ''')
|
||||||
}
|
}
|
||||||
// EXTERNAL MODULE: ./node_modules/xml-naming/src/index.js
|
// EXTERNAL MODULE: ./node_modules/xml-naming/src/index.js
|
||||||
var src = __webpack_require__(4658);
|
var src = __webpack_require__(4658);
|
||||||
@@ -15793,7 +15800,7 @@ function arrToStr(arr, options, indentation, matcher, stopNodeExpressions, qName
|
|||||||
if (!Array.isArray(arr)) {
|
if (!Array.isArray(arr)) {
|
||||||
// Non-array values (e.g. string tag values) should be treated as text content
|
// Non-array values (e.g. string tag values) should be treated as text content
|
||||||
if (arr !== undefined && arr !== null) {
|
if (arr !== undefined && arr !== null) {
|
||||||
let text = arr.toString();
|
let text = valToStr(arr);
|
||||||
text = replaceEntitiesValue(text, options);
|
text = replaceEntitiesValue(text, options);
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
@@ -15832,6 +15839,7 @@ function arrToStr(arr, options, indentation, matcher, stopNodeExpressions, qName
|
|||||||
tagText = options.tagValueProcessor(tagName, tagText);
|
tagText = options.tagValueProcessor(tagName, tagText);
|
||||||
tagText = replaceEntitiesValue(tagText, options);
|
tagText = replaceEntitiesValue(tagText, options);
|
||||||
}
|
}
|
||||||
|
tagText = valToStr(tagText);
|
||||||
if (isPreviousElementTag) {
|
if (isPreviousElementTag) {
|
||||||
xmlStr += indentation;
|
xmlStr += indentation;
|
||||||
}
|
}
|
||||||
@@ -15940,7 +15948,7 @@ function orderedJs2Xml_getRawContent(arr, options) {
|
|||||||
if (!Array.isArray(arr)) {
|
if (!Array.isArray(arr)) {
|
||||||
// Non-array values return as-is
|
// Non-array values return as-is
|
||||||
if (arr !== undefined && arr !== null) {
|
if (arr !== undefined && arr !== null) {
|
||||||
return arr.toString();
|
return valToStr(arr);
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@@ -15952,7 +15960,7 @@ function orderedJs2Xml_getRawContent(arr, options) {
|
|||||||
|
|
||||||
if (tagName === options.textNodeName) {
|
if (tagName === options.textNodeName) {
|
||||||
// Raw text content - NO processing, NO entity replacement
|
// Raw text content - NO processing, NO entity replacement
|
||||||
content += item[tagName];
|
content += valToStr(item[tagName]);
|
||||||
} else if (tagName === options.cdataPropName) {
|
} else if (tagName === options.cdataPropName) {
|
||||||
// CDATA content
|
// CDATA content
|
||||||
content += item[tagName][0][options.textNodeName];
|
content += item[tagName][0][options.textNodeName];
|
||||||
@@ -16293,11 +16301,11 @@ Builder.prototype.j2x = function (jObj, level, matcher, qNameValidator) {
|
|||||||
if (attr && !this.ignoreAttributesFn(attr, jPath)) {
|
if (attr && !this.ignoreAttributesFn(attr, jPath)) {
|
||||||
// Resolve the attribute name through sanitizeName
|
// Resolve the attribute name through sanitizeName
|
||||||
const resolvedAttr = fxb_resolveTagName(attr, true, this.options, matcher, qNameValidator);
|
const resolvedAttr = fxb_resolveTagName(attr, true, this.options, matcher, qNameValidator);
|
||||||
attrStr += this.buildAttrPairStr(resolvedAttr, '' + jObj[key], isCurrentStopNode);
|
attrStr += this.buildAttrPairStr(resolvedAttr, valToStr(jObj[key]), isCurrentStopNode);
|
||||||
} else if (!attr) {
|
} else if (!attr) {
|
||||||
//tag value
|
//tag value
|
||||||
if (key === this.options.textNodeName) {
|
if (key === this.options.textNodeName) {
|
||||||
let newval = this.options.tagValueProcessor(key, '' + jObj[key]);
|
let newval = this.options.tagValueProcessor(key, valToStr(jObj[key]));
|
||||||
val += this.replaceEntitiesValue(newval);
|
val += this.replaceEntitiesValue(newval);
|
||||||
} else {
|
} else {
|
||||||
// Check if this is a stopNode before building
|
// Check if this is a stopNode before building
|
||||||
@@ -16307,7 +16315,7 @@ Builder.prototype.j2x = function (jObj, level, matcher, qNameValidator) {
|
|||||||
|
|
||||||
if (isStopNode) {
|
if (isStopNode) {
|
||||||
// Build as raw content without encoding
|
// Build as raw content without encoding
|
||||||
const textValue = '' + jObj[key];
|
const textValue = valToStr(jObj[key]);
|
||||||
if (textValue === '') {
|
if (textValue === '') {
|
||||||
val += this.indentate(level) + '<' + resolvedKey + this.closeTag(resolvedKey) + this.tagEndChar;
|
val += this.indentate(level) + '<' + resolvedKey + this.closeTag(resolvedKey) + this.tagEndChar;
|
||||||
} else {
|
} else {
|
||||||
@@ -16349,6 +16357,7 @@ Builder.prototype.j2x = function (jObj, level, matcher, qNameValidator) {
|
|||||||
if (this.options.oneListGroup) {
|
if (this.options.oneListGroup) {
|
||||||
let textValue = this.options.tagValueProcessor(resolvedKey, item);
|
let textValue = this.options.tagValueProcessor(resolvedKey, item);
|
||||||
textValue = this.replaceEntitiesValue(textValue);
|
textValue = this.replaceEntitiesValue(textValue);
|
||||||
|
textValue = valToStr(textValue);
|
||||||
listTagVal += textValue;
|
listTagVal += textValue;
|
||||||
} else {
|
} else {
|
||||||
// Check if this is a stopNode before building
|
// Check if this is a stopNode before building
|
||||||
@@ -16358,7 +16367,7 @@ Builder.prototype.j2x = function (jObj, level, matcher, qNameValidator) {
|
|||||||
|
|
||||||
if (isStopNode) {
|
if (isStopNode) {
|
||||||
// Build as raw content without encoding
|
// Build as raw content without encoding
|
||||||
const textValue = '' + item;
|
const textValue = valToStr(item);
|
||||||
if (textValue === '') {
|
if (textValue === '') {
|
||||||
listTagVal += this.indentate(level) + '<' + resolvedKey + this.closeTag(resolvedKey) + this.tagEndChar;
|
listTagVal += this.indentate(level) + '<' + resolvedKey + this.closeTag(resolvedKey) + this.tagEndChar;
|
||||||
} else {
|
} else {
|
||||||
@@ -16382,7 +16391,7 @@ Builder.prototype.j2x = function (jObj, level, matcher, qNameValidator) {
|
|||||||
for (let j = 0; j < L; j++) {
|
for (let j = 0; j < L; j++) {
|
||||||
// Resolve attribute names inside attributesGroupName
|
// Resolve attribute names inside attributesGroupName
|
||||||
const resolvedAttr = fxb_resolveTagName(Ks[j], true, this.options, matcher, qNameValidator);
|
const resolvedAttr = fxb_resolveTagName(Ks[j], true, this.options, matcher, qNameValidator);
|
||||||
attrStr += this.buildAttrPairStr(resolvedAttr, '' + jObj[key][Ks[j]], isCurrentStopNode);
|
attrStr += this.buildAttrPairStr(resolvedAttr, valToStr(jObj[key][Ks[j]]), isCurrentStopNode);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val += this.processTextOrObjNode(jObj[key], resolvedKey, level, matcher, qNameValidator)
|
val += this.processTextOrObjNode(jObj[key], resolvedKey, level, matcher, qNameValidator)
|
||||||
@@ -16394,7 +16403,7 @@ Builder.prototype.j2x = function (jObj, level, matcher, qNameValidator) {
|
|||||||
|
|
||||||
Builder.prototype.buildAttrPairStr = function (attrName, val, isStopNode) {
|
Builder.prototype.buildAttrPairStr = function (attrName, val, isStopNode) {
|
||||||
if (!isStopNode) {
|
if (!isStopNode) {
|
||||||
val = this.options.attributeValueProcessor(attrName, '' + val);
|
val = this.options.attributeValueProcessor(attrName, valToStr(val));
|
||||||
val = this.replaceEntitiesValue(val);
|
val = this.replaceEntitiesValue(val);
|
||||||
}
|
}
|
||||||
if (this.options.suppressBooleanAttributes && val === "true") {
|
if (this.options.suppressBooleanAttributes && val === "true") {
|
||||||
@@ -16654,6 +16663,10 @@ Builder.prototype.buildTextValNode = function (val, key, attrStr, level, matcher
|
|||||||
// Normal processing: apply tagValueProcessor and entity replacement
|
// Normal processing: apply tagValueProcessor and entity replacement
|
||||||
let textValue = this.options.tagValueProcessor(key, val);
|
let textValue = this.options.tagValueProcessor(key, val);
|
||||||
textValue = this.replaceEntitiesValue(textValue);
|
textValue = this.replaceEntitiesValue(textValue);
|
||||||
|
// tagValueProcessor may return the raw value unchanged (default is identity), and
|
||||||
|
// replaceEntitiesValue no-ops on non-strings, so a plain number can still reach here;
|
||||||
|
// stringify it now, sign-preserving, before it's implicitly ToString'd below.
|
||||||
|
textValue = valToStr(textValue);
|
||||||
|
|
||||||
if (textValue === '') {
|
if (textValue === '') {
|
||||||
return this.indentate(level) + '<' + key + attrStr + this.closeTag(key) + this.tagEndChar;
|
return this.indentate(level) + '<' + key + attrStr + this.closeTag(key) + this.tagEndChar;
|
||||||
@@ -16695,8 +16708,8 @@ function isAttribute(name /*, options*/) {
|
|||||||
|
|
||||||
// EXTERNAL MODULE: ./node_modules/fast-xml-parser/src/fxp.js
|
// EXTERNAL MODULE: ./node_modules/fast-xml-parser/src/fxp.js
|
||||||
var fxp = __webpack_require__(5824);
|
var fxp = __webpack_require__(5824);
|
||||||
// EXTERNAL MODULE: ./node_modules/fast-xml-parser/src/xmlparser/XMLParser.js + 22 modules
|
// EXTERNAL MODULE: ./node_modules/fast-xml-parser/src/xmlparser/XMLParser.js + 23 modules
|
||||||
var XMLParser = __webpack_require__(6009);
|
var XMLParser = __webpack_require__(1143);
|
||||||
;// CONCATENATED MODULE: ./node_modules/@azure/core-xml/dist/esm/xml.common.js
|
;// CONCATENATED MODULE: ./node_modules/@azure/core-xml/dist/esm/xml.common.js
|
||||||
// Copyright (c) Microsoft Corporation.
|
// Copyright (c) Microsoft Corporation.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|||||||
330
dist/setup/220.index.js
vendored
330
dist/setup/220.index.js
vendored
@@ -1,330 +0,0 @@
|
|||||||
export const id = 220;
|
|
||||||
export const ids = [220];
|
|
||||||
export const modules = {
|
|
||||||
|
|
||||||
/***/ 3220:
|
|
||||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
||||||
|
|
||||||
|
|
||||||
// EXPORTS
|
|
||||||
__webpack_require__.d(__webpack_exports__, {
|
|
||||||
MicrosoftDistributions: () => (/* binding */ MicrosoftDistributions)
|
|
||||||
});
|
|
||||||
|
|
||||||
// UNUSED EXPORTS: MICROSOFT_PUBLIC_KEY
|
|
||||||
|
|
||||||
// EXTERNAL MODULE: ./src/distributions/base-installer.ts + 2 modules
|
|
||||||
var base_installer = __webpack_require__(6242);
|
|
||||||
// EXTERNAL MODULE: ./src/util.ts
|
|
||||||
var util = __webpack_require__(4527);
|
|
||||||
// EXTERNAL MODULE: ./src/gpg.ts
|
|
||||||
var gpg = __webpack_require__(8343);
|
|
||||||
;// CONCATENATED MODULE: ./src/distributions/microsoft/microsoft-key.ts
|
|
||||||
// Microsoft Build of OpenJDK GPG signing key
|
|
||||||
// Retrieved from: https://download.visualstudio.microsoft.com/download/pr/b90071e2-e0cf-4411-98be-dbeb09d67bf0/8622862bcd54206e158c5abca0582c9b/464279_464280_aoc_20210208.asc
|
|
||||||
const MICROSOFT_PUBLIC_KEY = `-----BEGIN PGP PUBLIC KEY BLOCK-----
|
|
||||||
Version: BSN Pgp v1.1.0.0
|
|
||||||
|
|
||||||
mQENBGAhlWcBCADCQjj6huLTenvZSLej35e9YKEHm4lix2uvPOONexMaU8V2v7KL
|
|
||||||
RGdoXF7jwHci7efnPZ+9zpS2+g3rhvv8M7yWy9E/1psEtGzvmp1IL/qIabMEQqi+
|
|
||||||
UlhPGh7MQ/BkXAlic8Dyl3XYqr0EXS11iCiTr6Zkxs9Ee4V54gxL4gogRn4wk9sl
|
|
||||||
/nrjgDzMsUwla0pynoQQvYpqCdiAr3gKKllT1skCDqgVOMMyZxsx9HjZxg/3AJz6
|
|
||||||
r5i512L2R+3Hkv+XmxT+mnGBCFcny0DM7PjNXEmIK3ZSkro1tQML90zx3Fyh5esx
|
|
||||||
fpVvuIXGFV75o35VVCBZoiD3hcfOnIJsPQ9nABEBAAG0OE1pY3Jvc29mdCBKYXZh
|
|
||||||
IEVuZ2luZWVyaW5nIDxqYXZhcGxhdGluZnJhQG1pY3Jvc29mdC5jb20+iQE4BBMB
|
|
||||||
CAAiBQJgIZVnAhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRA1Ux0xWyHB
|
|
||||||
icwTCACJO2FGNocNvdUtAb+eDKuGwt0chAJdCES2ZtgBScwrwDyWpxpRznoXWBHL
|
|
||||||
MJeLyxJoKsCG3vVlY4uh48psCzVm3OKvi7MCPT955t8W6TzfSBxTpjR8zRgJkjPJ
|
|
||||||
EGhHTlusUfz7TtM5etJF0qscSJH1grcNsgtee97mk4QyEzT8Di83NQmYxKcBrliq
|
|
||||||
yK/SWWt8VkTyYAEO6L5PoB4L9r8ka27uQs+jgCw+/Z0JMtNmmhyNGY3+a1YtPeoy
|
|
||||||
JdQaI9LphfKGbVaz6SK2aol7vj+c2TG3TLUYdOYGMH1OZlri2GTkCVjwna2GC7p4
|
|
||||||
Fa133tP85xzJEq1XeXm8WeLFo2wV
|
|
||||||
=rHCS
|
|
||||||
-----END PGP PUBLIC KEY BLOCK-----`;
|
|
||||||
|
|
||||||
// EXTERNAL MODULE: ./src/constants.ts
|
|
||||||
var constants = __webpack_require__(7242);
|
|
||||||
// EXTERNAL MODULE: ./node_modules/@actions/core/lib/core.js + 7 modules
|
|
||||||
var core = __webpack_require__(3838);
|
|
||||||
// EXTERNAL MODULE: ./node_modules/@actions/tool-cache/lib/tool-cache.js + 2 modules
|
|
||||||
var tool_cache = __webpack_require__(9805);
|
|
||||||
// EXTERNAL MODULE: external "fs"
|
|
||||||
var external_fs_ = __webpack_require__(9896);
|
|
||||||
var external_fs_default = /*#__PURE__*/__webpack_require__.n(external_fs_);
|
|
||||||
// EXTERNAL MODULE: external "path"
|
|
||||||
var external_path_ = __webpack_require__(6928);
|
|
||||||
var external_path_default = /*#__PURE__*/__webpack_require__.n(external_path_);
|
|
||||||
;// CONCATENATED MODULE: ./src/distributions/microsoft/installer.ts
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class MicrosoftDistributions extends base_installer/* JavaBase */.O {
|
|
||||||
constructor(installerOptions) {
|
|
||||||
super('Microsoft', installerOptions);
|
|
||||||
}
|
|
||||||
async downloadTool(javaRelease) {
|
|
||||||
core/* info */.pq(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`);
|
|
||||||
let javaArchivePath = await this.downloadAndVerify(javaRelease);
|
|
||||||
if (this.verifySignature) {
|
|
||||||
try {
|
|
||||||
if (!javaRelease.signatureUrl) {
|
|
||||||
throw new Error(`Input 'verify-signature' is enabled, but no signature URL was found for Microsoft Build of OpenJDK version ${javaRelease.version}.`);
|
|
||||||
}
|
|
||||||
core/* info */.pq(`Verifying Java package signature...`);
|
|
||||||
try {
|
|
||||||
await gpg/* verifyPackageSignature */.Yi(javaArchivePath, javaRelease.signatureUrl, this.verifySignaturePublicKey ?? MICROSOFT_PUBLIC_KEY);
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
throw new Error(`Failed to verify signature for Microsoft Build of OpenJDK version ${javaRelease.version}. Signature URL: ${javaRelease.signatureUrl}. Error: ${error.message} ${constants/* SIGNATURE_VERIFICATION_FAILURE_HELP */.kQ}`, { cause: error });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
if (this.verifySignatureExplicitlyRequested) {
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
core/* warning */.$e(error instanceof Error ? error.message : `Unknown error: ${error}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
core/* info */.pq(`Extracting Java archive...`);
|
|
||||||
const extension = (0,util/* getDownloadArchiveExtension */.ag)();
|
|
||||||
if (process.platform === 'win32') {
|
|
||||||
javaArchivePath = (0,util/* renameWinArchive */.n2)(javaArchivePath);
|
|
||||||
}
|
|
||||||
const extractedJavaPath = await (0,util/* extractJdkFile */.PE)(javaArchivePath, extension);
|
|
||||||
const archiveName = external_fs_default().readdirSync(extractedJavaPath)[0];
|
|
||||||
const archivePath = external_path_default().join(extractedJavaPath, archiveName);
|
|
||||||
const javaPath = await (0,util/* cacheJdkDir */.Vj)(archivePath, this.toolcacheFolderName, this.getToolcacheVersionName(javaRelease.version), this.architecture);
|
|
||||||
return { version: javaRelease.version, path: javaPath };
|
|
||||||
}
|
|
||||||
async findPackageForDownload(range) {
|
|
||||||
const arch = this.distributionArchitecture();
|
|
||||||
if (arch !== 'x64' && arch !== 'aarch64') {
|
|
||||||
throw new Error(`Unsupported architecture: ${this.architecture}`);
|
|
||||||
}
|
|
||||||
if (!this.stable) {
|
|
||||||
throw new Error('Early access versions are not supported');
|
|
||||||
}
|
|
||||||
if (this.packageType !== 'jdk') {
|
|
||||||
throw new Error('Microsoft Build of OpenJDK provides only the `jdk` package type');
|
|
||||||
}
|
|
||||||
const manifest = await this.getAvailableVersions();
|
|
||||||
if (!manifest) {
|
|
||||||
throw new Error('Could not load manifest for Microsoft Build of OpenJDK');
|
|
||||||
}
|
|
||||||
const foundRelease = await tool_cache/* findFromManifest */.DC(range, true, manifest, arch);
|
|
||||||
if (!foundRelease) {
|
|
||||||
const availableVersionStrings = manifest.map(item => item.version);
|
|
||||||
throw this.createVersionNotFoundError(range, availableVersionStrings);
|
|
||||||
}
|
|
||||||
const file = foundRelease.files[0];
|
|
||||||
const signatureUrl = file.signature_url ?? `${file.download_url}.sig`;
|
|
||||||
return {
|
|
||||||
url: file.download_url,
|
|
||||||
signatureUrl,
|
|
||||||
version: foundRelease.version,
|
|
||||||
checksum: await this.fetchChecksum(`${file.download_url}.sha256sum.txt`, 'sha256')
|
|
||||||
};
|
|
||||||
}
|
|
||||||
supportsSignatureVerification() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
async getAvailableVersions() {
|
|
||||||
let releases = null;
|
|
||||||
const fileUrl = `https://aka.ms/download-jdk/microsoft-openjdk-versions.json`;
|
|
||||||
// Avoid leaking the GitHub token to a non-GitHub host (aka.ms redirects to a CDN).
|
|
||||||
const headers = { accept: 'application/json' };
|
|
||||||
let response = null;
|
|
||||||
if (core/* isDebug */._o()) {
|
|
||||||
console.time('Retrieving available versions for Microsoft took'); // eslint-disable-line no-console
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
response = await this.http.getJson(fileUrl, headers);
|
|
||||||
if (!response.result) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
core/* debug */.Yz(`Http request for microsoft-openjdk-versions.json failed with status code: ${response?.statusCode}. Error: ${err}`);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (response.result) {
|
|
||||||
releases = response.result;
|
|
||||||
}
|
|
||||||
if (core/* isDebug */._o() && releases) {
|
|
||||||
core/* startGroup */.Oh('Print information about available versions');
|
|
||||||
console.timeEnd('Retrieving available versions for Microsoft took'); // eslint-disable-line no-console
|
|
||||||
core/* debug */.Yz(`Available versions: [${releases.length}]`);
|
|
||||||
core/* debug */.Yz(releases.map(item => item.version).join(', '));
|
|
||||||
core/* endGroup */.N4();
|
|
||||||
}
|
|
||||||
return releases;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 8343:
|
|
||||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
||||||
|
|
||||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
||||||
/* harmony export */ Fh: () => (/* binding */ importKey),
|
|
||||||
/* harmony export */ Yi: () => (/* binding */ verifyPackageSignature),
|
|
||||||
/* harmony export */ mS: () => (/* binding */ removeGpgHome),
|
|
||||||
/* harmony export */ nY: () => (/* binding */ toGpgPath),
|
|
||||||
/* harmony export */ o6: () => (/* binding */ isGpgAvailable)
|
|
||||||
/* harmony export */ });
|
|
||||||
/* unused harmony export GPG_HOME_PREFIX */
|
|
||||||
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9896);
|
|
||||||
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
|
|
||||||
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6928);
|
|
||||||
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
|
|
||||||
/* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6982);
|
|
||||||
/* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_2__);
|
|
||||||
/* harmony import */ var _actions_io__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8701);
|
|
||||||
/* harmony import */ var _actions_exec__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(5260);
|
|
||||||
/* harmony import */ var _actions_tool_cache__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(9805);
|
|
||||||
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(4527);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const GPG_HOME_PREFIX = 'setup-java-gpg-';
|
|
||||||
const VERIFY_GPG_HOME_PREFIX = 'verify-signature-gpg-home-';
|
|
||||||
async function isGpgAvailable() {
|
|
||||||
return Boolean(await _actions_io__WEBPACK_IMPORTED_MODULE_3__/* .which */ .K7('gpg', false));
|
|
||||||
}
|
|
||||||
// Convert a Windows path (D:\a\_temp\...) to a POSIX path (/d/a/_temp/...).
|
|
||||||
// The Git-bundled GPG on Windows (MSYS2-based) uses POSIX path conventions
|
|
||||||
// internally. Passing Windows paths with backslashes can cause fatal GPG errors
|
|
||||||
// (exit code 2), so all paths passed to GPG must be in POSIX format on Windows.
|
|
||||||
function toGpgPath(p) {
|
|
||||||
if (process.platform !== 'win32')
|
|
||||||
return p;
|
|
||||||
return p
|
|
||||||
.replace(/\\/g, '/')
|
|
||||||
.replace(/^([A-Za-z]):\//, (_, drive) => `/${drive.toLowerCase()}/`);
|
|
||||||
}
|
|
||||||
function createGpgHome(prefix, tempDir = _util_js__WEBPACK_IMPORTED_MODULE_6__/* .getTempDir */ .G4()) {
|
|
||||||
const gpgHome = fs__WEBPACK_IMPORTED_MODULE_0__.mkdtempSync(path__WEBPACK_IMPORTED_MODULE_1__.join(tempDir, prefix));
|
|
||||||
if (process.platform !== 'win32') {
|
|
||||||
fs__WEBPACK_IMPORTED_MODULE_0__.chmodSync(gpgHome, 0o700);
|
|
||||||
}
|
|
||||||
return gpgHome;
|
|
||||||
}
|
|
||||||
async function importKey(privateKey) {
|
|
||||||
const gpgHome = createGpgHome(GPG_HOME_PREFIX);
|
|
||||||
const privateKeyFile = path__WEBPACK_IMPORTED_MODULE_1__.join(gpgHome, `private-key-${(0,crypto__WEBPACK_IMPORTED_MODULE_2__.randomUUID)()}.asc`);
|
|
||||||
try {
|
|
||||||
fs__WEBPACK_IMPORTED_MODULE_0__.writeFileSync(privateKeyFile, privateKey, {
|
|
||||||
encoding: 'utf-8',
|
|
||||||
flag: 'wx',
|
|
||||||
mode: 0o600
|
|
||||||
});
|
|
||||||
try {
|
|
||||||
await _actions_exec__WEBPACK_IMPORTED_MODULE_4__/* .exec */ .m('gpg', [
|
|
||||||
'--homedir',
|
|
||||||
toGpgPath(gpgHome),
|
|
||||||
'--batch',
|
|
||||||
'--import',
|
|
||||||
toGpgPath(privateKeyFile)
|
|
||||||
], { silent: true });
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
fs__WEBPACK_IMPORTED_MODULE_0__.rmSync(privateKeyFile, { force: true });
|
|
||||||
}
|
|
||||||
return gpgHome;
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
await removeGpgHome(gpgHome);
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
async function removeGpgHome(gpgHome) {
|
|
||||||
if (!gpgHome) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const resolvedGpgHome = path__WEBPACK_IMPORTED_MODULE_1__.resolve(gpgHome);
|
|
||||||
const resolvedTempDir = path__WEBPACK_IMPORTED_MODULE_1__.resolve(_util_js__WEBPACK_IMPORTED_MODULE_6__/* .getTempDir */ .G4());
|
|
||||||
if (path__WEBPACK_IMPORTED_MODULE_1__.dirname(resolvedGpgHome) !== resolvedTempDir ||
|
|
||||||
!path__WEBPACK_IMPORTED_MODULE_1__.basename(resolvedGpgHome).startsWith(GPG_HOME_PREFIX)) {
|
|
||||||
throw new Error(`Refusing to remove unexpected GPG home: ${gpgHome}`);
|
|
||||||
}
|
|
||||||
if (!fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(resolvedGpgHome)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await stopGpgAgent(resolvedGpgHome);
|
|
||||||
await _actions_io__WEBPACK_IMPORTED_MODULE_3__/* .rmRF */ .Yz(resolvedGpgHome);
|
|
||||||
}
|
|
||||||
async function stopGpgAgent(gpgHome) {
|
|
||||||
try {
|
|
||||||
await _actions_exec__WEBPACK_IMPORTED_MODULE_4__/* .exec */ .m('gpgconf', ['--homedir', toGpgPath(gpgHome), '--kill', 'gpg-agent'], { silent: true, ignoreReturnCode: true });
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
// gpgconf may be unavailable, but directory removal must still be attempted.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
async function verifyPackageSignature(archivePath, signatureUrl, publicKeyContent) {
|
|
||||||
const signaturePath = await _actions_tool_cache__WEBPACK_IMPORTED_MODULE_5__/* .downloadTool */ .bq(signatureUrl);
|
|
||||||
let gpgHome;
|
|
||||||
try {
|
|
||||||
// Both RUNNER_TEMP and TMPDIR can exceed macOS's 104-byte agent socket limit.
|
|
||||||
const tempDir = process.platform === 'darwin' ? '/tmp' : _util_js__WEBPACK_IMPORTED_MODULE_6__/* .getTempDir */ .G4();
|
|
||||||
gpgHome = createGpgHome(VERIFY_GPG_HOME_PREFIX, tempDir);
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
try {
|
|
||||||
await _actions_io__WEBPACK_IMPORTED_MODULE_3__/* .rmRF */ .Yz(signaturePath);
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
// ignore cleanup failures
|
|
||||||
}
|
|
||||||
throw new Error(`Failed to create temporary GPG home directory for signature verification: ${error.message}`, { cause: error });
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
const publicKeys = Array.isArray(publicKeyContent)
|
|
||||||
? publicKeyContent
|
|
||||||
: [publicKeyContent];
|
|
||||||
const publicKeyFiles = publicKeys.map((publicKey, index) => {
|
|
||||||
const publicKeyFile = path__WEBPACK_IMPORTED_MODULE_1__.join(gpgHome, `public-key-${index}.asc`);
|
|
||||||
fs__WEBPACK_IMPORTED_MODULE_0__.writeFileSync(publicKeyFile, publicKey, { encoding: 'utf-8' });
|
|
||||||
return toGpgPath(publicKeyFile);
|
|
||||||
});
|
|
||||||
const options = { silent: true };
|
|
||||||
await _actions_exec__WEBPACK_IMPORTED_MODULE_4__/* .exec */ .m('gpg', [
|
|
||||||
'--homedir',
|
|
||||||
toGpgPath(gpgHome),
|
|
||||||
'--batch',
|
|
||||||
'--import',
|
|
||||||
...publicKeyFiles
|
|
||||||
], options);
|
|
||||||
await _actions_exec__WEBPACK_IMPORTED_MODULE_4__/* .exec */ .m('gpg', [
|
|
||||||
'--homedir',
|
|
||||||
toGpgPath(gpgHome),
|
|
||||||
'--batch',
|
|
||||||
'--verify',
|
|
||||||
toGpgPath(signaturePath),
|
|
||||||
toGpgPath(archivePath)
|
|
||||||
], options);
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
await stopGpgAgent(gpgHome);
|
|
||||||
await _actions_io__WEBPACK_IMPORTED_MODULE_3__/* .rmRF */ .Yz(signaturePath);
|
|
||||||
await _actions_io__WEBPACK_IMPORTED_MODULE_3__/* .rmRF */ .Yz(gpgHome);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***/ })
|
|
||||||
|
|
||||||
};
|
|
||||||
44
dist/setup/282.index.js
vendored
44
dist/setup/282.index.js
vendored
@@ -34,16 +34,16 @@ class JetBrainsDistribution extends _base_installer_js__WEBPACK_IMPORTED_MODULE_
|
|||||||
async findPackageForDownload(range) {
|
async findPackageForDownload(range) {
|
||||||
const versionsRaw = await this.getAvailableVersions();
|
const versionsRaw = await this.getAvailableVersions();
|
||||||
const versions = versionsRaw.map(v => {
|
const versions = versionsRaw.map(v => {
|
||||||
const formattedVersion = `${v.semver}+${v.build}`;
|
const formattedVersion = (0,_util_js__WEBPACK_IMPORTED_MODULE_5__/* .normalizeJavaVersionToSemver */ .zZ)(`${v.semver}+${v.build}`);
|
||||||
return {
|
return {
|
||||||
version: formattedVersion,
|
version: formattedVersion,
|
||||||
url: v.url
|
url: v.url
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
const satisfiedVersions = versions
|
const satisfiedVersions = versions
|
||||||
.filter(item => (0,_util_js__WEBPACK_IMPORTED_MODULE_5__/* .isVersionSatisfies */ .y)(range, item.version))
|
.filter(item => this.isVersionSatisfied(range, item.version))
|
||||||
.sort((a, b) => {
|
.sort((a, b) => {
|
||||||
return -semver__WEBPACK_IMPORTED_MODULE_3___default().compareBuild(a.version, b.version);
|
return -this.compareVersions(a.version, b.version);
|
||||||
});
|
});
|
||||||
const resolvedFullVersion = satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
const resolvedFullVersion = satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
||||||
if (!resolvedFullVersion) {
|
if (!resolvedFullVersion) {
|
||||||
@@ -59,6 +59,44 @@ class JetBrainsDistribution extends _base_installer_js__WEBPACK_IMPORTED_MODULE_
|
|||||||
checksum: await this.fetchChecksum(`${resolvedFullVersion.url}.checksum`, ['sha512', 'sha256'])
|
checksum: await this.fetchChecksum(`${resolvedFullVersion.url}.checksum`, ['sha512', 'sha256'])
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
normalizeVersion(version) {
|
||||||
|
const normalized = super.normalizeVersion(version);
|
||||||
|
if (/^\d+\.\d+\.\d+(?:\.\d+)+(?:-ea)?$/.test(version)) {
|
||||||
|
// A patch-only request must match any JBR build of that patch.
|
||||||
|
normalized.version = version.replace(/-ea$/, '');
|
||||||
|
}
|
||||||
|
return normalized;
|
||||||
|
}
|
||||||
|
isVersionSatisfied(range, version) {
|
||||||
|
const patchRequest = range.match(/^(\d+\.\d+\.\d+)((?:\.\d+)+)$/);
|
||||||
|
if (patchRequest) {
|
||||||
|
const candidate = semver__WEBPACK_IMPORTED_MODULE_3___default().parse(version);
|
||||||
|
return (candidate !== null &&
|
||||||
|
semver__WEBPACK_IMPORTED_MODULE_3___default().eq(patchRequest[1], candidate) &&
|
||||||
|
(candidate.build.slice(0, -2).join('.') || '0') ===
|
||||||
|
patchRequest[2].slice(1));
|
||||||
|
}
|
||||||
|
return super.isVersionSatisfied(range, version);
|
||||||
|
}
|
||||||
|
compareVersions(a, b) {
|
||||||
|
const mainComparison = semver__WEBPACK_IMPORTED_MODULE_3___default().compare(a, b);
|
||||||
|
if (mainComparison !== 0) {
|
||||||
|
return mainComparison;
|
||||||
|
}
|
||||||
|
// JBR builds have two components (one in older releases). Any preceding
|
||||||
|
// metadata components are Java patch fields and take priority over builds.
|
||||||
|
const first = new (semver__WEBPACK_IMPORTED_MODULE_3___default().SemVer)(a).build;
|
||||||
|
const second = new (semver__WEBPACK_IMPORTED_MODULE_3___default().SemVer)(b).build;
|
||||||
|
const firstPatch = first.slice(0, -2);
|
||||||
|
const secondPatch = second.slice(0, -2);
|
||||||
|
for (let index = 0; index < Math.max(firstPatch.length, secondPatch.length); index++) {
|
||||||
|
const patchComparison = semver__WEBPACK_IMPORTED_MODULE_3___default().compareIdentifiers(firstPatch[index] ?? '0', secondPatch[index] ?? '0');
|
||||||
|
if (patchComparison !== 0) {
|
||||||
|
return patchComparison;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return semver__WEBPACK_IMPORTED_MODULE_3___default().compareBuild(first.length ? `0.0.0+${first.slice(-2).join('.')}` : '0.0.0', second.length ? `0.0.0+${second.slice(-2).join('.')}` : '0.0.0');
|
||||||
|
}
|
||||||
async downloadTool(javaRelease) {
|
async downloadTool(javaRelease) {
|
||||||
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .info */ .pq(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`);
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .info */ .pq(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`);
|
||||||
const javaArchivePath = await this.downloadAndVerify(javaRelease);
|
const javaArchivePath = await this.downloadAndVerify(javaRelease);
|
||||||
|
|||||||
343
dist/setup/772.index.js
vendored
Normal file
343
dist/setup/772.index.js
vendored
Normal file
File diff suppressed because one or more lines are too long
164
dist/setup/824.index.js
vendored
164
dist/setup/824.index.js
vendored
@@ -10,7 +10,7 @@ export const modules = {
|
|||||||
/* harmony export */ i: () => (/* binding */ XMLValidator)
|
/* harmony export */ i: () => (/* binding */ XMLValidator)
|
||||||
/* harmony export */ });
|
/* harmony export */ });
|
||||||
/* harmony import */ var _validator_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1176);
|
/* harmony import */ var _validator_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1176);
|
||||||
/* harmony import */ var _xmlparser_XMLParser_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6009);
|
/* harmony import */ var _xmlparser_XMLParser_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1143);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -627,7 +627,7 @@ function getPositionFromMatch(match) {
|
|||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 6009:
|
/***/ 1143:
|
||||||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||||||
|
|
||||||
|
|
||||||
@@ -1582,8 +1582,10 @@ function toNumber(str, options = {}) {
|
|||||||
return parse_int(trimmedStr, 2);
|
return parse_int(trimmedStr, 2);
|
||||||
} else if (options.octal && octRegex.test(trimmedStr)) {
|
} else if (options.octal && octRegex.test(trimmedStr)) {
|
||||||
return parse_int(trimmedStr, 8);
|
return parse_int(trimmedStr, 8);
|
||||||
} else if (!isFinite(trimmedStr)) { //Infinity
|
} else if (!isFinite(trimmedStr)) { //Infinity or not a number
|
||||||
return handleInfinity(str, Number(trimmedStr), options);
|
const num = Number(trimmedStr);
|
||||||
|
if (Number.isNaN(num)) return str; //not a number: always the original string
|
||||||
|
return handleInfinity(str, num, options); //only +/-Infinity reaches here
|
||||||
} else if (trimmedStr.includes('e') || trimmedStr.includes('E')) { //eNotation
|
} else if (trimmedStr.includes('e') || trimmedStr.includes('E')) { //eNotation
|
||||||
return resolveEnotation(str, trimmedStr, options);
|
return resolveEnotation(str, trimmedStr, options);
|
||||||
} else {
|
} else {
|
||||||
@@ -1595,8 +1597,8 @@ function toNumber(str, options = {}) {
|
|||||||
const leadingZeros = match[2];
|
const leadingZeros = match[2];
|
||||||
let numTrimmedByZeros = trimZeros(match[3]); //complete num without leading zeros
|
let numTrimmedByZeros = trimZeros(match[3]); //complete num without leading zeros
|
||||||
const decimalAdjacentToLeadingZeros = sign ? // 0., -00., 000.
|
const decimalAdjacentToLeadingZeros = sign ? // 0., -00., 000.
|
||||||
str[leadingZeros.length + 1] === "."
|
trimmedStr[leadingZeros.length + 1] === "."
|
||||||
: str[leadingZeros.length] === ".";
|
: trimmedStr[leadingZeros.length] === ".";
|
||||||
|
|
||||||
//trim ending zeros for floating number
|
//trim ending zeros for floating number
|
||||||
if (!options.leadingZeros //leading zeros are not allowed
|
if (!options.leadingZeros //leading zeros are not allowed
|
||||||
@@ -1644,8 +1646,8 @@ function resolveEnotation(str, trimmedStr, options) {
|
|||||||
const eChar = notation[3].indexOf("e") === -1 ? "E" : "e";
|
const eChar = notation[3].indexOf("e") === -1 ? "E" : "e";
|
||||||
const leadingZeros = notation[2];
|
const leadingZeros = notation[2];
|
||||||
const eAdjacentToLeadingZeros = sign ? // 0E.
|
const eAdjacentToLeadingZeros = sign ? // 0E.
|
||||||
str[leadingZeros.length + 1] === eChar
|
trimmedStr[leadingZeros.length + 1] === eChar
|
||||||
: str[leadingZeros.length] === eChar;
|
: trimmedStr[leadingZeros.length] === eChar;
|
||||||
|
|
||||||
if (leadingZeros.length > 1 && eAdjacentToLeadingZeros) return str;
|
if (leadingZeros.length > 1 && eAdjacentToLeadingZeros) return str;
|
||||||
else if (leadingZeros.length === 1
|
else if (leadingZeros.length === 1
|
||||||
@@ -1654,8 +1656,7 @@ function resolveEnotation(str, trimmedStr, options) {
|
|||||||
} else if (leadingZeros.length > 0) {
|
} else if (leadingZeros.length > 0) {
|
||||||
// Has leading zeros — only accept if leadingZeros option allows it
|
// Has leading zeros — only accept if leadingZeros option allows it
|
||||||
if (options.leadingZeros && !eAdjacentToLeadingZeros) {
|
if (options.leadingZeros && !eAdjacentToLeadingZeros) {
|
||||||
trimmedStr = (notation[1] || "") + notation[3];
|
return Number(trimmedStr); // Number() accepts leading zeros; stripping can leave a mantissa-less ".e0"
|
||||||
return Number(trimmedStr);
|
|
||||||
} else return str;
|
} else return str;
|
||||||
} else {
|
} else {
|
||||||
// No leading zeros — always valid e-notation, parse it
|
// No leading zeros — always valid e-notation, parse it
|
||||||
@@ -1718,6 +1719,7 @@ function handleInfinity(str, num, options) {
|
|||||||
return str; // Return original string like "1e1000"
|
return str; // Return original string like "1e1000"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
;// CONCATENATED MODULE: ./node_modules/fast-xml-parser/src/ignoreAttributes.js
|
;// CONCATENATED MODULE: ./node_modules/fast-xml-parser/src/ignoreAttributes.js
|
||||||
function getIgnoreAttributesFn(ignoreAttributes) {
|
function getIgnoreAttributesFn(ignoreAttributes) {
|
||||||
if (typeof ignoreAttributes === 'function') {
|
if (typeof ignoreAttributes === 'function') {
|
||||||
@@ -3899,6 +3901,56 @@ const SQL_STRICT_PATTERNS = [...sql, ...SQL_STRICT_EXTRA];
|
|||||||
|
|
||||||
/* harmony default export */ const sql_strict = (SQL_STRICT_PATTERNS);
|
/* harmony default export */ const sql_strict = (SQL_STRICT_PATTERNS);
|
||||||
|
|
||||||
|
;// CONCATENATED MODULE: ./node_modules/is-unsafe/src/util/decode-entities.js
|
||||||
|
/**
|
||||||
|
* Decode the HTML character references that matter for markup-context
|
||||||
|
* detection.
|
||||||
|
*
|
||||||
|
* Browsers decode character references in attribute values before they
|
||||||
|
* interpret a URL, so `javascript:alert(1)` in an href is the
|
||||||
|
* `javascript:` scheme. The HTML/XML/SVG rules match literal characters, so
|
||||||
|
* without this step such payloads slip through.
|
||||||
|
*
|
||||||
|
* Deliberately NOT a full entity decoder. It decodes only:
|
||||||
|
* - decimal refs : : : : (any leading zeros,
|
||||||
|
* trailing ; optional — browsers accept both)
|
||||||
|
* - hex refs : : : : (same)
|
||||||
|
* - named refs : 	 

|
||||||
|
* Named refs are CASE-SENSITIVE and REQUIRE the trailing ';', exactly
|
||||||
|
* like a browser (so `&COLON;` and `&colon` are not decoded).
|
||||||
|
* 	 / 
 matter because the URL parser strips tab/newline,
|
||||||
|
* so `java	script:` is still a javascript: URL.
|
||||||
|
*
|
||||||
|
* It does NOT decode & (single pass only), so double-encoded text such as
|
||||||
|
* "&lt;script&gt;" stays literal — a browser renders that as text.
|
||||||
|
*
|
||||||
|
* All quantifiers are bounded; no ReDoS risk.
|
||||||
|
*
|
||||||
|
* @param {string} input
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
const NAMED = Object.freeze({
|
||||||
|
colon: ':',
|
||||||
|
Tab: '\t',
|
||||||
|
NewLine: '\n',
|
||||||
|
});
|
||||||
|
|
||||||
|
const ENTITY_RE =
|
||||||
|
/&(?:#[xX]0*([0-9a-fA-F]{1,6});?|#0*([0-9]{1,7});?|([a-zA-Z][a-zA-Z0-9]{1,15});)/g;
|
||||||
|
|
||||||
|
function decodeEntities(input) {
|
||||||
|
if (input.indexOf('&') === -1) return input;
|
||||||
|
|
||||||
|
return input.replace(ENTITY_RE, (match, hex, dec, name) => {
|
||||||
|
if (name !== undefined) {
|
||||||
|
return Object.prototype.hasOwnProperty.call(NAMED, name) ? NAMED[name] : match;
|
||||||
|
}
|
||||||
|
const cp = hex !== undefined ? parseInt(hex, 16) : parseInt(dec, 10);
|
||||||
|
if (!Number.isFinite(cp) || cp > 0x10ffff) return match;
|
||||||
|
return String.fromCodePoint(cp);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
;// CONCATENATED MODULE: ./node_modules/is-unsafe/src/contexts/html.js
|
;// CONCATENATED MODULE: ./node_modules/is-unsafe/src/contexts/html.js
|
||||||
/**
|
/**
|
||||||
* HTML context patterns.
|
* HTML context patterns.
|
||||||
@@ -4062,7 +4114,8 @@ const XML_PATTERNS = [
|
|||||||
{
|
{
|
||||||
id: 'xml-namespace-confusion',
|
id: 'xml-namespace-confusion',
|
||||||
description: 'xmlns: attribute injection — can redefine namespaces to confuse parsers',
|
description: 'xmlns: attribute injection — can redefine namespaces to confuse parsers',
|
||||||
pattern: /\bxmlns\s*(?::\w{1,40})?\s*=/i,
|
// pattern: /\bxmlns\s*(?::\w{1,40})?\s*=/i,
|
||||||
|
pattern: /\bxmlns(?::\w{1,40})?\s*=/i,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'xml-comment-injection',
|
id: 'xml-comment-injection',
|
||||||
@@ -4581,6 +4634,11 @@ const LOG_PATTERNS = [
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Markup contexts are also matched against an entity-decoded copy of the input,
|
||||||
|
// because browsers decode HTML character references before interpreting a URL
|
||||||
|
// scheme (e.g. javascript:… is a javascript: URL).
|
||||||
|
|
||||||
|
|
||||||
// ─── VALID_CONTEXTS convenience re-export ─────────────────────────────────
|
// ─── VALID_CONTEXTS convenience re-export ─────────────────────────────────
|
||||||
// Importing this pulls in ALL contexts. Use it only when you need all of them
|
// Importing this pulls in ALL contexts. Use it only when you need all of them
|
||||||
// (e.g. for validation UI, tooling, or exhaustive audits).
|
// (e.g. for validation UI, tooling, or exhaustive audits).
|
||||||
@@ -4603,6 +4661,12 @@ const LOG_PATTERNS = [
|
|||||||
html.label = 'HTML';
|
html.label = 'HTML';
|
||||||
xml.label = 'XML';
|
xml.label = 'XML';
|
||||||
svg.label = 'SVG';
|
svg.label = 'SVG';
|
||||||
|
|
||||||
|
// Markup contexts: also test an entity-decoded copy (see util/decode-entities.js).
|
||||||
|
// Non-markup contexts (SQL, SHELL, LOG, …) are matched byte-for-byte as supplied.
|
||||||
|
html.decodeEntities = true;
|
||||||
|
xml.decodeEntities = true;
|
||||||
|
svg.decodeEntities = true;
|
||||||
sql.label = 'SQL';
|
sql.label = 'SQL';
|
||||||
sql_strict.label = 'SQL-STRICT';
|
sql_strict.label = 'SQL-STRICT';
|
||||||
shell.label = 'SHELL';
|
shell.label = 'SHELL';
|
||||||
@@ -4697,6 +4761,20 @@ function normalise(context) {
|
|||||||
return { lists: [context], regex: null };
|
return { lists: [context], regex: null };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For markup contexts, return an entity-decoded copy of `value` to test
|
||||||
|
* alongside the raw input, or null when there is nothing extra to test.
|
||||||
|
*
|
||||||
|
* @param {string} value
|
||||||
|
* @param {Rule[]} list
|
||||||
|
* @returns {string|null}
|
||||||
|
*/
|
||||||
|
function decodedCopy(value, list) {
|
||||||
|
if (!list.decodeEntities) return null;
|
||||||
|
const decoded = decodeEntities(value);
|
||||||
|
return decoded === value ? null : decoded;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test value against a single PatternList. Returns the first MatchResult or null.
|
* Test value against a single PatternList. Returns the first MatchResult or null.
|
||||||
*
|
*
|
||||||
@@ -4706,8 +4784,9 @@ function normalise(context) {
|
|||||||
*/
|
*/
|
||||||
function matchList(value, list) {
|
function matchList(value, list) {
|
||||||
const label = list.label ?? 'CUSTOM';
|
const label = list.label ?? 'CUSTOM';
|
||||||
|
const decoded = decodedCopy(value, list);
|
||||||
for (const rule of list) {
|
for (const rule of list) {
|
||||||
if (rule.pattern.test(value)) {
|
if (rule.pattern.test(value) || (decoded !== null && rule.pattern.test(decoded))) {
|
||||||
return { context: label, id: rule.id, description: rule.description, pattern: rule.pattern };
|
return { context: label, id: rule.id, description: rule.description, pattern: rule.pattern };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4805,8 +4884,9 @@ function allUnsafe(value, context) {
|
|||||||
|
|
||||||
for (const list of lists) {
|
for (const list of lists) {
|
||||||
const label = list.label ?? 'CUSTOM';
|
const label = list.label ?? 'CUSTOM';
|
||||||
|
const decoded = decodedCopy(value, list);
|
||||||
for (const rule of list) {
|
for (const rule of list) {
|
||||||
if (rule.pattern.test(value)) {
|
if (rule.pattern.test(value) || (decoded !== null && rule.pattern.test(decoded))) {
|
||||||
results.push({ context: label, id: rule.id, description: rule.description, pattern: rule.pattern });
|
results.push({ context: label, id: rule.id, description: rule.description, pattern: rule.pattern });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5104,7 +5184,15 @@ function buildAttributesMap(attrStr, jPath, tagName, force = false) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const parseXml = function (xmlData) {
|
const parseXml = function (xmlData) {
|
||||||
xmlData = xmlData.replace(/\r\n?/g, "\n"); //TODO: remove this line
|
const options = this.options;
|
||||||
|
const crlfPositions = options.captureMetaData ? [] : undefined;
|
||||||
|
xmlData = xmlData.replace(/\r\n?/g, options.captureMetaData ? (newline, index) => {
|
||||||
|
if (newline.length === 2) {
|
||||||
|
// Store the position after earlier CRLF pairs have been normalized.
|
||||||
|
crlfPositions.push(index - crlfPositions.length);
|
||||||
|
}
|
||||||
|
return "\n";
|
||||||
|
} : "\n");
|
||||||
const xmlObj = new XmlNode('!xml');
|
const xmlObj = new XmlNode('!xml');
|
||||||
let currentNode = xmlObj;
|
let currentNode = xmlObj;
|
||||||
let textData = "";
|
let textData = "";
|
||||||
@@ -5117,7 +5205,6 @@ const parseXml = function (xmlData) {
|
|||||||
this.entityExpansionCount = 0;
|
this.entityExpansionCount = 0;
|
||||||
this.currentExpandedLength = 0;
|
this.currentExpandedLength = 0;
|
||||||
this.doctypefound = false;
|
this.doctypefound = false;
|
||||||
const options = this.options;
|
|
||||||
const docTypeReader = new DocTypeReader(options.processEntities);
|
const docTypeReader = new DocTypeReader(options.processEntities);
|
||||||
const xmlLen = xmlData.length;
|
const xmlLen = xmlData.length;
|
||||||
for (let i = 0; i < xmlLen; i++) {//for each char in XML data
|
for (let i = 0; i < xmlLen; i++) {//for each char in XML data
|
||||||
@@ -5161,7 +5248,7 @@ const parseXml = function (xmlData) {
|
|||||||
currentNode = this.tagsNodeStack.pop() || xmlObj;//avoid recursion, set the parent tag scope
|
currentNode = this.tagsNodeStack.pop() || xmlObj;//avoid recursion, set the parent tag scope
|
||||||
|
|
||||||
if (options.captureMetaData && currentNode) {
|
if (options.captureMetaData && currentNode) {
|
||||||
currentNode.addEndIndex(closeIndex + 1);
|
currentNode.addEndIndex(getOriginalIndex(closeIndex + 1, crlfPositions));
|
||||||
}
|
}
|
||||||
textData = "";
|
textData = "";
|
||||||
i = closeIndex;
|
i = closeIndex;
|
||||||
@@ -5187,11 +5274,12 @@ const parseXml = function (xmlData) {
|
|||||||
if (tagData.tagName !== tagData.tagExp && tagData.attrExpPresent && options.ignoreAttributes !== true) {
|
if (tagData.tagName !== tagData.tagExp && tagData.attrExpPresent && options.ignoreAttributes !== true) {
|
||||||
childNode[":@"] = attsMap
|
childNode[":@"] = attsMap
|
||||||
}
|
}
|
||||||
this.addChild(currentNode, childNode, this.readonlyMatcher, i);
|
const startIndex = options.captureMetaData ? getOriginalIndex(i, crlfPositions) : i;
|
||||||
|
this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
|
||||||
|
|
||||||
if (options.captureMetaData) {
|
if (options.captureMetaData) {
|
||||||
// closeIndex points at '?' of the closing '?>'
|
// closeIndex points at '?' of the closing '?>'
|
||||||
currentNode.addEndIndex(tagData.closeIndex + 2);
|
currentNode.addEndIndex(getOriginalIndex(tagData.closeIndex + 2, crlfPositions));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5323,7 +5411,7 @@ const parseXml = function (xmlData) {
|
|||||||
this.isCurrentNodeStopNode = this.isItStopNode();
|
this.isCurrentNodeStopNode = this.isItStopNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
const startIndex = i;
|
const startIndex = options.captureMetaData ? getOriginalIndex(i, crlfPositions) : i;
|
||||||
if (this.isCurrentNodeStopNode) {
|
if (this.isCurrentNodeStopNode) {
|
||||||
let tagContent = "";
|
let tagContent = "";
|
||||||
|
|
||||||
@@ -5359,7 +5447,7 @@ const parseXml = function (xmlData) {
|
|||||||
this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
|
this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
|
||||||
|
|
||||||
if (options.captureMetaData) {
|
if (options.captureMetaData) {
|
||||||
currentNode.addEndIndex(i + 1);
|
currentNode.addEndIndex(getOriginalIndex(i + 1, crlfPositions));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//selfClosing tag
|
//selfClosing tag
|
||||||
@@ -5373,7 +5461,7 @@ const parseXml = function (xmlData) {
|
|||||||
this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
|
this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
|
||||||
|
|
||||||
if (options.captureMetaData) {
|
if (options.captureMetaData) {
|
||||||
currentNode.addEndIndex(closeIndex + 1);
|
currentNode.addEndIndex(getOriginalIndex(closeIndex + 1, crlfPositions));
|
||||||
}
|
}
|
||||||
this.matcher.pop(); // Pop self-closing tag
|
this.matcher.pop(); // Pop self-closing tag
|
||||||
this.isCurrentNodeStopNode = false; // Reset flag
|
this.isCurrentNodeStopNode = false; // Reset flag
|
||||||
@@ -5386,7 +5474,7 @@ const parseXml = function (xmlData) {
|
|||||||
this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
|
this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
|
||||||
|
|
||||||
if (options.captureMetaData) {
|
if (options.captureMetaData) {
|
||||||
currentNode.addEndIndex(result.closeIndex + 1);
|
currentNode.addEndIndex(getOriginalIndex(result.closeIndex + 1, crlfPositions));
|
||||||
}
|
}
|
||||||
this.matcher.pop(); // Pop unpaired tag
|
this.matcher.pop(); // Pop unpaired tag
|
||||||
this.isCurrentNodeStopNode = false; // Reset flag
|
this.isCurrentNodeStopNode = false; // Reset flag
|
||||||
@@ -5419,6 +5507,17 @@ const parseXml = function (xmlData) {
|
|||||||
return xmlObj.child;
|
return xmlObj.child;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getOriginalIndex(index, crlfPositions) {
|
||||||
|
let low = 0;
|
||||||
|
let high = crlfPositions.length;
|
||||||
|
while (low < high) {
|
||||||
|
const middle = Math.floor((low + high) / 2);
|
||||||
|
if (crlfPositions[middle] < index) low = middle + 1;
|
||||||
|
else high = middle;
|
||||||
|
}
|
||||||
|
return index + low;
|
||||||
|
}
|
||||||
|
|
||||||
function addChild(currentNode, childNode, matcher, startIndex) {
|
function addChild(currentNode, childNode, matcher, startIndex) {
|
||||||
// unset startIndex if not requested
|
// unset startIndex if not requested
|
||||||
if (!this.options.captureMetaData) startIndex = undefined;
|
if (!this.options.captureMetaData) startIndex = undefined;
|
||||||
@@ -5597,6 +5696,8 @@ function readStopNodeData(xmlData, tagName, i) {
|
|||||||
const startIndex = i;
|
const startIndex = i;
|
||||||
// Starting at 1 since we already have an open tag
|
// Starting at 1 since we already have an open tag
|
||||||
let openTagCount = 1;
|
let openTagCount = 1;
|
||||||
|
let lenient = false; // set once a quote-aware tag scan fails
|
||||||
|
let nextGt = -1; // cached index of the next '>'
|
||||||
|
|
||||||
const xmllen = xmlData.length;
|
const xmllen = xmlData.length;
|
||||||
for (; i < xmllen; i++) {
|
for (; i < xmllen; i++) {
|
||||||
@@ -5628,14 +5729,29 @@ function readStopNodeData(xmlData, tagName, i) {
|
|||||||
const closeIndex = findClosingIndex(xmlData, "]]>", i, "StopNode is not closed.") - 2;
|
const closeIndex = findClosingIndex(xmlData, "]]>", i, "StopNode is not closed.") - 2;
|
||||||
i = closeIndex;
|
i = closeIndex;
|
||||||
} else {
|
} else {
|
||||||
const tagData = readTagExp(xmlData, i, false)
|
const tagData = lenient ? undefined : readTagExp(xmlData, i, false);
|
||||||
|
|
||||||
if (tagData) {
|
if (tagData) {
|
||||||
const openTagName = tagData && tagData.tagName;
|
const openTagName = tagData.tagName;
|
||||||
if (openTagName === tagName && tagData.tagExp[tagData.tagExp.length - 1] !== "/") {
|
if (openTagName === tagName && tagData.tagExp[tagData.tagExp.length - 1] !== "/") {
|
||||||
openTagCount++;
|
openTagCount++;
|
||||||
}
|
}
|
||||||
i = tagData.closeIndex;
|
i = tagData.closeIndex;
|
||||||
|
} else {
|
||||||
|
// no closing '>'. use lenient approach to find '<' instead of readTagExp, to avoid repeated rescans.
|
||||||
|
lenient = true;
|
||||||
|
if (nextGt < i) {
|
||||||
|
nextGt = xmlData.indexOf(">", i);
|
||||||
|
if (nextGt === -1) return; // no '>' left, so no closing tag can follow
|
||||||
|
}
|
||||||
|
const nextLt = xmlData.indexOf("<", i + 1);
|
||||||
|
if (nextLt === -1 || nextLt > nextGt) { // looks like a real tag
|
||||||
|
const exp = xmlData.substring(i + 1, nextGt);
|
||||||
|
const sep = exp.search(/\s/);
|
||||||
|
const name = sep === -1 ? exp : exp.substring(0, sep);
|
||||||
|
if (name === tagName && exp[exp.length - 1] !== "/") openTagCount++;
|
||||||
|
i = nextGt;
|
||||||
|
} // else: treat this '<' as plain text
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
17
dist/setup/index.js
vendored
17
dist/setup/index.js
vendored
@@ -31545,6 +31545,8 @@ const CANONICAL_ARCHITECTURES = [
|
|||||||
'riscv64',
|
'riscv64',
|
||||||
's390x'
|
's390x'
|
||||||
];
|
];
|
||||||
|
// Used in environment-variable names and tool-cache paths.
|
||||||
|
const ARCHITECTURE_TOKEN = /^[A-Za-z0-9][A-Za-z0-9_-]*$/;
|
||||||
const PLATFORM_ALIASES = {
|
const PLATFORM_ALIASES = {
|
||||||
darwin: 'macos',
|
darwin: 'macos',
|
||||||
linux: 'linux',
|
linux: 'linux',
|
||||||
@@ -31554,10 +31556,17 @@ const PLATFORM_ALIASES = {
|
|||||||
function normalizeArchitecture(architecture) {
|
function normalizeArchitecture(architecture) {
|
||||||
const trimmedArchitecture = architecture.trim();
|
const trimmedArchitecture = architecture.trim();
|
||||||
const normalizedArchitecture = trimmedArchitecture.toLowerCase();
|
const normalizedArchitecture = trimmedArchitecture.toLowerCase();
|
||||||
return (ARCHITECTURE_ALIASES[normalizedArchitecture] ??
|
const alias = Object.prototype.hasOwnProperty.call(ARCHITECTURE_ALIASES, normalizedArchitecture)
|
||||||
|
? ARCHITECTURE_ALIASES[normalizedArchitecture]
|
||||||
|
: undefined;
|
||||||
|
const result = alias ??
|
||||||
(CANONICAL_ARCHITECTURES.includes(normalizedArchitecture)
|
(CANONICAL_ARCHITECTURES.includes(normalizedArchitecture)
|
||||||
? normalizedArchitecture
|
? normalizedArchitecture
|
||||||
: trimmedArchitecture));
|
: trimmedArchitecture);
|
||||||
|
if (!ARCHITECTURE_TOKEN.test(result)) {
|
||||||
|
throw new Error(`Unsupported architecture value: ${JSON.stringify(architecture)}`);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
function normalizePlatform(platform) {
|
function normalizePlatform(platform) {
|
||||||
return PLATFORM_ALIASES[platform];
|
return PLATFORM_ALIASES[platform];
|
||||||
@@ -36681,7 +36690,7 @@ async function getJavaDistribution(distributionName, installerOptions, jdkFile)
|
|||||||
return new LibericaNikDistributions(normalizedInstallerOptions);
|
return new LibericaNikDistributions(normalizedInstallerOptions);
|
||||||
}
|
}
|
||||||
case package_types/* JavaDistribution */.zS.Microsoft: {
|
case package_types/* JavaDistribution */.zS.Microsoft: {
|
||||||
const { MicrosoftDistributions } = await Promise.all(/* import() */[__nccwpck_require__.e(242), __nccwpck_require__.e(220)]).then(__nccwpck_require__.bind(__nccwpck_require__, 3220));
|
const { MicrosoftDistributions } = await Promise.all(/* import() */[__nccwpck_require__.e(242), __nccwpck_require__.e(772)]).then(__nccwpck_require__.bind(__nccwpck_require__, 4772));
|
||||||
return new MicrosoftDistributions(normalizedInstallerOptions);
|
return new MicrosoftDistributions(normalizedInstallerOptions);
|
||||||
}
|
}
|
||||||
case package_types/* JavaDistribution */.zS.Semeru: {
|
case package_types/* JavaDistribution */.zS.Semeru: {
|
||||||
@@ -36738,7 +36747,7 @@ async function getJavaDistribution(distributionName, installerOptions, jdkFile)
|
|||||||
|
|
||||||
|
|
||||||
function configureProblemMatcher(matcherPath) {
|
function configureProblemMatcher(matcherPath) {
|
||||||
const problemMatcherEnabled = (0,util/* getBooleanInput */.Vt)(constants/* INPUT_PROBLEM_MATCHER */.Wt, true);
|
const problemMatcherEnabled = (0,util/* getBooleanInput */.Vt)(constants/* INPUT_PROBLEM_MATCHER */.Wt, false);
|
||||||
if (!problemMatcherEnabled) {
|
if (!problemMatcherEnabled) {
|
||||||
setup_java_core/* debug */.Yz('Java problem matcher is disabled');
|
setup_java_core/* debug */.Yz('Java problem matcher is disabled');
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -659,9 +659,10 @@ runner, distribution, JDK size, network, and cache eviction pressure.
|
|||||||
|
|
||||||
The `architecture` input is normalized before setup-java checks the tool cache
|
The `architecture` input is normalized before setup-java checks the tool cache
|
||||||
or contacts a vendor. `amd64`, `ia32`, `arm`, and `arm64` are accepted aliases
|
or contacts a vendor. `amd64`, `ia32`, `arm`, and `arm64` are accepted aliases
|
||||||
for `x64`, `x86`, `armv7`, and `aarch64`. The table lists the combinations
|
for `x64`, `x86`, `armv7`, and `aarch64`. Every value must be one token that
|
||||||
setup-java validates up front; an individual Java patch release can still be
|
starts with a letter or digit and contains only letters, digits, `_`, or `-`.
|
||||||
absent from a vendor catalog.
|
The table lists the combinations setup-java validates up front; an individual
|
||||||
|
Java patch release can still be absent from a vendor catalog.
|
||||||
|
|
||||||
| Distribution | Linux | macOS | Windows | Other / version restrictions |
|
| Distribution | Linux | macOS | Windows | Other / version restrictions |
|
||||||
| --- | --- | --- | --- | --- |
|
| --- | --- | --- | --- | --- |
|
||||||
@@ -1309,7 +1310,7 @@ jobs:
|
|||||||
|
|
||||||
## Java problem matcher (compiler annotations)
|
## Java problem matcher (compiler annotations)
|
||||||
|
|
||||||
By default, `setup-java` registers a [problem matcher](https://github.com/actions/toolkit/blob/main/docs/problem-matchers.md) for Java after installing the JDK. It scans the log output of subsequent steps and turns Java diagnostics into GitHub [annotations](https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#setting-a-warning-message) that appear in the run summary and inline on the affected files. It matches three kinds of lines:
|
Java [problem matcher](https://github.com/actions/toolkit/blob/main/docs/problem-matchers.md) registration is disabled by default. Set `problem-matcher: true` to have `setup-java` register the matcher after installing the JDK. When enabled, it scans the log output of subsequent steps and turns Java diagnostics into GitHub [annotations](https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#setting-a-warning-message) that appear in the run summary and inline on the affected files. It matches three kinds of lines:
|
||||||
|
|
||||||
- Compiler errors and warnings, e.g. `App.java:12: error: cannot find symbol` (owner `javac`).
|
- Compiler errors and warnings, e.g. `App.java:12: error: cannot find symbol` (owner `javac`).
|
||||||
- Maven compiler errors and warnings, e.g. `[ERROR] /path/App.java:[12,5] cannot find symbol` (owner `maven-javac`).
|
- Maven compiler errors and warnings, e.g. `[ERROR] /path/App.java:[12,5] cannot find symbol` (owner `maven-javac`).
|
||||||
@@ -1317,9 +1318,9 @@ By default, `setup-java` registers a [problem matcher](https://github.com/action
|
|||||||
|
|
||||||
GitHub Actions limits problem matcher annotations to 10 of each severity per step and 50 annotations per job. Additional diagnostics remain available in the build log. Log grouping does not change these limits because every matched diagnostic still counts as an annotation.
|
GitHub Actions limits problem matcher annotations to 10 of each severity per step and 50 annotations per job. Additional diagnostics remain available in the build log. Log grouping does not change these limits because every matched diagnostic still counts as an annotation.
|
||||||
|
|
||||||
### Disabling the problem matcher
|
### Enabling the problem matcher
|
||||||
|
|
||||||
Set `problem-matcher` to `false` to prevent the matcher from being registered:
|
Set `problem-matcher` to `true` to enable annotations, including in workflows that previously relied on default registration:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
jobs:
|
jobs:
|
||||||
@@ -1332,13 +1333,13 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
distribution: '<distribution>'
|
distribution: '<distribution>'
|
||||||
java-version: '21'
|
java-version: '21'
|
||||||
problem-matcher: false
|
problem-matcher: true
|
||||||
|
|
||||||
- name: Build with Maven
|
- name: Build with Maven
|
||||||
run: mvn package --file pom.xml
|
run: mvn package --file pom.xml
|
||||||
```
|
```
|
||||||
|
|
||||||
Disabling the matcher only stops annotations from being created. Compiler output remains in the log, and compilation errors still fail the build step.
|
Omit `problem-matcher` or set it to `false` to prevent this action invocation from registering the matcher. Compiler output remains in the log, and compilation errors still fail the build step. This does not unregister matchers already registered by other steps or earlier action invocations.
|
||||||
|
|
||||||
## Publishing using Gradle
|
## Publishing using Gradle
|
||||||
```yaml
|
```yaml
|
||||||
|
|||||||
34
package-lock.json
generated
34
package-lock.json
generated
@@ -16,7 +16,7 @@
|
|||||||
"@actions/http-client": "^4.0.1",
|
"@actions/http-client": "^4.0.1",
|
||||||
"@actions/io": "^3.0.2",
|
"@actions/io": "^3.0.2",
|
||||||
"@actions/tool-cache": "^4.0.0",
|
"@actions/tool-cache": "^4.0.0",
|
||||||
"fast-xml-parser": "^5.11.2",
|
"fast-xml-parser": "^5.12.0",
|
||||||
"semver": "^7.8.5"
|
"semver": "^7.8.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -3903,9 +3903,9 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/fast-xml-builder": {
|
"node_modules/fast-xml-builder": {
|
||||||
"version": "1.3.0",
|
"version": "1.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/fast-xml-builder/-/fast-xml-builder-1.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/fast-xml-builder/-/fast-xml-builder-1.3.1.tgz",
|
||||||
"integrity": "sha512-F74cZEdCvuw9P41GAC3rod4X04jjWGM1JPEv/GWSqFTWLsdyMSBMBMlm9Hk3GLBgLBbdBNY8yee0pQh2RBVESQ==",
|
"integrity": "sha512-pIM/1n3ntFXKYrUZwW7QCK0gAW7XY+wzj1YMIV3tLDvPj/V+zTGJK5e3/4WJfwj0qWw2ElNXiTixda/R+3YSug==",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "github",
|
"type": "github",
|
||||||
@@ -3919,9 +3919,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/fast-xml-parser": {
|
"node_modules/fast-xml-parser": {
|
||||||
"version": "5.11.2",
|
"version": "5.12.0",
|
||||||
"resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.11.2.tgz",
|
"resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.12.0.tgz",
|
||||||
"integrity": "sha512-R9iDuNrQYeQut46cn2r2wHKn4HYzVDvDm5J1wW+koZewykv0yuO2HChTYeZtrULyHIDM9cj9TUXloCsueCQUog==",
|
"integrity": "sha512-/pXxRBtwxY9w8z7YbgsvIPPcPvFDsTbIkWwTQJhzNJPokj+TbN6ftmcv4j/pEQDvOCNnKGDzuk5Bo2oogIOiFg==",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "github",
|
"type": "github",
|
||||||
@@ -3930,11 +3930,11 @@
|
|||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nodable/entities": "^3.0.1",
|
"@nodable/entities": "^3.1.0",
|
||||||
"fast-xml-builder": "^1.2.0",
|
"fast-xml-builder": "^1.3.1",
|
||||||
"is-unsafe": "^2.0.0",
|
"is-unsafe": "^2.0.3",
|
||||||
"path-expression-matcher": "^1.6.2",
|
"path-expression-matcher": "^1.6.2",
|
||||||
"strnum": "^2.4.2",
|
"strnum": "^2.5.1",
|
||||||
"xml-naming": "^0.3.0"
|
"xml-naming": "^0.3.0"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
@@ -4368,9 +4368,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/is-unsafe": {
|
"node_modules/is-unsafe": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/is-unsafe/-/is-unsafe-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/is-unsafe/-/is-unsafe-2.0.3.tgz",
|
||||||
"integrity": "sha512-2LdV822R+wmI86unXA93WCFpL6g+av8ynWk0nrHyJqGop5VoocYsSLFgN8jrfalT6iGeLNM4KXuVSsULP53kEA==",
|
"integrity": "sha512-ZBllczCCO267vgdFb6Tq3pv+LhHaCiGMdr+ZsuL+OopruAg7S+3ZDs1vD0RPC0uSrkjzbraxaGjtX1YBxjPeFQ==",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "github",
|
"type": "github",
|
||||||
@@ -5951,9 +5951,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/strnum": {
|
"node_modules/strnum": {
|
||||||
"version": "2.4.2",
|
"version": "2.5.1",
|
||||||
"resolved": "https://registry.npmjs.org/strnum/-/strnum-2.4.2.tgz",
|
"resolved": "https://registry.npmjs.org/strnum/-/strnum-2.5.1.tgz",
|
||||||
"integrity": "sha512-rDG3Ah4TV0k1hWvLSzkZtMmLN9+eS+h3knq4MP6A42Y3Yh5qGNnOUs1jJkoSr8FG5dsL28c7KgkIBzSEykqtuw==",
|
"integrity": "sha512-UM4nTLWzQiDBseVxUGxN0wJzIk0UU89Qi7pKXz9qISo+lhviJikTuikBsK/oFRlpvYHvSdz0TVoLyQ+sEpYwxA==",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "github",
|
"type": "github",
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
"format-check": "prettier --no-error-on-unmatched-pattern --check \"**/*.{ts,yml,yaml}\"",
|
"format-check": "prettier --no-error-on-unmatched-pattern --check \"**/*.{ts,yml,yaml}\"",
|
||||||
"lint": "eslint \"**/*.ts\"",
|
"lint": "eslint \"**/*.ts\"",
|
||||||
"lint:fix": "eslint \"**/*.ts\" --fix",
|
"lint:fix": "eslint \"**/*.ts\" --fix",
|
||||||
|
"build:latest-versions-report": "ncc build -o lib/latest-versions-report src/reports/latest-versions.ts",
|
||||||
"check": "npm run format-check && npm run lint && npm run build && npm test",
|
"check": "npm run format-check && npm run lint && npm run build && npm test",
|
||||||
"fix": "npm run format && npm run lint:fix && npm run build",
|
"fix": "npm run format && npm run lint:fix && npm run build",
|
||||||
"prepare": "husky install",
|
"prepare": "husky install",
|
||||||
@@ -49,7 +50,7 @@
|
|||||||
"@actions/http-client": "^4.0.1",
|
"@actions/http-client": "^4.0.1",
|
||||||
"@actions/io": "^3.0.2",
|
"@actions/io": "^3.0.2",
|
||||||
"@actions/tool-cache": "^4.0.0",
|
"@actions/tool-cache": "^4.0.0",
|
||||||
"fast-xml-parser": "^5.11.2",
|
"fast-xml-parser": "^5.12.0",
|
||||||
"semver": "^7.8.5"
|
"semver": "^7.8.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
96
scripts/build-report-resolver.mjs
Normal file
96
scripts/build-report-resolver.mjs
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
import fs from 'node:fs';
|
||||||
|
import path from 'node:path';
|
||||||
|
import {execFileSync} from 'node:child_process';
|
||||||
|
import {createRequire} from 'node:module';
|
||||||
|
|
||||||
|
const [checkout, ref, destination] = process.argv.slice(2);
|
||||||
|
if (!checkout || !ref || !destination) {
|
||||||
|
throw new Error(
|
||||||
|
'Usage: node scripts/build-report-resolver.mjs <checkout> <ref> <output-dir>'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const root = path.resolve(checkout);
|
||||||
|
const output = path.resolve(destination);
|
||||||
|
const ts = createRequire(path.join(root, 'package.json'))('typescript');
|
||||||
|
const packageJson = JSON.parse(
|
||||||
|
fs.readFileSync(path.join(root, 'package.json'), 'utf8')
|
||||||
|
);
|
||||||
|
const source = {
|
||||||
|
ref,
|
||||||
|
sha: execFileSync('git', ['rev-parse', 'HEAD'], {
|
||||||
|
cwd: root,
|
||||||
|
encoding: 'utf8'
|
||||||
|
}).trim(),
|
||||||
|
version: packageJson.version
|
||||||
|
};
|
||||||
|
const capabilityFile = path.join(root, 'src/distributions/platform-types.ts');
|
||||||
|
const packageFile = path.join(root, 'src/distributions/package-types.ts');
|
||||||
|
const enumFile = fs.existsSync(packageFile)
|
||||||
|
? packageFile
|
||||||
|
: path.join(root, 'src/distributions/distribution-factory.ts');
|
||||||
|
const syntax = ts.createSourceFile(
|
||||||
|
enumFile,
|
||||||
|
fs.readFileSync(enumFile, 'utf8'),
|
||||||
|
ts.ScriptTarget.Latest,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
const declaration = syntax.statements.find(
|
||||||
|
statement =>
|
||||||
|
ts.isEnumDeclaration(statement) &&
|
||||||
|
statement.name.text === 'JavaDistribution'
|
||||||
|
);
|
||||||
|
if (!declaration) {
|
||||||
|
throw new Error(`Cannot find the distribution enum in ${enumFile}`);
|
||||||
|
}
|
||||||
|
const distributions = declaration.members
|
||||||
|
.map(member => {
|
||||||
|
if (!member.initializer || !ts.isStringLiteral(member.initializer)) {
|
||||||
|
throw new Error(`Expected a string-valued distribution in ${enumFile}`);
|
||||||
|
}
|
||||||
|
return member.initializer.text;
|
||||||
|
})
|
||||||
|
.filter(value => value !== 'jdkfile');
|
||||||
|
|
||||||
|
// Keep source and dependencies from the selected checkout. Only this small
|
||||||
|
// reporting entrypoint is injected; no installer or version matcher is replaced.
|
||||||
|
const entrypoint = path.join(root, 'report-resolver-entry.js');
|
||||||
|
fs.writeFileSync(
|
||||||
|
entrypoint,
|
||||||
|
`
|
||||||
|
export {getJavaDistribution} from './src/distributions/distribution-factory.ts';
|
||||||
|
import {LibericaDistributions} from './src/distributions/liberica/installer.ts';
|
||||||
|
${fs.existsSync(capabilityFile) ? "export {JAVA_PLATFORM_CAPABILITIES as capabilities} from './src/distributions/platform-types.ts';" : ''}
|
||||||
|
export const source = ${JSON.stringify(source)};
|
||||||
|
export const distributions = ${JSON.stringify(distributions)};
|
||||||
|
export function createSolarisInstaller(options) {
|
||||||
|
const installer = new LibericaDistributions(options);
|
||||||
|
const getPlatformOption = installer.getPlatformOption.bind(installer);
|
||||||
|
installer.getPlatformOption = () => getPlatformOption('sunos');
|
||||||
|
return installer;
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
{flag: 'wx'}
|
||||||
|
);
|
||||||
|
try {
|
||||||
|
execFileSync(
|
||||||
|
process.execPath,
|
||||||
|
[
|
||||||
|
path.join(root, 'node_modules/@vercel/ncc/dist/ncc/cli.js'),
|
||||||
|
'build',
|
||||||
|
entrypoint,
|
||||||
|
'-o',
|
||||||
|
output
|
||||||
|
],
|
||||||
|
{cwd: root, stdio: 'inherit'}
|
||||||
|
);
|
||||||
|
// v5 is CommonJS even when the artifact is loaded from an ESM workspace.
|
||||||
|
fs.writeFileSync(
|
||||||
|
path.join(output, 'package.json'),
|
||||||
|
JSON.stringify({
|
||||||
|
type: packageJson.type ?? 'commonjs'
|
||||||
|
})
|
||||||
|
);
|
||||||
|
} finally {
|
||||||
|
fs.rmSync(entrypoint, {force: true});
|
||||||
|
}
|
||||||
@@ -16,8 +16,8 @@ import {
|
|||||||
extractJdkFile,
|
extractJdkFile,
|
||||||
getGitHubToken,
|
getGitHubToken,
|
||||||
getNextPageUrlFromLinkHeader,
|
getNextPageUrlFromLinkHeader,
|
||||||
isVersionSatisfies,
|
|
||||||
MAX_PAGINATION_PAGES,
|
MAX_PAGINATION_PAGES,
|
||||||
|
normalizeJavaVersionToSemver,
|
||||||
validatePaginationUrl
|
validatePaginationUrl
|
||||||
} from '../../util.js';
|
} from '../../util.js';
|
||||||
import {OutgoingHttpHeaders} from 'http';
|
import {OutgoingHttpHeaders} from 'http';
|
||||||
@@ -38,7 +38,9 @@ export class JetBrainsDistribution extends JavaBase {
|
|||||||
const versionsRaw = await this.getAvailableVersions();
|
const versionsRaw = await this.getAvailableVersions();
|
||||||
|
|
||||||
const versions = versionsRaw.map(v => {
|
const versions = versionsRaw.map(v => {
|
||||||
const formattedVersion = `${v.semver}+${v.build}`;
|
const formattedVersion = normalizeJavaVersionToSemver(
|
||||||
|
`${v.semver}+${v.build}`
|
||||||
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
version: formattedVersion,
|
version: formattedVersion,
|
||||||
@@ -47,9 +49,9 @@ export class JetBrainsDistribution extends JavaBase {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const satisfiedVersions = versions
|
const satisfiedVersions = versions
|
||||||
.filter(item => isVersionSatisfies(range, item.version))
|
.filter(item => this.isVersionSatisfied(range, item.version))
|
||||||
.sort((a, b) => {
|
.sort((a, b) => {
|
||||||
return -semver.compareBuild(a.version, b.version);
|
return -this.compareVersions(a.version, b.version);
|
||||||
});
|
});
|
||||||
|
|
||||||
const resolvedFullVersion =
|
const resolvedFullVersion =
|
||||||
@@ -74,6 +76,61 @@ export class JetBrainsDistribution extends JavaBase {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected normalizeVersion(version: string) {
|
||||||
|
const normalized = super.normalizeVersion(version);
|
||||||
|
if (/^\d+\.\d+\.\d+(?:\.\d+)+(?:-ea)?$/.test(version)) {
|
||||||
|
// A patch-only request must match any JBR build of that patch.
|
||||||
|
normalized.version = version.replace(/-ea$/, '');
|
||||||
|
}
|
||||||
|
return normalized;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected isVersionSatisfied(range: string, version: string): boolean {
|
||||||
|
const patchRequest = range.match(/^(\d+\.\d+\.\d+)((?:\.\d+)+)$/);
|
||||||
|
if (patchRequest) {
|
||||||
|
const candidate = semver.parse(version);
|
||||||
|
return (
|
||||||
|
candidate !== null &&
|
||||||
|
semver.eq(patchRequest[1], candidate) &&
|
||||||
|
(candidate.build.slice(0, -2).join('.') || '0') ===
|
||||||
|
patchRequest[2].slice(1)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return super.isVersionSatisfied(range, version);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected compareVersions(a: string, b: string): number {
|
||||||
|
const mainComparison = semver.compare(a, b);
|
||||||
|
if (mainComparison !== 0) {
|
||||||
|
return mainComparison;
|
||||||
|
}
|
||||||
|
|
||||||
|
// JBR builds have two components (one in older releases). Any preceding
|
||||||
|
// metadata components are Java patch fields and take priority over builds.
|
||||||
|
const first = new semver.SemVer(a).build;
|
||||||
|
const second = new semver.SemVer(b).build;
|
||||||
|
const firstPatch = first.slice(0, -2);
|
||||||
|
const secondPatch = second.slice(0, -2);
|
||||||
|
for (
|
||||||
|
let index = 0;
|
||||||
|
index < Math.max(firstPatch.length, secondPatch.length);
|
||||||
|
index++
|
||||||
|
) {
|
||||||
|
const patchComparison = semver.compareIdentifiers(
|
||||||
|
firstPatch[index] ?? '0',
|
||||||
|
secondPatch[index] ?? '0'
|
||||||
|
);
|
||||||
|
if (patchComparison !== 0) {
|
||||||
|
return patchComparison;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return semver.compareBuild(
|
||||||
|
first.length ? `0.0.0+${first.slice(-2).join('.')}` : '0.0.0',
|
||||||
|
second.length ? `0.0.0+${second.slice(-2).join('.')}` : '0.0.0'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
protected async downloadTool(
|
protected async downloadTool(
|
||||||
javaRelease: JavaDownloadRelease
|
javaRelease: JavaDownloadRelease
|
||||||
): Promise<JavaInstallerResults> {
|
): Promise<JavaInstallerResults> {
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ export class LibericaDistributions extends JavaBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private getPlatformOption(
|
protected getPlatformOption(
|
||||||
platform: NodeJS.Platform = process.platform
|
platform: NodeJS.Platform = process.platform
|
||||||
): OsVersions {
|
): OsVersions {
|
||||||
switch (platform) {
|
switch (platform) {
|
||||||
|
|||||||
@@ -8,10 +8,12 @@ import {
|
|||||||
cacheJdkDir,
|
cacheJdkDir,
|
||||||
extractJdkFile,
|
extractJdkFile,
|
||||||
getDownloadArchiveExtension,
|
getDownloadArchiveExtension,
|
||||||
|
normalizeJavaVersionToSemver,
|
||||||
renameWinArchive
|
renameWinArchive
|
||||||
} from '../../util.js';
|
} from '../../util.js';
|
||||||
import * as gpg from '../../gpg.js';
|
import * as gpg from '../../gpg.js';
|
||||||
import {MICROSOFT_PUBLIC_KEY} from './microsoft-key.js';
|
import {MICROSOFT_PUBLIC_KEY} from './microsoft-key.js';
|
||||||
|
import bundledVersions from './microsoft-openjdk-versions.json' with {type: 'json'};
|
||||||
import {SIGNATURE_VERIFICATION_FAILURE_HELP} from '../../constants.js';
|
import {SIGNATURE_VERIFICATION_FAILURE_HELP} from '../../constants.js';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as tc from '@actions/tool-cache';
|
import * as tc from '@actions/tool-cache';
|
||||||
@@ -108,7 +110,20 @@ export class MicrosoftDistributions extends JavaBase {
|
|||||||
throw new Error('Could not load manifest for Microsoft Build of OpenJDK');
|
throw new Error('Could not load manifest for Microsoft Build of OpenJDK');
|
||||||
}
|
}
|
||||||
|
|
||||||
const foundRelease = await tc.findFromManifest(range, true, manifest, arch);
|
const findMatchingRelease = async (releases: tc.IToolRelease[]) => {
|
||||||
|
const matchingReleases = releases
|
||||||
|
.map(release => ({
|
||||||
|
...release,
|
||||||
|
version: normalizeJavaVersionToSemver(release.version)
|
||||||
|
}))
|
||||||
|
.filter(release => this.isVersionSatisfied(range, release.version));
|
||||||
|
|
||||||
|
return tc.findFromManifest(range, true, matchingReleases, arch);
|
||||||
|
};
|
||||||
|
|
||||||
|
const foundRelease =
|
||||||
|
(await findMatchingRelease(manifest)) ??
|
||||||
|
(await findMatchingRelease(bundledVersions));
|
||||||
|
|
||||||
if (!foundRelease) {
|
if (!foundRelease) {
|
||||||
const availableVersionStrings = manifest.map(item => item.version);
|
const availableVersionStrings = manifest.map(item => item.version);
|
||||||
|
|||||||
@@ -1,4 +1,47 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"version": "25.0.5+0.2",
|
||||||
|
"stable": true,
|
||||||
|
"release_url": "https://aka.ms/download-jdk",
|
||||||
|
"files": [
|
||||||
|
{
|
||||||
|
"filename": "microsoft-jdk-25.0.5.0.2-macos-x64.tar.gz",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "darwin",
|
||||||
|
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.5.0.2-macos-x64.tar.gz"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "microsoft-jdk-25.0.5.0.2-linux-x64.tar.gz",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.5.0.2-linux-x64.tar.gz"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "microsoft-jdk-25.0.5.0.2-windows-x64.zip",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "win32",
|
||||||
|
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.5.0.2-windows-x64.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "microsoft-jdk-25.0.5.0.2-macos-aarch64.tar.gz",
|
||||||
|
"arch": "aarch64",
|
||||||
|
"platform": "darwin",
|
||||||
|
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.5.0.2-macos-aarch64.tar.gz"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "microsoft-jdk-25.0.5.0.2-linux-aarch64.tar.gz",
|
||||||
|
"arch": "aarch64",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.5.0.2-linux-aarch64.tar.gz"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "microsoft-jdk-25.0.5.0.2-windows-aarch64.zip",
|
||||||
|
"arch": "aarch64",
|
||||||
|
"platform": "win32",
|
||||||
|
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.5.0.2-windows-aarch64.zip"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"version": "25.0.3",
|
"version": "25.0.3",
|
||||||
"stable": true,
|
"stable": true,
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ export class OracleDistribution extends JavaBase {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
const floatingUrl = isOnlyMajorProvided ? possibleUrls[0] : undefined;
|
const floatingUrl = isOnlyMajorProvided ? possibleUrls[0] : undefined;
|
||||||
|
let latestUrlNotFound = false;
|
||||||
|
|
||||||
possibleUrls.push(
|
possibleUrls.push(
|
||||||
`${ORACLE_DL_BASE}/${major}/archive/jdk-${range}_${platform}-${arch}_bin.${extension}`
|
`${ORACLE_DL_BASE}/${major}/archive/jdk-${range}_${platform}-${arch}_bin.${extension}`
|
||||||
@@ -123,6 +124,11 @@ export class OracleDistribution extends JavaBase {
|
|||||||
|
|
||||||
if (response.message.statusCode === HttpCodes.OK) {
|
if (response.message.statusCode === HttpCodes.OK) {
|
||||||
const floating = url === floatingUrl;
|
const floating = url === floatingUrl;
|
||||||
|
if (latestUrlNotFound) {
|
||||||
|
core.warning(
|
||||||
|
`Oracle JDK ${major} is no longer available from the latest endpoint. Falling back to its archived GA release, which may not include security updates.`
|
||||||
|
);
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
url,
|
url,
|
||||||
version: range,
|
version: range,
|
||||||
@@ -134,6 +140,10 @@ export class OracleDistribution extends JavaBase {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (url === floatingUrl) {
|
||||||
|
latestUrlNotFound = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (response.message.statusCode !== HttpCodes.NotFound) {
|
if (response.message.statusCode !== HttpCodes.NotFound) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Http request for Oracle JDK failed with status code: ${response.message.statusCode}`
|
`Http request for Oracle JDK failed with status code: ${response.message.statusCode}`
|
||||||
|
|||||||
@@ -192,6 +192,9 @@ const CANONICAL_ARCHITECTURES: readonly JavaArchitecture[] = [
|
|||||||
's390x'
|
's390x'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Used in environment-variable names and tool-cache paths.
|
||||||
|
const ARCHITECTURE_TOKEN = /^[A-Za-z0-9][A-Za-z0-9_-]*$/;
|
||||||
|
|
||||||
const PLATFORM_ALIASES: Readonly<
|
const PLATFORM_ALIASES: Readonly<
|
||||||
Partial<Record<NodeJS.Platform, JavaPlatform>>
|
Partial<Record<NodeJS.Platform, JavaPlatform>>
|
||||||
> = {
|
> = {
|
||||||
@@ -204,16 +207,29 @@ const PLATFORM_ALIASES: Readonly<
|
|||||||
export function normalizeArchitecture(architecture: string): string {
|
export function normalizeArchitecture(architecture: string): string {
|
||||||
const trimmedArchitecture = architecture.trim();
|
const trimmedArchitecture = architecture.trim();
|
||||||
const normalizedArchitecture = trimmedArchitecture.toLowerCase();
|
const normalizedArchitecture = trimmedArchitecture.toLowerCase();
|
||||||
return (
|
const alias = Object.prototype.hasOwnProperty.call(
|
||||||
ARCHITECTURE_ALIASES[normalizedArchitecture] ??
|
ARCHITECTURE_ALIASES,
|
||||||
|
normalizedArchitecture
|
||||||
|
)
|
||||||
|
? ARCHITECTURE_ALIASES[normalizedArchitecture]
|
||||||
|
: undefined;
|
||||||
|
const result =
|
||||||
|
alias ??
|
||||||
(CANONICAL_ARCHITECTURES.includes(
|
(CANONICAL_ARCHITECTURES.includes(
|
||||||
normalizedArchitecture as JavaArchitecture
|
normalizedArchitecture as JavaArchitecture
|
||||||
)
|
)
|
||||||
? normalizedArchitecture
|
? normalizedArchitecture
|
||||||
: trimmedArchitecture)
|
: trimmedArchitecture);
|
||||||
|
|
||||||
|
if (!ARCHITECTURE_TOKEN.test(result)) {
|
||||||
|
throw new Error(
|
||||||
|
`Unsupported architecture value: ${JSON.stringify(architecture)}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
export function normalizePlatform(
|
export function normalizePlatform(
|
||||||
platform: NodeJS.Platform
|
platform: NodeJS.Platform
|
||||||
): JavaPlatform | undefined {
|
): JavaPlatform | undefined {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {INPUT_PROBLEM_MATCHER} from './constants.js';
|
|||||||
import {getBooleanInput} from './util.js';
|
import {getBooleanInput} from './util.js';
|
||||||
|
|
||||||
export function configureProblemMatcher(matcherPath: string): void {
|
export function configureProblemMatcher(matcherPath: string): void {
|
||||||
const problemMatcherEnabled = getBooleanInput(INPUT_PROBLEM_MATCHER, true);
|
const problemMatcherEnabled = getBooleanInput(INPUT_PROBLEM_MATCHER, false);
|
||||||
|
|
||||||
if (!problemMatcherEnabled) {
|
if (!problemMatcherEnabled) {
|
||||||
core.debug('Java problem matcher is disabled');
|
core.debug('Java problem matcher is disabled');
|
||||||
|
|||||||
882
src/reports/latest-versions.ts
Normal file
882
src/reports/latest-versions.ts
Normal file
@@ -0,0 +1,882 @@
|
|||||||
|
import * as core from '@actions/core';
|
||||||
|
import * as httpm from '@actions/http-client';
|
||||||
|
import fs from 'fs';
|
||||||
|
import path from 'path';
|
||||||
|
import type {JavaDownloadRelease} from '../distributions/base-models.js';
|
||||||
|
import {JavaDistribution} from '../distributions/package-types.js';
|
||||||
|
import {
|
||||||
|
isAlpineLinux,
|
||||||
|
normalizePlatform
|
||||||
|
} from '../distributions/platform-types.js';
|
||||||
|
import {isMainModule} from '../is-main-module.js';
|
||||||
|
import {RetryingHttpClient} from '../retrying-http-client.js';
|
||||||
|
import {getLatestMajorVersion} from '../util.js';
|
||||||
|
import {
|
||||||
|
type ActionSource,
|
||||||
|
type MetadataResolver,
|
||||||
|
currentResolver,
|
||||||
|
getResolverArchitectures,
|
||||||
|
loadMetadataResolver
|
||||||
|
} from './resolver.js';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reports the exact JDK version each distribution currently resolves for a set
|
||||||
|
* of version specs, using the installers' own metadata resolution. Nothing is
|
||||||
|
* downloaded: resolution stops where `setup-java` would start the download.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Zulu's supported JDK catalog starts at Java 6, including non-LTS releases.
|
||||||
|
const FIRST_MAJOR_VERSION = 6;
|
||||||
|
export const REPORTED_DISTRIBUTIONS = currentResolver.distributions;
|
||||||
|
|
||||||
|
const PACKAGE_TYPE = 'jdk';
|
||||||
|
const CONCURRENCY = 6;
|
||||||
|
const METADATA_TIMEOUT_MS = 60_000;
|
||||||
|
const ORACLE_RELEASES_URL = 'https://java.oraclecloud.com/currentJavaReleases';
|
||||||
|
const MUSL_PLATFORM = 'linux-musl';
|
||||||
|
const PLATFORM_LABELS: Record<string, string> = {
|
||||||
|
linux: 'Linux',
|
||||||
|
[MUSL_PLATFORM]: 'Alpine Linux',
|
||||||
|
macos: 'macOS',
|
||||||
|
windows: 'Windows',
|
||||||
|
solaris: 'Solaris'
|
||||||
|
};
|
||||||
|
const PLATFORM_ORDER = Object.keys(PLATFORM_LABELS);
|
||||||
|
const ARCHITECTURE_ORDER = [
|
||||||
|
'x64',
|
||||||
|
'aarch64',
|
||||||
|
'x86',
|
||||||
|
'armv7',
|
||||||
|
'ppc64le',
|
||||||
|
'ppc64',
|
||||||
|
'riscv64',
|
||||||
|
's390x'
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* - `unsupported`: excluded by the action's package/platform capability maps.
|
||||||
|
* - `unavailable`: the vendor's metadata has no matching release.
|
||||||
|
* - `error`: the metadata lookup failed.
|
||||||
|
*/
|
||||||
|
export type ResolutionStatus =
|
||||||
|
'resolved' | 'unsupported' | 'unavailable' | 'error';
|
||||||
|
|
||||||
|
export interface VersionResolution {
|
||||||
|
distribution: string;
|
||||||
|
versionSpec: string;
|
||||||
|
platform: string;
|
||||||
|
architecture: string;
|
||||||
|
status: ResolutionStatus;
|
||||||
|
version?: string;
|
||||||
|
/** The release URL serves whatever build the vendor last published. */
|
||||||
|
floating?: boolean;
|
||||||
|
/** `Last-Modified` date of a floating artifact, from a HEAD request. */
|
||||||
|
publishedAt?: string;
|
||||||
|
/** Version the vendor currently advertises for a floating artifact. */
|
||||||
|
advertisedVersion?: string;
|
||||||
|
message?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ResolutionReport {
|
||||||
|
source: ActionSource;
|
||||||
|
platform: string;
|
||||||
|
generatedAt: string;
|
||||||
|
/** Expected platform/architecture probes, from this revision rather than main. */
|
||||||
|
targets?: Record<string, Record<string, string[]>>;
|
||||||
|
results: VersionResolution[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ReleaseResolver {
|
||||||
|
version: string;
|
||||||
|
http: httpm.HttpClient;
|
||||||
|
findPackageForDownload(range: string): Promise<JavaDownloadRelease>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Alpine is reported separately because installers pick musl builds there. */
|
||||||
|
export function getReportPlatform(
|
||||||
|
platform: NodeJS.Platform = process.platform,
|
||||||
|
alpine = isAlpineLinux(platform)
|
||||||
|
): string {
|
||||||
|
if (alpine) {
|
||||||
|
return MUSL_PLATFORM;
|
||||||
|
}
|
||||||
|
return normalizePlatform(platform) ?? platform;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Architectures `setup-java` supports for a distribution on a report
|
||||||
|
* platform, including ones restricted to some Java versions.
|
||||||
|
*/
|
||||||
|
export function getSupportedArchitectures(
|
||||||
|
distribution: string,
|
||||||
|
platform: string,
|
||||||
|
resolver: MetadataResolver = currentResolver
|
||||||
|
): string[] {
|
||||||
|
return getResolverArchitectures(resolver, distribution, platform);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function classifyResolutionError(error: unknown): ResolutionStatus {
|
||||||
|
const message = error instanceof Error ? error.message : String(error);
|
||||||
|
if (
|
||||||
|
/not supported|only supported|does not support|unsupported|not valid SemVer/i.test(
|
||||||
|
message
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
return 'unsupported';
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
(error instanceof Error && error.name === 'VersionNotFoundError') ||
|
||||||
|
/no matching version|no \w+ release for|could not determine the latest available|not supported|only supported|does not support|not available|could not find|unsupported/i.test(
|
||||||
|
message
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
return 'unavailable';
|
||||||
|
}
|
||||||
|
return 'error';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shares metadata responses between installer instances. Most installers
|
||||||
|
* fetch a vendor's whole release list for every request, and JetBrains probes
|
||||||
|
* each release URL with HEAD, so resolving many version/architecture
|
||||||
|
* combinations would otherwise repeat identical requests and exhaust API rate
|
||||||
|
* limits. Failed requests are also retained for this snapshot so an obsolete
|
||||||
|
* endpoint does not stall every major-version probe. Installers only read the
|
||||||
|
* status and headers of HEAD responses.
|
||||||
|
*/
|
||||||
|
function shareMetadataResponses(
|
||||||
|
http: httpm.HttpClient,
|
||||||
|
cache: Map<string, Promise<unknown>>
|
||||||
|
): void {
|
||||||
|
const share = <T>(key: string, request: () => Promise<T>): Promise<T> => {
|
||||||
|
let response = cache.get(key) as Promise<T> | undefined;
|
||||||
|
if (!response) {
|
||||||
|
response = new Promise<T>((resolve, reject) => {
|
||||||
|
const timer = setTimeout(() => {
|
||||||
|
http.dispose();
|
||||||
|
reject(
|
||||||
|
new Error(
|
||||||
|
`Metadata request timed out after ${METADATA_TIMEOUT_MS} ms: ${key.split('\n')[0]}`
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}, METADATA_TIMEOUT_MS);
|
||||||
|
Promise.resolve()
|
||||||
|
.then(request)
|
||||||
|
.then(
|
||||||
|
value => {
|
||||||
|
clearTimeout(timer);
|
||||||
|
resolve(value);
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
clearTimeout(timer);
|
||||||
|
reject(error);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
cache.set(key, response);
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
};
|
||||||
|
|
||||||
|
const getJson = http.getJson.bind(http);
|
||||||
|
http.getJson = (async (requestUrl: string, additionalHeaders?: object) =>
|
||||||
|
structuredClone(
|
||||||
|
await share(
|
||||||
|
`GET ${requestUrl}\n${JSON.stringify(additionalHeaders ?? {})}`,
|
||||||
|
() => getJson(requestUrl, additionalHeaders as never)
|
||||||
|
)
|
||||||
|
)) as typeof http.getJson;
|
||||||
|
|
||||||
|
const head = http.head.bind(http);
|
||||||
|
http.head = (requestUrl, additionalHeaders) =>
|
||||||
|
share(
|
||||||
|
`HEAD ${requestUrl}\n${JSON.stringify(additionalHeaders ?? {})}`,
|
||||||
|
() => head(requestUrl, additionalHeaders)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function describeFloatingRelease(
|
||||||
|
http: httpm.HttpClient,
|
||||||
|
distribution: string,
|
||||||
|
release: JavaDownloadRelease
|
||||||
|
): Promise<Pick<VersionResolution, 'publishedAt' | 'advertisedVersion'>> {
|
||||||
|
const details: Pick<VersionResolution, 'publishedAt' | 'advertisedVersion'> =
|
||||||
|
{};
|
||||||
|
try {
|
||||||
|
const response = await http.head(release.url);
|
||||||
|
const lastModified = response.message.headers['last-modified'];
|
||||||
|
if (lastModified && !Number.isNaN(Date.parse(lastModified))) {
|
||||||
|
details.publishedAt = new Date(lastModified).toISOString().slice(0, 10);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
core.debug(`HEAD ${release.url} failed: ${error}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Oracle's `/latest/` artifacts carry the NFTC license; only then is the
|
||||||
|
// release advertised by the Java Releases API the one being served.
|
||||||
|
if (distribution === JavaDistribution.Oracle) {
|
||||||
|
try {
|
||||||
|
const response = await http.getJson<{
|
||||||
|
releaseVersion?: string;
|
||||||
|
licenseDetails?: {licenseType?: string};
|
||||||
|
}>(`${ORACLE_RELEASES_URL}/${release.version.split('.')[0]}`);
|
||||||
|
if (
|
||||||
|
response.result?.releaseVersion &&
|
||||||
|
response.result.licenseDetails?.licenseType === 'NFTC'
|
||||||
|
) {
|
||||||
|
details.advertisedVersion = response.result.releaseVersion;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
core.debug(`Oracle Java Releases API lookup failed: ${error}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return details;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function resolveOne(
|
||||||
|
distributionName: string,
|
||||||
|
versionSpec: string,
|
||||||
|
platform: string,
|
||||||
|
architecture: string,
|
||||||
|
cache: Map<string, Promise<unknown>>,
|
||||||
|
http: httpm.HttpClient,
|
||||||
|
metadataResolver: MetadataResolver
|
||||||
|
): Promise<VersionResolution> {
|
||||||
|
const base = {
|
||||||
|
distribution: distributionName,
|
||||||
|
versionSpec,
|
||||||
|
platform,
|
||||||
|
architecture
|
||||||
|
};
|
||||||
|
|
||||||
|
let installer: unknown;
|
||||||
|
try {
|
||||||
|
const installerOptions = {
|
||||||
|
version: versionSpec,
|
||||||
|
architecture,
|
||||||
|
packageType: PACKAGE_TYPE,
|
||||||
|
checkLatest: true
|
||||||
|
};
|
||||||
|
if (platform === 'solaris') {
|
||||||
|
if (distributionName !== JavaDistribution.Liberica) {
|
||||||
|
return {
|
||||||
|
...base,
|
||||||
|
status: 'error',
|
||||||
|
message: `No Solaris metadata resolver for '${distributionName}'.`
|
||||||
|
};
|
||||||
|
}
|
||||||
|
installer =
|
||||||
|
await metadataResolver.createSolarisInstaller(installerOptions);
|
||||||
|
} else {
|
||||||
|
installer = await metadataResolver.getJavaDistribution(
|
||||||
|
distributionName,
|
||||||
|
installerOptions
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return {
|
||||||
|
...base,
|
||||||
|
status: classifyResolutionError(error),
|
||||||
|
message: error instanceof Error ? error.message : String(error)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (!installer) {
|
||||||
|
return {...base, status: 'error', message: 'Unknown distribution'};
|
||||||
|
}
|
||||||
|
|
||||||
|
// `findPackageForDownload` is the metadata step `setupJava` runs right
|
||||||
|
// before downloading; it is protected because the action never needs it on
|
||||||
|
// its own.
|
||||||
|
if (!isReleaseResolver(installer)) {
|
||||||
|
throw new Error(`Invalid metadata resolver for '${distributionName}'.`);
|
||||||
|
}
|
||||||
|
const resolver = installer;
|
||||||
|
// Fail closed if a resolver ever crosses the metadata/download boundary.
|
||||||
|
const forbidInstall = () => {
|
||||||
|
throw new Error(
|
||||||
|
'JDK download/install is forbidden in the versions report.'
|
||||||
|
);
|
||||||
|
};
|
||||||
|
Object.defineProperties(installer, {
|
||||||
|
setupJava: {value: forbidInstall},
|
||||||
|
downloadTool: {value: forbidInstall}
|
||||||
|
});
|
||||||
|
shareMetadataResponses(resolver.http, cache);
|
||||||
|
try {
|
||||||
|
const release = await resolver.findPackageForDownload(resolver.version);
|
||||||
|
// Older releases returned the requested major without a floating marker.
|
||||||
|
const floating =
|
||||||
|
release.floating || new URL(release.url).pathname.includes('/latest/');
|
||||||
|
return {
|
||||||
|
...base,
|
||||||
|
status: 'resolved',
|
||||||
|
version: release.version,
|
||||||
|
...(floating
|
||||||
|
? {
|
||||||
|
floating: true,
|
||||||
|
...(await describeFloatingRelease(http, distributionName, release))
|
||||||
|
}
|
||||||
|
: {})
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
return {
|
||||||
|
...base,
|
||||||
|
status: classifyResolutionError(error),
|
||||||
|
message: error instanceof Error ? error.message : String(error)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function isReleaseResolver(value: unknown): value is ReleaseResolver {
|
||||||
|
return (
|
||||||
|
typeof value === 'object' &&
|
||||||
|
value !== null &&
|
||||||
|
'version' in value &&
|
||||||
|
typeof value.version === 'string' &&
|
||||||
|
'http' in value &&
|
||||||
|
typeof value.http === 'object' &&
|
||||||
|
value.http !== null &&
|
||||||
|
'getJson' in value.http &&
|
||||||
|
typeof value.http.getJson === 'function' &&
|
||||||
|
'head' in value.http &&
|
||||||
|
typeof value.http.head === 'function' &&
|
||||||
|
'findPackageForDownload' in value &&
|
||||||
|
typeof value.findPackageForDownload === 'function'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function runWithConcurrency<T>(
|
||||||
|
tasks: (() => Promise<T>)[],
|
||||||
|
limit: number
|
||||||
|
): Promise<T[]> {
|
||||||
|
const results: T[] = new Array(tasks.length);
|
||||||
|
let next = 0;
|
||||||
|
const worker = async () => {
|
||||||
|
while (next < tasks.length) {
|
||||||
|
const index = next++;
|
||||||
|
results[index] = await tasks[index]();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
await Promise.all(
|
||||||
|
Array.from({length: Math.min(limit, tasks.length)}, worker)
|
||||||
|
);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Every supported stable major through the newest GA release, plus `latest`. */
|
||||||
|
export async function getDefaultVersions(
|
||||||
|
http: httpm.HttpClient
|
||||||
|
): Promise<string[]> {
|
||||||
|
shareMetadataResponses(http, new Map());
|
||||||
|
const latestMajor = await getLatestMajorVersion(http);
|
||||||
|
if (!Number.isSafeInteger(latestMajor) || latestMajor < FIRST_MAJOR_VERSION) {
|
||||||
|
throw new Error(
|
||||||
|
`Invalid newest Java feature release in vendor metadata: ${latestMajor}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
const versions = Array.from(
|
||||||
|
{length: latestMajor - FIRST_MAJOR_VERSION + 1},
|
||||||
|
(_, index) => String(FIRST_MAJOR_VERSION + index)
|
||||||
|
);
|
||||||
|
return [...versions, 'latest'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Distributions for which vendor metadata matched nothing at all. Missing
|
||||||
|
* every requested version on every platform signals an unreachable or changed
|
||||||
|
* metadata source rather than genuinely unavailable releases.
|
||||||
|
*/
|
||||||
|
export function findSilentDistributions(
|
||||||
|
results: VersionResolution[]
|
||||||
|
): string[] {
|
||||||
|
const distributions = [...new Set(results.map(r => r.distribution))];
|
||||||
|
return distributions.filter(distribution => {
|
||||||
|
const distributionResults = results.filter(
|
||||||
|
r => r.distribution === distribution
|
||||||
|
);
|
||||||
|
return (
|
||||||
|
!distributionResults.some(r => r.status === 'resolved') &&
|
||||||
|
distributionResults.some(r => r.status === 'unavailable')
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function resolveLatestVersions(options: {
|
||||||
|
distributions: string[];
|
||||||
|
versions: string[];
|
||||||
|
/** Restricts the architectures; defaults to all supported ones. */
|
||||||
|
architectures?: string[];
|
||||||
|
/** Solaris metadata can be resolved on any host; other targets use the host. */
|
||||||
|
platform?: string;
|
||||||
|
resolver?: MetadataResolver;
|
||||||
|
}): Promise<ResolutionReport> {
|
||||||
|
const resolver = options.resolver ?? currentResolver;
|
||||||
|
const http = new RetryingHttpClient('actions/setup-java');
|
||||||
|
shareMetadataResponses(http, new Map());
|
||||||
|
const hostPlatform = getReportPlatform();
|
||||||
|
const platform = options.platform || hostPlatform;
|
||||||
|
if (platform !== hostPlatform && platform !== 'solaris') {
|
||||||
|
throw new Error(
|
||||||
|
`Cannot resolve '${platform}' metadata on '${hostPlatform}'; use a matching runner.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
const tasks = options.distributions.map(distribution => async () => {
|
||||||
|
const architectures = getSupportedArchitectures(
|
||||||
|
distribution,
|
||||||
|
platform,
|
||||||
|
resolver
|
||||||
|
).filter(
|
||||||
|
architecture =>
|
||||||
|
!options.architectures?.length ||
|
||||||
|
options.architectures.includes(architecture)
|
||||||
|
);
|
||||||
|
// Each distribution resolves sequentially so its shared metadata is
|
||||||
|
// fetched once and requests to a single vendor API are not bursty.
|
||||||
|
const cache = new Map<string, Promise<unknown>>();
|
||||||
|
const results: VersionResolution[] = [];
|
||||||
|
const startedAt = Date.now();
|
||||||
|
for (const versionSpec of options.versions) {
|
||||||
|
for (const architecture of architectures) {
|
||||||
|
const result = await resolveOne(
|
||||||
|
distribution,
|
||||||
|
versionSpec,
|
||||||
|
platform,
|
||||||
|
architecture,
|
||||||
|
cache,
|
||||||
|
http,
|
||||||
|
resolver
|
||||||
|
);
|
||||||
|
core.info(
|
||||||
|
`${distribution} ${versionSpec} (${formatPlatform(result)}): ${
|
||||||
|
result.status === 'resolved'
|
||||||
|
? `${result.version}${result.floating ? ' (floating)' : ''}`
|
||||||
|
: `${result.status} - ${result.message?.split('\n')[0]}`
|
||||||
|
}`
|
||||||
|
);
|
||||||
|
results.push(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
core.info(
|
||||||
|
`${distribution}: ${results.length} lookups in ${Math.round((Date.now() - startedAt) / 1000)}s`
|
||||||
|
);
|
||||||
|
return results;
|
||||||
|
});
|
||||||
|
|
||||||
|
const results = (await runWithConcurrency(tasks, CONCURRENCY)).flat();
|
||||||
|
return {
|
||||||
|
source: resolver.source,
|
||||||
|
platform,
|
||||||
|
generatedAt: new Date().toISOString(),
|
||||||
|
targets: Object.fromEntries(
|
||||||
|
options.distributions.map(distribution => [
|
||||||
|
distribution,
|
||||||
|
Object.fromEntries(
|
||||||
|
PLATFORM_ORDER.map(target => [
|
||||||
|
target,
|
||||||
|
getSupportedArchitectures(distribution, target, resolver)
|
||||||
|
]).filter(([, architectures]) => architectures.length > 0)
|
||||||
|
)
|
||||||
|
])
|
||||||
|
),
|
||||||
|
results
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatPlatform(
|
||||||
|
result: Pick<VersionResolution, 'platform' | 'architecture'>
|
||||||
|
): string {
|
||||||
|
return `${PLATFORM_LABELS[result.platform] ?? result.platform} ${result.architecture}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function comparePlatforms(
|
||||||
|
a: Pick<VersionResolution, 'platform' | 'architecture'>,
|
||||||
|
b: Pick<VersionResolution, 'platform' | 'architecture'>
|
||||||
|
): number {
|
||||||
|
const rank = (order: string[], value: string) => {
|
||||||
|
const index = order.indexOf(value);
|
||||||
|
return index === -1 ? order.length : index;
|
||||||
|
};
|
||||||
|
return (
|
||||||
|
rank(PLATFORM_ORDER, a.platform) - rank(PLATFORM_ORDER, b.platform) ||
|
||||||
|
a.platform.localeCompare(b.platform) ||
|
||||||
|
rank(ARCHITECTURE_ORDER, a.architecture) -
|
||||||
|
rank(ARCHITECTURE_ORDER, b.architecture) ||
|
||||||
|
a.architecture.localeCompare(b.architecture)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatCell(result: VersionResolution | undefined): string {
|
||||||
|
switch (result?.status) {
|
||||||
|
case undefined:
|
||||||
|
return '';
|
||||||
|
case 'resolved':
|
||||||
|
if (!result.floating) {
|
||||||
|
return `\`${result.version}\``;
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
`\`${result.advertisedVersion ?? result.version}\` ¹` +
|
||||||
|
(result.publishedAt ? ` (published ${result.publishedAt})` : '')
|
||||||
|
);
|
||||||
|
case 'unavailable':
|
||||||
|
return '—';
|
||||||
|
case 'unsupported':
|
||||||
|
return 'n/a';
|
||||||
|
case 'error':
|
||||||
|
return '❗ error';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Problem {
|
||||||
|
distribution: string;
|
||||||
|
versionSpec?: string;
|
||||||
|
platform?: string;
|
||||||
|
message: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getProblems(results: VersionResolution[]): Problem[] {
|
||||||
|
return [
|
||||||
|
...findSilentDistributions(results).map(distribution => ({
|
||||||
|
distribution,
|
||||||
|
message:
|
||||||
|
'No release matched any requested version on any platform. The vendor metadata may be unreachable or its format may have changed.'
|
||||||
|
})),
|
||||||
|
...results
|
||||||
|
.filter(r => r.status === 'error')
|
||||||
|
.map(r => ({
|
||||||
|
distribution: r.distribution,
|
||||||
|
versionSpec: r.versionSpec,
|
||||||
|
platform: formatPlatform(r),
|
||||||
|
message: r.message?.split('\n')[0] ?? 'Unknown error'
|
||||||
|
}))
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Supported operating systems for which no runner produced a report. */
|
||||||
|
function getUncheckedPlatforms(
|
||||||
|
distribution: string,
|
||||||
|
reportedPlatforms: Set<string>,
|
||||||
|
targets?: Record<string, Record<string, string[]>>
|
||||||
|
): string[] {
|
||||||
|
const platforms =
|
||||||
|
targets?.[distribution] ??
|
||||||
|
Object.fromEntries(
|
||||||
|
PLATFORM_ORDER.map(platform => [
|
||||||
|
platform,
|
||||||
|
getSupportedArchitectures(distribution, platform)
|
||||||
|
])
|
||||||
|
);
|
||||||
|
return Object.entries(platforms)
|
||||||
|
.filter(
|
||||||
|
([platform, architectures]) =>
|
||||||
|
architectures.length > 0 && !reportedPlatforms.has(platform)
|
||||||
|
)
|
||||||
|
.map(
|
||||||
|
([platform, architectures]) =>
|
||||||
|
`${PLATFORM_LABELS[platform] ?? platform} (${architectures.join(', ')})`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function escapeTableText(text: string): string {
|
||||||
|
return text.replace(/\|/g, '\\|').replace(/\r?\n/g, ' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderSourceReport(
|
||||||
|
reports: ResolutionReport[],
|
||||||
|
options: {runUrl?: string} = {}
|
||||||
|
): string {
|
||||||
|
const results = reports.flatMap(report => report.results);
|
||||||
|
const distributions = [...new Set(results.map(r => r.distribution))].sort();
|
||||||
|
const versionSpecs = [...new Set(results.map(r => r.versionSpec))];
|
||||||
|
const reportedPlatforms = new Set(reports.map(report => report.platform));
|
||||||
|
const generatedAt = reports
|
||||||
|
.map(report => report.generatedAt)
|
||||||
|
.sort()
|
||||||
|
.at(-1);
|
||||||
|
const silentDistributions = findSilentDistributions(results);
|
||||||
|
|
||||||
|
const lines: string[] = [`## setup-java@${reports[0].source.ref}`, ''];
|
||||||
|
lines.push(
|
||||||
|
`Generated ${generatedAt ? `${generatedAt.replace('T', ' ').slice(0, 16)} UTC` : 'now'} for package type \`${PACKAGE_TYPE}\` on ${PLATFORM_ORDER.filter(
|
||||||
|
p => reportedPlatforms.has(p)
|
||||||
|
)
|
||||||
|
.map(p => PLATFORM_LABELS[p])
|
||||||
|
.join(', ')}.` +
|
||||||
|
(options.runUrl ? ` [Workflow run](${options.runUrl}).` : ''),
|
||||||
|
'',
|
||||||
|
'For each distribution, the table lists platform/architecture probes and the exact version this revision resolves from the distribution’s metadata today for each `java-version`. That is what a job installs on a tool-cache miss or with `check-latest: true`. Vendors publish builds per platform, so the same request can resolve to different versions on different platforms. No JDK was downloaded to produce this report.',
|
||||||
|
'',
|
||||||
|
'`—` no matching release is published for this platform · `n/a` `setup-java` does not support this version on this platform · ❗ the lookup failed',
|
||||||
|
''
|
||||||
|
);
|
||||||
|
|
||||||
|
const problems = getProblems(results);
|
||||||
|
if (problems.length > 0) {
|
||||||
|
lines.push(
|
||||||
|
'## Needs attention',
|
||||||
|
'',
|
||||||
|
'| Distribution | Version | Platform | Problem |',
|
||||||
|
'| --- | --- | --- | --- |'
|
||||||
|
);
|
||||||
|
for (const problem of problems) {
|
||||||
|
lines.push(
|
||||||
|
`| \`${problem.distribution}\` | ${problem.versionSpec ? `\`${problem.versionSpec}\`` : 'all'} | ${problem.platform ?? 'all'} | ${escapeTableText(problem.message)} |`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
lines.push('');
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const distribution of distributions) {
|
||||||
|
const distributionResults = results.filter(
|
||||||
|
r => r.distribution === distribution
|
||||||
|
);
|
||||||
|
const platforms = distributionResults
|
||||||
|
.filter(
|
||||||
|
(result, index) =>
|
||||||
|
distributionResults.findIndex(
|
||||||
|
other =>
|
||||||
|
other.platform === result.platform &&
|
||||||
|
other.architecture === result.architecture
|
||||||
|
) === index
|
||||||
|
)
|
||||||
|
.sort(comparePlatforms);
|
||||||
|
|
||||||
|
lines.push(
|
||||||
|
`## \`${distribution}\`${silentDistributions.includes(distribution) ? ' ❗' : ''}`,
|
||||||
|
'',
|
||||||
|
`| Platform | ${versionSpecs.map(v => `\`${v}\``).join(' | ')} |`,
|
||||||
|
`| --- | ${versionSpecs.map(() => '---').join(' | ')} |`
|
||||||
|
);
|
||||||
|
for (const platform of platforms) {
|
||||||
|
const cells = versionSpecs.map(versionSpec =>
|
||||||
|
formatCell(
|
||||||
|
distributionResults.find(
|
||||||
|
r =>
|
||||||
|
r.versionSpec === versionSpec &&
|
||||||
|
r.platform === platform.platform &&
|
||||||
|
r.architecture === platform.architecture
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
lines.push(`| ${formatPlatform(platform)} | ${cells.join(' | ')} |`);
|
||||||
|
}
|
||||||
|
lines.push('');
|
||||||
|
|
||||||
|
const unchecked = getUncheckedPlatforms(
|
||||||
|
distribution,
|
||||||
|
reportedPlatforms,
|
||||||
|
reports[0]?.targets
|
||||||
|
);
|
||||||
|
if (unchecked.length > 0) {
|
||||||
|
lines.push(
|
||||||
|
`Not checked, because no runner reported these platforms: ${unchecked.join(', ')}.`,
|
||||||
|
''
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (results.some(r => r.status === 'resolved' && r.floating)) {
|
||||||
|
lines.push(
|
||||||
|
'---',
|
||||||
|
'',
|
||||||
|
'¹ Major-only requests download the vendor’s mutable `/latest/` artifact, so the exact version is only known after download. The version the vendor advertises is shown when available.',
|
||||||
|
''
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return lines.join('\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function renderMarkdownReport(
|
||||||
|
reports: ResolutionReport[],
|
||||||
|
options: {
|
||||||
|
runUrl?: string;
|
||||||
|
expectedRefs?: string[];
|
||||||
|
overviewOnly?: boolean;
|
||||||
|
} = {}
|
||||||
|
): string {
|
||||||
|
const refs = [
|
||||||
|
...new Set([
|
||||||
|
...(options.expectedRefs ?? []),
|
||||||
|
...reports.map(report => report.source.ref)
|
||||||
|
])
|
||||||
|
];
|
||||||
|
const lines = [
|
||||||
|
'# Latest JDK versions by setup-java revision',
|
||||||
|
'',
|
||||||
|
"Each section uses that revision's own installers and dependencies. `v6` and `v5` track the latest major tags, pinned to the commits below for this run. No JDKs are downloaded.",
|
||||||
|
'',
|
||||||
|
"Older revisions may support different distributions, platforms or version syntax. In particular, `latest` is reported as `n/a` when that revision rejects it; it is not substituted with main's behavior. Revisions without capability maps probe all candidate architectures, leaving unsupported or unpublished combinations visible.",
|
||||||
|
'',
|
||||||
|
'| setup-java | Package version | Commit | Result |',
|
||||||
|
'| --- | --- | --- | --- |'
|
||||||
|
];
|
||||||
|
for (const ref of refs) {
|
||||||
|
const group = reports.filter(report => report.source.ref === ref);
|
||||||
|
if (!group.length) {
|
||||||
|
lines.push(`| \`${ref}\` | - | - | Not checked: no reports received |`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const source = group[0].source;
|
||||||
|
if (
|
||||||
|
group.some(
|
||||||
|
report =>
|
||||||
|
report.source.sha !== source.sha ||
|
||||||
|
report.source.version !== source.version
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
throw new Error(
|
||||||
|
`Reports for '${ref}' were produced from different revisions.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
const problems = getProblems(group.flatMap(report => report.results));
|
||||||
|
const platforms = new Set(group.map(report => report.platform));
|
||||||
|
const missing = PLATFORM_ORDER.filter(platform => !platforms.has(platform));
|
||||||
|
lines.push(
|
||||||
|
`| \`${ref}\` | ${source.version ?? 'local'} | ${source.sha ? `[\`${source.sha.slice(0, 12)}\`](https://github.com/actions/setup-java/commit/${source.sha})` : 'local checkout'} | ${platforms.size}/${PLATFORM_ORDER.length} platforms${missing.length ? `; not checked: ${missing.map(platform => PLATFORM_LABELS[platform]).join(', ')}` : ''}${problems.length ? `; ${problems.length} lookup problems` : ''} |`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (options.overviewOnly) {
|
||||||
|
return lines.join('\n');
|
||||||
|
}
|
||||||
|
for (const ref of refs) {
|
||||||
|
const group = reports.filter(report => report.source.ref === ref);
|
||||||
|
if (!group.length) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
lines.push(
|
||||||
|
'',
|
||||||
|
'<details>',
|
||||||
|
`<summary>setup-java@${ref}</summary>`,
|
||||||
|
'',
|
||||||
|
renderSourceReport(group, options),
|
||||||
|
'</details>',
|
||||||
|
''
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return lines.join('\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseList(value: string | undefined, fallback: string[]): string[] {
|
||||||
|
const items = (value ?? '')
|
||||||
|
.split(/[,\s]+/)
|
||||||
|
.map(item => item.trim())
|
||||||
|
.filter(Boolean);
|
||||||
|
return items.length > 0 ? items : fallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
function readReports(inputDir: string): ResolutionReport[] {
|
||||||
|
return fs
|
||||||
|
.readdirSync(inputDir, {recursive: true, encoding: 'utf8'})
|
||||||
|
.filter(file => file.endsWith('.json'))
|
||||||
|
.sort()
|
||||||
|
.map(
|
||||||
|
file =>
|
||||||
|
JSON.parse(
|
||||||
|
fs.readFileSync(path.join(inputDir, file), 'utf8')
|
||||||
|
) as ResolutionReport
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function run(args: string[]): Promise<void> {
|
||||||
|
const [command, target, markdownOutput] = args;
|
||||||
|
if (command === 'resolve' && target) {
|
||||||
|
const resolver = process.env.REPORT_RESOLVER
|
||||||
|
? await loadMetadataResolver(process.env.REPORT_RESOLVER)
|
||||||
|
: currentResolver;
|
||||||
|
const versions = parseList(process.env.REPORT_VERSIONS, []);
|
||||||
|
const report = await resolveLatestVersions({
|
||||||
|
distributions: parseList(
|
||||||
|
process.env.REPORT_DISTRIBUTIONS,
|
||||||
|
resolver.distributions
|
||||||
|
),
|
||||||
|
versions:
|
||||||
|
versions.length > 0
|
||||||
|
? versions
|
||||||
|
: await getDefaultVersions(
|
||||||
|
new RetryingHttpClient('actions/setup-java')
|
||||||
|
),
|
||||||
|
architectures: parseList(process.env.REPORT_ARCHITECTURES, []),
|
||||||
|
platform: process.env.REPORT_PLATFORM,
|
||||||
|
resolver
|
||||||
|
});
|
||||||
|
fs.mkdirSync(path.dirname(path.resolve(target)), {recursive: true});
|
||||||
|
fs.writeFileSync(target, JSON.stringify(report, null, 2));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (command === 'summarize' && target) {
|
||||||
|
const expectedRefs = parseList(process.env.REPORT_REFS, []);
|
||||||
|
const reports = fs.existsSync(target) ? readReports(target) : [];
|
||||||
|
if (reports.length === 0 && expectedRefs.length === 0) {
|
||||||
|
throw new Error(`No resolution reports found in '${target}'.`);
|
||||||
|
}
|
||||||
|
const {GITHUB_SERVER_URL, GITHUB_REPOSITORY, GITHUB_RUN_ID} = process.env;
|
||||||
|
const runUrl =
|
||||||
|
GITHUB_SERVER_URL && GITHUB_REPOSITORY && GITHUB_RUN_ID
|
||||||
|
? `${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}`
|
||||||
|
: undefined;
|
||||||
|
const markdown = renderMarkdownReport(reports, {
|
||||||
|
runUrl,
|
||||||
|
expectedRefs
|
||||||
|
});
|
||||||
|
if (markdownOutput) {
|
||||||
|
fs.writeFileSync(markdownOutput, markdown);
|
||||||
|
}
|
||||||
|
if (process.env.GITHUB_STEP_SUMMARY) {
|
||||||
|
// GitHub limits a step summary to 1 MiB. Keep the complete report in the
|
||||||
|
// artifact even when many legacy lookup errors make it too large.
|
||||||
|
if (Buffer.byteLength(markdown, 'utf8') > 1_000_000) {
|
||||||
|
core.warning(
|
||||||
|
'The full report exceeds the job summary size limit; showing its overview.'
|
||||||
|
);
|
||||||
|
const overview = renderMarkdownReport(reports, {
|
||||||
|
runUrl,
|
||||||
|
expectedRefs,
|
||||||
|
overviewOnly: true
|
||||||
|
});
|
||||||
|
await core.summary
|
||||||
|
.addRaw(
|
||||||
|
`${overview}\n\nFull per-platform tables are in the \`latest-jdk-versions-report\` artifact${runUrl ? ` on the [workflow run](${runUrl})` : ''}. The full report exceeded GitHub's summary size limit.\n`
|
||||||
|
)
|
||||||
|
.write();
|
||||||
|
} else {
|
||||||
|
await core.summary.addRaw(markdown).write();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
core.info(markdown);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const ref of expectedRefs) {
|
||||||
|
if (!reports.some(report => report.source.ref === ref)) {
|
||||||
|
core.warning(
|
||||||
|
`${ref}: not checked because no resolution reports were received.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const ref of new Set(reports.map(report => report.source.ref))) {
|
||||||
|
for (const problem of getProblems(
|
||||||
|
reports
|
||||||
|
.filter(report => report.source.ref === ref)
|
||||||
|
.flatMap(report => report.results)
|
||||||
|
)) {
|
||||||
|
const scope = [problem.versionSpec, problem.platform]
|
||||||
|
.filter(Boolean)
|
||||||
|
.join(', ');
|
||||||
|
core.warning(
|
||||||
|
`${ref}: ${problem.distribution}${scope ? ` (${scope})` : ''}: ${problem.message}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Error(
|
||||||
|
'Usage: resolve <output.json> | summarize <input-dir> [output.md]'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isMainModule(import.meta.url)) {
|
||||||
|
run(process.argv.slice(2)).catch(error => {
|
||||||
|
core.setFailed(error instanceof Error ? error.message : String(error));
|
||||||
|
});
|
||||||
|
}
|
||||||
125
src/reports/resolver.ts
Normal file
125
src/reports/resolver.ts
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
import {pathToFileURL} from 'url';
|
||||||
|
import path from 'path';
|
||||||
|
import {getJavaDistribution} from '../distributions/distribution-factory.js';
|
||||||
|
import type {JavaInstallerOptions} from '../distributions/base-models.js';
|
||||||
|
import {LibericaDistributions} from '../distributions/liberica/installer.js';
|
||||||
|
import {JavaDistribution} from '../distributions/package-types.js';
|
||||||
|
import {
|
||||||
|
JAVA_PLATFORM_CAPABILITIES,
|
||||||
|
type JavaPlatformCapability
|
||||||
|
} from '../distributions/platform-types.js';
|
||||||
|
|
||||||
|
export interface ActionSource {
|
||||||
|
ref: string;
|
||||||
|
sha?: string;
|
||||||
|
version?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MetadataResolver {
|
||||||
|
source: ActionSource;
|
||||||
|
distributions: string[];
|
||||||
|
capabilities?: Record<string, JavaPlatformCapability>;
|
||||||
|
getJavaDistribution(
|
||||||
|
distribution: string,
|
||||||
|
options: JavaInstallerOptions
|
||||||
|
): unknown;
|
||||||
|
createSolarisInstaller(options: JavaInstallerOptions): unknown;
|
||||||
|
}
|
||||||
|
|
||||||
|
class SolarisLibericaDistribution extends LibericaDistributions {
|
||||||
|
protected override getPlatformOption() {
|
||||||
|
return super.getPlatformOption('sunos');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const currentResolver: MetadataResolver = {
|
||||||
|
source: {ref: 'main'},
|
||||||
|
distributions: Object.values(JavaDistribution).filter(
|
||||||
|
distribution => distribution !== JavaDistribution.JdkFile
|
||||||
|
),
|
||||||
|
capabilities: JAVA_PLATFORM_CAPABILITIES,
|
||||||
|
getJavaDistribution,
|
||||||
|
createSolarisInstaller: options => new SolarisLibericaDistribution(options)
|
||||||
|
};
|
||||||
|
|
||||||
|
const LEGACY_ARCHITECTURES = [
|
||||||
|
'x64',
|
||||||
|
'aarch64',
|
||||||
|
'x86',
|
||||||
|
'armv7',
|
||||||
|
'ppc64le',
|
||||||
|
'ppc64',
|
||||||
|
'riscv64',
|
||||||
|
's390x'
|
||||||
|
];
|
||||||
|
|
||||||
|
export function getResolverArchitectures(
|
||||||
|
resolver: MetadataResolver,
|
||||||
|
distribution: string,
|
||||||
|
platform: string
|
||||||
|
): string[] {
|
||||||
|
if (!resolver.distributions.includes(distribution)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
// v5 has no centralized capability map. Probe candidates with its own
|
||||||
|
// installer instead of imposing main's newer support restrictions on it.
|
||||||
|
if (!resolver.capabilities) {
|
||||||
|
if (platform === 'solaris' && distribution !== 'liberica') {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
return [...LEGACY_ARCHITECTURES];
|
||||||
|
}
|
||||||
|
const capability = resolver.capabilities[distribution];
|
||||||
|
if (!capability || capability.unrestricted) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
const os = platform === 'linux-musl' ? 'linux' : platform;
|
||||||
|
const architectures = Object.entries(capability.platforms).find(
|
||||||
|
([name]) => name === os
|
||||||
|
)?.[1];
|
||||||
|
return [
|
||||||
|
...new Set(
|
||||||
|
(architectures ?? []).map(item =>
|
||||||
|
typeof item === 'string' ? item : item.architecture
|
||||||
|
)
|
||||||
|
)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Load the separately bundled checkout, including that revision's dependencies. */
|
||||||
|
export async function loadMetadataResolver(
|
||||||
|
directory: string
|
||||||
|
): Promise<MetadataResolver> {
|
||||||
|
const module: unknown = await import(
|
||||||
|
/* webpackIgnore: true */ pathToFileURL(
|
||||||
|
path.join(path.resolve(directory), 'index.js')
|
||||||
|
).href
|
||||||
|
);
|
||||||
|
// NCC emits ESM for v6/main and CommonJS for v5.
|
||||||
|
const candidate =
|
||||||
|
isRecord(module) && isRecord(module.default) ? module.default : module;
|
||||||
|
if (!isMetadataResolver(candidate)) {
|
||||||
|
throw new Error(`Invalid metadata resolver bundle in '${directory}'.`);
|
||||||
|
}
|
||||||
|
return candidate;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isMetadataResolver(value: unknown): value is MetadataResolver {
|
||||||
|
return (
|
||||||
|
isRecord(value) &&
|
||||||
|
isRecord(value.source) &&
|
||||||
|
typeof value.source.ref === 'string' &&
|
||||||
|
typeof value.source.sha === 'string' &&
|
||||||
|
/^[a-f0-9]{40}$/.test(value.source.sha) &&
|
||||||
|
typeof value.source.version === 'string' &&
|
||||||
|
Array.isArray(value.distributions) &&
|
||||||
|
value.distributions.every(item => typeof item === 'string') &&
|
||||||
|
(value.capabilities === undefined || isRecord(value.capabilities)) &&
|
||||||
|
typeof value.getJavaDistribution === 'function' &&
|
||||||
|
typeof value.createSolarisInstaller === 'function'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function isRecord(value: unknown): value is Record<string, unknown> {
|
||||||
|
return typeof value === 'object' && value !== null;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user