mirror of
https://github.com/actions/setup-java.git
synced 2026-11-28 07:13:04 +00:00
Compare commits
5 Commits
71cfe8e0ed
...
3c85b14378
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3c85b14378 | ||
|
|
80c368b720 | ||
|
|
cd57b95697 | ||
|
|
7a475d86d1 | ||
|
|
92f9362dd0 |
35
.github/workflows/e2e-versions.yml
vendored
35
.github/workflows/e2e-versions.yml
vendored
@@ -37,7 +37,8 @@ jobs:
|
||||
'dragonwell',
|
||||
'sapmachine',
|
||||
'jetbrains',
|
||||
'kona'
|
||||
'kona',
|
||||
'liberica-nik'
|
||||
] # internally 'adopt-hotspot' is the same as 'adopt'
|
||||
version: ['21', '11', '17']
|
||||
exclude:
|
||||
@@ -64,6 +65,15 @@ jobs:
|
||||
- distribution: kona
|
||||
os: macos-latest
|
||||
version: 25
|
||||
- distribution: liberica-nik
|
||||
os: windows-latest
|
||||
version: 25
|
||||
- distribution: liberica-nik
|
||||
os: ubuntu-latest
|
||||
version: 25
|
||||
- distribution: liberica-nik
|
||||
os: macos-latest
|
||||
version: 25
|
||||
- distribution: oracle
|
||||
os: macos-15-intel
|
||||
version: 17
|
||||
@@ -450,6 +460,10 @@ jobs:
|
||||
java-package: jre+fx
|
||||
version: '11'
|
||||
os: ubuntu-latest
|
||||
- distribution: 'liberica-nik'
|
||||
java-package: jdk+fx
|
||||
version: '21'
|
||||
os: ubuntu-latest
|
||||
- distribution: 'corretto'
|
||||
java-package: jre
|
||||
version: '8'
|
||||
@@ -690,6 +704,8 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Setup Java 17 as default
|
||||
uses: ./
|
||||
id: setup-java-17
|
||||
@@ -708,10 +724,12 @@ jobs:
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Verify JAVA_HOME still points to Java 17
|
||||
env:
|
||||
JAVA_17_PATH: ${{ steps.setup-java-17.outputs.path }}
|
||||
run: |
|
||||
echo "JAVA_HOME=$JAVA_HOME"
|
||||
echo "Java 17 path=${{ steps.setup-java-17.outputs.path }}"
|
||||
if [ "$JAVA_HOME" != "${{ steps.setup-java-17.outputs.path }}" ]; then
|
||||
echo "Java 17 path=$JAVA_17_PATH"
|
||||
if [ "$JAVA_HOME" != "$JAVA_17_PATH" ]; then
|
||||
echo "JAVA_HOME should still point to Java 17"
|
||||
exit 1
|
||||
fi
|
||||
@@ -740,14 +758,17 @@ jobs:
|
||||
Write-Host "$envName=$JavaVersionPath"
|
||||
shell: pwsh
|
||||
- name: Verify Java 21 outputs are set
|
||||
env:
|
||||
JAVA_21_PATH: ${{ steps.setup-java-21.outputs.path }}
|
||||
JAVA_21_VERSION: ${{ steps.setup-java-21.outputs.version }}
|
||||
run: |
|
||||
echo "Java 21 path=${{ steps.setup-java-21.outputs.path }}"
|
||||
echo "Java 21 version=${{ steps.setup-java-21.outputs.version }}"
|
||||
if [ -z "${{ steps.setup-java-21.outputs.path }}" ]; then
|
||||
echo "Java 21 path=$JAVA_21_PATH"
|
||||
echo "Java 21 version=$JAVA_21_VERSION"
|
||||
if [ -z "$JAVA_21_PATH" ]; then
|
||||
echo "Java 21 path output should be set"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${{ steps.setup-java-21.outputs.version }}" ]; then
|
||||
if [ -z "$JAVA_21_VERSION" ]; then
|
||||
echo "Java 21 version output should be set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -124,6 +124,7 @@ Currently, the following distributions are supported:
|
||||
| `adopt` or `adopt-hotspot` | [AdoptOpenJDK Hotspot](https://adoptopenjdk.net/) | [`adopt-hotspot` license](https://adoptopenjdk.net/about.html) |
|
||||
| `adopt-openj9` | [AdoptOpenJDK OpenJ9](https://adoptopenjdk.net/) | [`adopt-openj9` license](https://adoptopenjdk.net/about.html) |
|
||||
| `liberica` | [Liberica JDK](https://bell-sw.com/) | [`liberica` license](https://bell-sw.com/liberica_eula/) |
|
||||
| `liberica-nik` | [Liberica Native Image Kit](https://bell-sw.com/pages/downloads/native-image-kit/) | [`liberica-nik` license](https://bell-sw.com/liberica_nik_eula/) |
|
||||
| `microsoft` | [Microsoft Build of OpenJDK](https://www.microsoft.com/openjdk) | [`microsoft` license](https://docs.microsoft.com/java/openjdk/faq)
|
||||
| `corretto` | [Amazon Corretto Build of OpenJDK](https://aws.amazon.com/corretto/) | [`corretto` license](https://aws.amazon.com/corretto/faqs/)
|
||||
| `semeru` | [IBM Semeru Runtime Open Edition](https://developer.ibm.com/languages/java/semeru-runtimes/downloads/) | [`semeru` license](https://openjdk.java.net/legal/gplv2+ce.html) |
|
||||
@@ -301,6 +302,7 @@ In the example above multiple JDKs are installed for the same job. The result af
|
||||
- [Adopt](docs/advanced-usage.md#Adopt)
|
||||
- [Zulu](docs/advanced-usage.md#Zulu)
|
||||
- [Liberica](docs/advanced-usage.md#Liberica)
|
||||
- [Liberica Native Image Kit](docs/advanced-usage.md#Liberica-Native-Image-Kit)
|
||||
- [Microsoft](docs/advanced-usage.md#Microsoft)
|
||||
- [Amazon Corretto](docs/advanced-usage.md#Amazon-Corretto)
|
||||
- [Oracle](docs/advanced-usage.md#Oracle)
|
||||
|
||||
739
__tests__/data/liberica-nik.json
Normal file
739
__tests__/data/liberica-nik.json
Normal file
@@ -0,0 +1,739 @@
|
||||
[
|
||||
{
|
||||
"downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/25.0.1+3-25.0.1+16/bellsoft-liberica-vm-openjdk25.0.1+16-25.0.1+3-linux-amd64.tar.gz",
|
||||
"version": "25.0.1+3",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "25.0.1+16",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/24.1.0+1-23+38/bellsoft-liberica-vm-openjdk23+38-24.1.0+1-linux-amd64.tar.gz",
|
||||
"version": "24.1.0+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "23+38",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://download.bell-sw.com/vm/21.3.2/bellsoft-liberica-vm-openjdk11.0.15.1+2-21.3.2+2-linux-amd64.tar.gz",
|
||||
"version": "21.3.2+2",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "11.0.15.1+2",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://download.bell-sw.com/vm/22.3.0/bellsoft-liberica-vm-openjdk17.0.5+8-22.3.0+2-linux-amd64.tar.gz",
|
||||
"version": "22.3.0+2",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "17.0.5+8",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.0.9+1-17.0.16+13/bellsoft-liberica-vm-openjdk17.0.16+13-23.0.9+1-linux-amd64.tar.gz",
|
||||
"version": "23.0.9+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "17.0.16+13",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://download.bell-sw.com/vm/23.0.0/bellsoft-liberica-vm-openjdk17.0.7+7-23.0.0+1-src.tar.gz",
|
||||
"version": "23.0.0+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "17.0.7+7",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/25.0.2+1-25.0.2+13/bellsoft-liberica-vm-openjdk25.0.2+13-25.0.2+1-linux-amd64.tar.gz",
|
||||
"version": "25.0.2+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "25.0.2+13",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/24.1.1+1-23.0.1+13/bellsoft-liberica-vm-openjdk23.0.1+13-24.1.1+1-linux-amd64.tar.gz",
|
||||
"version": "24.1.1+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "23.0.1+13",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.0.12+1-17.0.19+12/bellsoft-liberica-vm-openjdk17.0.19+12-23.0.12+1-linux-amd64.tar.gz",
|
||||
"version": "23.0.12+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "17.0.19+12",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.0.3+1-17.0.10+13/bellsoft-liberica-vm-openjdk17.0.10+13-23.0.3+1-linux-amd64.tar.gz",
|
||||
"version": "23.0.3+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "17.0.10+13",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://download.bell-sw.com/vm/21.3.2/bellsoft-liberica-vm-openjdk11-21.3.2-src.tar.gz",
|
||||
"version": "21.3.2+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "11.0.15+10",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://download.bell-sw.com/vm/22.3.3/bellsoft-liberica-vm-openjdk11.0.20+8-22.3.3+1-src.tar.gz",
|
||||
"version": "22.3.3+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "11.0.20+8",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.0.8+1-17.0.15+10/bellsoft-liberica-vm-openjdk17.0.15+10-23.0.8+1-linux-amd64.tar.gz",
|
||||
"version": "23.0.8+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "17.0.15+10",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://download.bell-sw.com/vm/21.3.3/bellsoft-liberica-vm-openjdk17.0.4-21.3.3-src.tar.gz",
|
||||
"version": "21.3.3+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "17.0.4+8",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.1.7+1-21.0.7+9/bellsoft-liberica-vm-openjdk21.0.7+9-23.1.7+1-linux-amd64.tar.gz",
|
||||
"version": "23.1.7+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "21.0.7+9",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.1.8+1-21.0.8+13/bellsoft-liberica-vm-openjdk21.0.8+13-23.1.8+1-linux-amd64.tar.gz",
|
||||
"version": "23.1.8+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "21.0.8+13",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://download.bell-sw.com/vm/21.0.0.2/bellsoft-liberica-vm-openjdk11-21.0.0.2-src.tar.gz",
|
||||
"version": "21.0.0.2",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "11.0.10+9",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://download.bell-sw.com/vm/23.0.1/bellsoft-liberica-vm-openjdk17.0.8+7-23.0.1+1-linux-amd64.tar.gz",
|
||||
"version": "23.0.1+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "17.0.8+7",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/24.0.0+1-22+37/bellsoft-liberica-vm-openjdk22+37-24.0.0+1-linux-amd64.tar.gz",
|
||||
"version": "24.0.0+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "22+37",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://download.bell-sw.com/vm/22.1.0/bellsoft-liberica-vm-openjdk17-22.1.0-src.tar.gz",
|
||||
"version": "22.1.0+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "17.0.3+7",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/24.0.2+1-22.0.2+11/bellsoft-liberica-vm-openjdk22.0.2+11-24.0.2+1-linux-amd64.tar.gz",
|
||||
"version": "24.0.2+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "22.0.2+11",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://download.bell-sw.com/vm/23.0.1/bellsoft-liberica-vm-openjdk20.0.2+10-23.0.1+1-src.tar.gz",
|
||||
"version": "23.0.1+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "20.0.2+10",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://download.bell-sw.com/vm/23.1.0/bellsoft-liberica-vm-openjdk21+37-23.1.0+1-linux-amd64.tar.gz",
|
||||
"version": "23.1.0+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "21+37",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.1.4+3-21.0.4+9/bellsoft-liberica-vm-openjdk21.0.4+9-23.1.4+3-linux-amd64.tar.gz",
|
||||
"version": "23.1.4+3",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "21.0.4+9",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://download.bell-sw.com/vm/22.3.3/bellsoft-liberica-vm-openjdk11.0.20.1+1-22.3.3+2-linux-amd64.tar.gz",
|
||||
"version": "22.3.3+2",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "11.0.20.1+1",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.0.4+1-17.0.11+10/bellsoft-liberica-vm-openjdk17.0.11+10-23.0.4+1-linux-amd64.tar.gz",
|
||||
"version": "23.0.4+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "17.0.11+10",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/24.1.2+1-23.0.2+9/bellsoft-liberica-vm-openjdk23.0.2+9-24.1.2+1-linux-amd64.tar.gz",
|
||||
"version": "24.1.2+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "23.0.2+9",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.0.10+1-17.0.17+12/bellsoft-liberica-vm-openjdk17.0.17+12-23.0.10+1-linux-amd64.tar.gz",
|
||||
"version": "23.0.10+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "17.0.17+12",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://download.bell-sw.com/vm/22.3.1/bellsoft-liberica-vm-openjdk11.0.18+10-22.3.1+1-src.tar.gz",
|
||||
"version": "22.3.1+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "11.0.18+10",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://download.bell-sw.com/vm/22.0.0.2/bellsoft-liberica-vm-openjdk17-22.0.0.2-src.tar.gz",
|
||||
"version": "22.0.0.2",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "17.0.2+9",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://download.bell-sw.com/vm/22.0.0.2/bellsoft-liberica-vm-openjdk11-22.0.0.2-linux-amd64.tar.gz",
|
||||
"version": "22.0.0.2",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "11.0.14.1+1",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/25.0.1+2-25.0.1+14/bellsoft-liberica-vm-openjdk25.0.1+14-25.0.1+2-linux-amd64.tar.gz",
|
||||
"version": "25.0.1+2",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "25.0.1+14",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://download.bell-sw.com/vm/21.3.3/bellsoft-liberica-vm-openjdk11.0.16-21.3.3-src.tar.gz",
|
||||
"version": "21.3.3+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "11.0.16+8",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.1.5+1-21.0.5+11/bellsoft-liberica-vm-openjdk21.0.5+11-23.1.5+1-linux-amd64.tar.gz",
|
||||
"version": "23.1.5+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "21.0.5+11",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://download.bell-sw.com/vm/22.3.4/bellsoft-liberica-vm-openjdk17.0.9+11-22.3.4+1-linux-amd64.tar.gz",
|
||||
"version": "22.3.4+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "17.0.9+11",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/25.0.0+1-25+37/bellsoft-liberica-vm-openjdk25+37-25.0.0+1-linux-amd64.tar.gz",
|
||||
"version": "25.0.0+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "25+37",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://download.bell-sw.com/vm/22.3.3/bellsoft-liberica-vm-openjdk17.0.8.1+1-22.3.3+2-linux-amd64.tar.gz",
|
||||
"version": "22.3.3+2",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "17.0.8.1+1",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.1.3+1-21.0.3+10/bellsoft-liberica-vm-openjdk21.0.3+10-23.1.3+1-linux-amd64.tar.gz",
|
||||
"version": "23.1.3+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "21.0.3+10",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/24.2.0+1-24+37/bellsoft-liberica-vm-openjdk24+37-24.2.0+1-linux-amd64.tar.gz",
|
||||
"version": "24.2.0+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "24+37",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://download.bell-sw.com/vm/23.1.1/bellsoft-liberica-vm-openjdk21.0.1+12-23.1.1+1-linux-amd64.tar.gz",
|
||||
"version": "23.1.1+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "21.0.1+12",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://download.bell-sw.com/vm/21.3.3/bellsoft-liberica-vm-openjdk17.0.4.1-21.3.3-src.tar.gz",
|
||||
"version": "21.3.3+2",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "17.0.4.1+1",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.1.11+2-21.0.11+12/bellsoft-liberica-vm-openjdk21.0.11+12-23.1.11+2-linux-amd64.tar.gz",
|
||||
"version": "23.1.11+2",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "21.0.11+12",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://download.bell-sw.com/vm/22.3.2/bellsoft-liberica-vm-openjdk11.0.19+7-22.3.2+1-src.tar.gz",
|
||||
"version": "22.3.2+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "11.0.19+7",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://download.bell-sw.com/vm/22.3.4/bellsoft-liberica-vm-openjdk11.0.21+10-22.3.4+1-src.tar.gz",
|
||||
"version": "22.3.4+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "11.0.21+10",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/25.0.3+2-25.0.3+12/bellsoft-liberica-vm-openjdk25.0.3+12-25.0.3+2-linux-amd64.tar.gz",
|
||||
"version": "25.0.3+2",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "25.0.3+12",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://download.bell-sw.com/vm/21.3.2/bellsoft-liberica-vm-openjdk17.0.3.1+2-21.3.2+2-linux-amd64.tar.gz",
|
||||
"version": "21.3.2+2",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "17.0.3.1+2",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/24.2.1+1-24.0.1+11/bellsoft-liberica-vm-openjdk24.0.1+11-24.2.1+1-linux-amd64.tar.gz",
|
||||
"version": "24.2.1+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "24.0.1+11",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://download.bell-sw.com/vm/22.2.0/bellsoft-liberica-vm-openjdk11.0.16.1+1-22.2.0+3-linux-amd64.tar.gz",
|
||||
"version": "22.2.0+3",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "11.0.16.1+1",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.0.6+1-17.0.13+12/bellsoft-liberica-vm-openjdk17.0.13+12-23.0.6+1-linux-amd64.tar.gz",
|
||||
"version": "23.0.6+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "17.0.13+12",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://download.bell-sw.com/vm/23.0.0/bellsoft-liberica-vm-openjdk20.0.1+10-23.0.0+1-linux-amd64.tar.gz",
|
||||
"version": "23.0.0+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "20.0.1+10",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.1.10+1-21.0.10+11/bellsoft-liberica-vm-openjdk21.0.10+11-23.1.10+1-linux-amd64.tar.gz",
|
||||
"version": "23.1.10+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "21.0.10+11",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://download.bell-sw.com/vm/22.3.1/bellsoft-liberica-vm-openjdk17.0.6+10-22.3.1+1-src.tar.gz",
|
||||
"version": "22.3.1+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "17.0.6+10",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://download.bell-sw.com/vm/21.3.0/bellsoft-liberica-vm-openjdk17-21.3.0-src.tar.gz",
|
||||
"version": "21.3.0",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "17.0.1+12",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://download.bell-sw.com/vm/21.3.0/bellsoft-liberica-vm-openjdk11-21.3.0-src.tar.gz",
|
||||
"version": "21.3.0",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "11.0.13+8",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/24.0.1+1-22.0.1+10/bellsoft-liberica-vm-openjdk22.0.1+10-24.0.1+1-linux-amd64.tar.gz",
|
||||
"version": "24.0.1+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "22.0.1+10",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.0.7+1-17.0.14+10/bellsoft-liberica-vm-openjdk17.0.14+10-23.0.7+1-linux-amd64.tar.gz",
|
||||
"version": "23.0.7+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "17.0.14+10",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://download.bell-sw.com/vm/21.1.0/bellsoft-liberica-vm-openjdk11-21.1.0-src.tar.gz",
|
||||
"version": "21.1.0",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "11.0.11+9",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.1.6+1-21.0.6+10/bellsoft-liberica-vm-openjdk21.0.6+10-23.1.6+1-linux-amd64.tar.gz",
|
||||
"version": "23.1.6+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "21.0.6+10",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/25.0.1+1-25.0.1+12/bellsoft-liberica-vm-openjdk25.0.1+12-25.0.1+1-linux-amd64.tar.gz",
|
||||
"version": "25.0.1+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "25.0.1+12",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.1.9+1-21.0.9+12/bellsoft-liberica-vm-openjdk21.0.9+12-23.1.9+1-linux-amd64.tar.gz",
|
||||
"version": "23.1.9+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "21.0.9+12",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/22.3.5+1-11.0.22+12/bellsoft-liberica-vm-openjdk11.0.22+12-22.3.5+1-linux-amd64.tar.gz",
|
||||
"version": "22.3.5+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "11.0.22+12",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.0.5+1-17.0.12+10/bellsoft-liberica-vm-openjdk17.0.12+10-23.0.5+1-linux-amd64.tar.gz",
|
||||
"version": "23.0.5+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "17.0.12+10",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://download.bell-sw.com/vm/21.3.3.1/bellsoft-liberica-vm-openjdk11.0.17+7-21.3.3.1+1-linux-amd64.tar.gz",
|
||||
"version": "21.3.3.1+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "11.0.17+7",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://download.bell-sw.com/vm/21.2.0/bellsoft-liberica-vm-openjdk11-21.2.0-linux-amd64.tar.gz",
|
||||
"version": "21.2.0",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "11.0.12+7",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.0.11+1-17.0.18+11/bellsoft-liberica-vm-openjdk17.0.18+11-23.0.11+1-linux-amd64.tar.gz",
|
||||
"version": "23.0.11+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "17.0.18+11",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.1.2+1-21.0.2+14/bellsoft-liberica-vm-openjdk21.0.2+14-23.1.2+1-linux-amd64.tar.gz",
|
||||
"version": "23.1.2+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "21.0.2+14",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/24.2.2+1-24.0.2+13/bellsoft-liberica-vm-openjdk24.0.2+13-24.2.2+1-linux-amd64.tar.gz",
|
||||
"version": "24.2.2+1",
|
||||
"components": [
|
||||
{
|
||||
"component": "liberica",
|
||||
"version": "24.0.2+13",
|
||||
"embedded": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
219
__tests__/distributors/liberica-nik-installer.test.ts
Normal file
219
__tests__/distributors/liberica-nik-installer.test.ts
Normal file
@@ -0,0 +1,219 @@
|
||||
import {jest, describe, it, expect, beforeEach, afterEach} from '@jest/globals';
|
||||
import type {
|
||||
ArchitectureOptions,
|
||||
NikVersion
|
||||
} from '../../src/distributions/liberica-nik/models.js';
|
||||
import {HttpClient} from '@actions/http-client';
|
||||
|
||||
import manifestData from '../data/liberica-nik.json' with {type: 'json'};
|
||||
|
||||
// Mock @actions/core before importing source modules that depend on it
|
||||
jest.unstable_mockModule('@actions/core', () => ({
|
||||
info: jest.fn(),
|
||||
warning: jest.fn(),
|
||||
debug: jest.fn(),
|
||||
error: jest.fn(),
|
||||
notice: jest.fn(),
|
||||
setFailed: jest.fn(),
|
||||
setOutput: jest.fn(),
|
||||
getInput: jest.fn(),
|
||||
getBooleanInput: jest.fn(),
|
||||
getMultilineInput: jest.fn(),
|
||||
addPath: jest.fn(),
|
||||
exportVariable: jest.fn(),
|
||||
saveState: jest.fn(),
|
||||
getState: jest.fn(),
|
||||
setSecret: jest.fn(),
|
||||
isDebug: jest.fn(() => false),
|
||||
startGroup: jest.fn(),
|
||||
endGroup: jest.fn(),
|
||||
group: jest.fn((_name: string, fn: () => Promise<unknown>) => fn()),
|
||||
toPlatformPath: jest.fn((p: string) => p),
|
||||
toWin32Path: jest.fn((p: string) => p),
|
||||
toPosixPath: jest.fn((p: string) => p)
|
||||
}));
|
||||
|
||||
// Dynamic imports after mocking
|
||||
const {LibericaNikDistributions} =
|
||||
await import('../../src/distributions/liberica-nik/installer.js');
|
||||
|
||||
const ADDITIONAL_PARAMS =
|
||||
'&installation-type=archive&fields=downloadUrl%2Cversion%2Ccomponents%2Ccomponent%2Cembedded';
|
||||
|
||||
describe('getAvailableVersions', () => {
|
||||
let spyHttpClient: any;
|
||||
|
||||
beforeEach(() => {
|
||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||
spyHttpClient.mockReturnValue({
|
||||
statusCode: 200,
|
||||
headers: {},
|
||||
result: manifestData as NikVersion[]
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jest.resetAllMocks();
|
||||
jest.clearAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
it.each([
|
||||
[
|
||||
{version: '21', architecture: 'x64', packageType: 'jdk'},
|
||||
'bundle-type=standard&bitness=64&arch=x86&build-type=all'
|
||||
],
|
||||
[
|
||||
{version: '21-ea', architecture: 'x64', packageType: 'jdk'},
|
||||
'bundle-type=standard&bitness=64&arch=x86&build-type=ea'
|
||||
],
|
||||
[
|
||||
{version: '21', architecture: 'aarch64', packageType: 'jdk'},
|
||||
'bundle-type=standard&bitness=64&arch=arm&build-type=all'
|
||||
],
|
||||
[
|
||||
{version: '21', architecture: 'x64', packageType: 'jdk+fx'},
|
||||
'bundle-type=full&bitness=64&arch=x86&build-type=all'
|
||||
]
|
||||
])('build correct url for %s -> %s', async (input, urlParams) => {
|
||||
const distribution = new LibericaNikDistributions({
|
||||
...input,
|
||||
checkLatest: false
|
||||
});
|
||||
distribution['getPlatformOption'] = () => 'linux';
|
||||
const buildUrl = `https://api.bell-sw.com/v1/nik/releases?os=linux&${urlParams}${ADDITIONAL_PARAMS}`;
|
||||
|
||||
await distribution['getAvailableVersions']();
|
||||
|
||||
expect(spyHttpClient.mock.calls).toHaveLength(1);
|
||||
expect(spyHttpClient.mock.calls[0][0]).toBe(buildUrl);
|
||||
});
|
||||
|
||||
it('load available versions', async () => {
|
||||
const distribution = new LibericaNikDistributions({
|
||||
version: '21',
|
||||
architecture: 'x64',
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
});
|
||||
const availableVersions = await distribution['getAvailableVersions']();
|
||||
expect(availableVersions).toEqual(manifestData);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getArchitectureOptions', () => {
|
||||
it.each([
|
||||
['x64', {bitness: '64', arch: 'x86'}],
|
||||
['aarch64', {bitness: '64', arch: 'arm'}]
|
||||
] as [string, ArchitectureOptions][])(
|
||||
'parse architecture %s -> %s',
|
||||
(input, expected) => {
|
||||
const distributions = new LibericaNikDistributions({
|
||||
architecture: input,
|
||||
checkLatest: false,
|
||||
packageType: 'jdk',
|
||||
version: '21'
|
||||
});
|
||||
|
||||
expect(distributions['getArchitectureOptions']()).toEqual(expected);
|
||||
}
|
||||
);
|
||||
|
||||
it.each(['x86', 'armv7', 's390x'])('not support architecture %s', input => {
|
||||
const distributions = new LibericaNikDistributions({
|
||||
architecture: input,
|
||||
checkLatest: false,
|
||||
packageType: 'jdk',
|
||||
version: '21'
|
||||
});
|
||||
|
||||
expect(() => distributions['getArchitectureOptions']()).toThrow(
|
||||
/Architecture '\w+' is not supported\. Supported architectures: .*/
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('findPackageForDownload', () => {
|
||||
let distribution: InstanceType<typeof LibericaNikDistributions>;
|
||||
|
||||
beforeEach(() => {
|
||||
distribution = new LibericaNikDistributions({
|
||||
version: '',
|
||||
architecture: 'x64',
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
});
|
||||
distribution['getAvailableVersions'] = async () => manifestData;
|
||||
});
|
||||
|
||||
// The user's java-version resolves against the embedded JDK version, not
|
||||
// NIK's own GraalVM version.
|
||||
it.each([
|
||||
['21', '21.0.11+12'],
|
||||
['17', '17.0.19+12'],
|
||||
['25', '25.0.3+12'],
|
||||
['11', '11.0.22+12'],
|
||||
['21.0.2', '21.0.2+14'],
|
||||
['23', '23.0.2+9'],
|
||||
['20.x', '20.0.2+10'],
|
||||
['25.0.1', '25.0.1+16']
|
||||
])('version is %s -> %s', async (input, expected) => {
|
||||
const result = await distribution['findPackageForDownload'](input);
|
||||
expect(result.version).toBe(expected);
|
||||
});
|
||||
|
||||
it('should throw an error', async () => {
|
||||
await expect(distribution['findPackageForDownload']('7')).rejects.toThrow(
|
||||
/No matching version found for SemVer/
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getPlatformOption', () => {
|
||||
const distributions = new LibericaNikDistributions({
|
||||
architecture: 'x64',
|
||||
version: '21',
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
});
|
||||
|
||||
it.each([
|
||||
['linux', 'linux'],
|
||||
['darwin', 'macos'],
|
||||
['win32', 'windows'],
|
||||
['cygwin', 'windows']
|
||||
])('os version %s -> %s', (input, expected) => {
|
||||
const actual = distributions['getPlatformOption'](input as NodeJS.Platform);
|
||||
|
||||
expect(actual).toEqual(expected);
|
||||
});
|
||||
|
||||
it.each(['sunos', 'aix', 'android', 'freebsd'])(
|
||||
'not support os version %s',
|
||||
input => {
|
||||
expect(() =>
|
||||
distributions['getPlatformOption'](input as NodeJS.Platform)
|
||||
).toThrow(/Platform '\w+' is not supported\. Supported platforms: .+/);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
describe('convertVersionToSemver', () => {
|
||||
const distributions = new LibericaNikDistributions({
|
||||
architecture: 'x64',
|
||||
version: '21',
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
});
|
||||
|
||||
it.each([
|
||||
['25.0.1+16', '25.0.1+16'],
|
||||
['21+37', '21.0.0+37'],
|
||||
['23+38', '23.0.0+38'],
|
||||
['11.0.15.1+2', '11.0.15+1.2'],
|
||||
['17.0.5', '17.0.5']
|
||||
])('%s -> %s', (input, expected) => {
|
||||
const actual = distributions['convertVersionToSemver'](input);
|
||||
expect(actual).toEqual(expected);
|
||||
});
|
||||
});
|
||||
137
dist/setup/index.js
vendored
137
dist/setup/index.js
vendored
@@ -38608,7 +38608,7 @@ let h2ExperimentalWarned = false
|
||||
/** @type {import('http2')} */
|
||||
let http2
|
||||
try {
|
||||
http2 = __nccwpck_require__(4848)
|
||||
http2 = __nccwpck_require__(2467)
|
||||
} catch {
|
||||
// @ts-ignore
|
||||
http2 = { constants: {} }
|
||||
@@ -64403,7 +64403,7 @@ module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:http");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4848:
|
||||
/***/ 2467:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:http2");
|
||||
@@ -132093,6 +132093,129 @@ class LibericaDistributions extends JavaBase {
|
||||
}
|
||||
}
|
||||
|
||||
;// CONCATENATED MODULE: ./src/distributions/liberica-nik/installer.ts
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const installer_supportedPlatform = `'linux', 'macos', 'windows'`;
|
||||
const installer_supportedArchitectures = `'x64', 'aarch64'`;
|
||||
class LibericaNikDistributions extends JavaBase {
|
||||
constructor(installerOptions) {
|
||||
super('Liberica_NIK', installerOptions);
|
||||
}
|
||||
async downloadTool(javaRelease) {
|
||||
info(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`);
|
||||
let javaArchivePath = await downloadTool(javaRelease.url);
|
||||
info(`Extracting Java archive...`);
|
||||
const extension = getDownloadArchiveExtension();
|
||||
if (process.platform === 'win32') {
|
||||
javaArchivePath = renameWinArchive(javaArchivePath);
|
||||
}
|
||||
const extractedJavaPath = await extractJdkFile(javaArchivePath, extension);
|
||||
const archiveName = external_fs_default().readdirSync(extractedJavaPath)[0];
|
||||
const archivePath = external_path_default().join(extractedJavaPath, archiveName);
|
||||
const javaPath = await cacheDir(archivePath, this.toolcacheFolderName, this.getToolcacheVersionName(javaRelease.version), this.architecture);
|
||||
return { version: javaRelease.version, path: javaPath };
|
||||
}
|
||||
async findPackageForDownload(range) {
|
||||
const availableVersionsRaw = await this.getAvailableVersions();
|
||||
const availableVersions = availableVersionsRaw
|
||||
.map(item => {
|
||||
const jdkVersion = this.getJdkVersion(item);
|
||||
return jdkVersion ? { url: item.downloadUrl, version: jdkVersion } : null;
|
||||
})
|
||||
.filter((item) => item !== null);
|
||||
const satisfiedVersion = availableVersions
|
||||
.filter(item => isVersionSatisfies(range, item.version))
|
||||
.sort((a, b) => -semver_default().compareBuild(a.version, b.version))[0];
|
||||
if (!satisfiedVersion) {
|
||||
const availableVersionStrings = availableVersions.map(item => item.version);
|
||||
throw this.createVersionNotFoundError(range, availableVersionStrings);
|
||||
}
|
||||
return satisfiedVersion;
|
||||
}
|
||||
async getAvailableVersions() {
|
||||
if (isDebug()) {
|
||||
console.time('Retrieving available versions for Liberica NIK took'); // eslint-disable-line no-console
|
||||
}
|
||||
const url = this.prepareAvailableVersionsUrl();
|
||||
core_debug(`Gathering available versions from '${url}'`);
|
||||
const availableVersions = (await this.http.getJson(url)).result ?? [];
|
||||
if (isDebug()) {
|
||||
startGroup('Print information about available versions');
|
||||
console.timeEnd('Retrieving available versions for Liberica NIK took'); // eslint-disable-line no-console
|
||||
core_debug(`Available versions: [${availableVersions.length}]`);
|
||||
core_debug(availableVersions.map(item => item.version).join(', '));
|
||||
endGroup();
|
||||
}
|
||||
return availableVersions;
|
||||
}
|
||||
prepareAvailableVersionsUrl() {
|
||||
const urlOptions = {
|
||||
os: this.getPlatformOption(),
|
||||
'bundle-type': this.getBundleType(),
|
||||
...this.getArchitectureOptions(),
|
||||
'build-type': this.stable ? 'all' : 'ea',
|
||||
'installation-type': 'archive',
|
||||
fields: 'downloadUrl,version,components,component,embedded'
|
||||
};
|
||||
const searchParams = new URLSearchParams(urlOptions).toString();
|
||||
return `https://api.bell-sw.com/v1/nik/releases?${searchParams}`;
|
||||
}
|
||||
// NIK's top-level `version` is the GraalVM/NIK version; the JDK version that
|
||||
// users select on lives in the embedded `liberica` component.
|
||||
getJdkVersion(release) {
|
||||
const liberica = release.components?.find(component => component.component === 'liberica');
|
||||
return liberica ? this.convertVersionToSemver(liberica.version) : null;
|
||||
}
|
||||
// The `full` bundle adds JavaFX/Swing GUI support; otherwise use `standard`.
|
||||
getBundleType() {
|
||||
const [, feature] = this.packageType.split('+');
|
||||
return feature?.includes('fx') ? 'full' : 'standard';
|
||||
}
|
||||
getArchitectureOptions() {
|
||||
const arch = this.distributionArchitecture();
|
||||
switch (arch) {
|
||||
case 'x64':
|
||||
return { bitness: '64', arch: 'x86' };
|
||||
case 'aarch64':
|
||||
return { bitness: '64', arch: 'arm' };
|
||||
default:
|
||||
throw new Error(`Architecture '${this.architecture}' is not supported. Supported architectures: ${installer_supportedArchitectures}`);
|
||||
}
|
||||
}
|
||||
getPlatformOption(platform = process.platform) {
|
||||
switch (platform) {
|
||||
case 'darwin':
|
||||
return 'macos';
|
||||
case 'win32':
|
||||
case 'cygwin':
|
||||
return 'windows';
|
||||
case 'linux':
|
||||
return 'linux';
|
||||
default:
|
||||
throw new Error(`Platform '${platform}' is not supported. Supported platforms: ${installer_supportedPlatform}`);
|
||||
}
|
||||
}
|
||||
// JDK versions come as strings like '25.0.1+16', '23+38' or '11.0.15.1+2'.
|
||||
// Normalize them to valid SemVer while preserving build metadata so newer
|
||||
// NIK builds of the same JDK sort ahead of older ones.
|
||||
convertVersionToSemver(jdkVersion) {
|
||||
const [main, build] = jdkVersion.split('+');
|
||||
const parts = main.split('.');
|
||||
while (parts.length < 3) {
|
||||
parts.push('0');
|
||||
}
|
||||
const base = parts.slice(0, 3).join('.');
|
||||
const buildMeta = [...parts.slice(3), ...(build ? [build] : [])];
|
||||
return buildMeta.length ? `${base}+${buildMeta.join('.')}` : base;
|
||||
}
|
||||
}
|
||||
|
||||
;// 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
|
||||
@@ -132233,7 +132356,7 @@ class MicrosoftDistributions extends JavaBase {
|
||||
|
||||
|
||||
|
||||
const installer_supportedArchitectures = [
|
||||
const semeru_installer_supportedArchitectures = [
|
||||
'x64',
|
||||
'x86',
|
||||
'ppc64le',
|
||||
@@ -132247,8 +132370,8 @@ class SemeruDistribution extends JavaBase {
|
||||
}
|
||||
async findPackageForDownload(version) {
|
||||
const arch = this.distributionArchitecture();
|
||||
if (!installer_supportedArchitectures.includes(arch)) {
|
||||
throw new Error(`Unsupported architecture for IBM Semeru: ${this.architecture} for your current OS version, the following are supported: ${installer_supportedArchitectures.join(', ')}`);
|
||||
if (!semeru_installer_supportedArchitectures.includes(arch)) {
|
||||
throw new Error(`Unsupported architecture for IBM Semeru: ${this.architecture} for your current OS version, the following are supported: ${semeru_installer_supportedArchitectures.join(', ')}`);
|
||||
}
|
||||
if (!this.stable) {
|
||||
throw new Error('IBM Semeru does not provide builds for early access versions');
|
||||
@@ -133538,6 +133661,7 @@ class KonaDistribution extends JavaBase {
|
||||
|
||||
|
||||
|
||||
|
||||
var JavaDistribution;
|
||||
(function (JavaDistribution) {
|
||||
JavaDistribution["Adopt"] = "adopt";
|
||||
@@ -133546,6 +133670,7 @@ var JavaDistribution;
|
||||
JavaDistribution["Temurin"] = "temurin";
|
||||
JavaDistribution["Zulu"] = "zulu";
|
||||
JavaDistribution["Liberica"] = "liberica";
|
||||
JavaDistribution["LibericaNik"] = "liberica-nik";
|
||||
JavaDistribution["JdkFile"] = "jdkfile";
|
||||
JavaDistribution["Microsoft"] = "microsoft";
|
||||
JavaDistribution["Semeru"] = "semeru";
|
||||
@@ -133573,6 +133698,8 @@ function getJavaDistribution(distributionName, installerOptions, jdkFile) {
|
||||
return new ZuluDistribution(installerOptions);
|
||||
case JavaDistribution.Liberica:
|
||||
return new LibericaDistributions(installerOptions);
|
||||
case JavaDistribution.LibericaNik:
|
||||
return new LibericaNikDistributions(installerOptions);
|
||||
case JavaDistribution.Microsoft:
|
||||
return new MicrosoftDistributions(installerOptions);
|
||||
case JavaDistribution.Semeru:
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
- [Adopt](#Adopt)
|
||||
- [Zulu](#Zulu)
|
||||
- [Liberica](#Liberica)
|
||||
- [Liberica Native Image Kit](#Liberica-Native-Image-Kit)
|
||||
- [Microsoft](#Microsoft)
|
||||
- [Amazon Corretto](#Amazon-Corretto)
|
||||
- [Oracle](#Oracle)
|
||||
@@ -85,6 +86,20 @@ steps:
|
||||
- run: java --version
|
||||
```
|
||||
|
||||
### Liberica Native Image Kit
|
||||
Liberica Native Image Kit (NIK) is a GraalVM-based distribution. `java-version` selects the underlying JDK version (e.g. `17`, `21`, `25`). Use `java-package: jdk+fx` to get the `full` bundle with JavaFX/Swing support; otherwise the `standard` bundle (with extra languages) is installed. Available on Linux, macOS and Windows for `x64` and `aarch64`.
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-java@v5
|
||||
with:
|
||||
distribution: 'liberica-nik'
|
||||
java-version: '25'
|
||||
java-package: jdk # optional (jdk or jdk+fx) - defaults to jdk
|
||||
- run: native-image --version
|
||||
```
|
||||
|
||||
### Microsoft
|
||||
|
||||
```yaml
|
||||
@@ -578,14 +593,13 @@ jobs:
|
||||
server-id: maven # Value of the distributionManagement/repository/id field of the pom.xml
|
||||
server-username: MAVEN_USERNAME # env variable for username in deploy
|
||||
server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy
|
||||
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
|
||||
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
|
||||
|
||||
- name: Publish to Apache Maven Central
|
||||
run: mvn deploy
|
||||
run: mvn deploy -Dgpg.signer=bc # requires maven-gpg-plugin >= 3.2.0 (bc signer support)
|
||||
env:
|
||||
MAVEN_USERNAME: maven_username123
|
||||
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
|
||||
MAVEN_GPG_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # ASCII-armored secret key (TSK), e.g. from `gpg --armor --export-secret-keys YOUR_ID`
|
||||
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
|
||||
```
|
||||
|
||||
@@ -603,10 +617,6 @@ The two `settings.xml` files created from the above example look like the follow
|
||||
<username>${env.GITHUB_ACTOR}</username>
|
||||
<password>${env.GITHUB_TOKEN}</password>
|
||||
</server>
|
||||
<server>
|
||||
<id>gpg.passphrase</id>
|
||||
<passphrase>${env.GPG_PASSPHRASE}</passphrase>
|
||||
</server>
|
||||
</servers>
|
||||
</settings>
|
||||
```
|
||||
@@ -623,10 +633,6 @@ The two `settings.xml` files created from the above example look like the follow
|
||||
<username>${env.MAVEN_USERNAME}</username>
|
||||
<password>${env.MAVEN_CENTRAL_TOKEN}</password>
|
||||
</server>
|
||||
<server>
|
||||
<id>gpg.passphrase</id>
|
||||
<passphrase>${env.MAVEN_GPG_PASSPHRASE}</passphrase>
|
||||
</server>
|
||||
</servers>
|
||||
</settings>
|
||||
```
|
||||
@@ -637,9 +643,48 @@ The two `settings.xml` files created from the above example look like the follow
|
||||
|
||||
If you don't want to overwrite the `settings.xml` file, you can set `overwrite-settings: false`
|
||||
|
||||
### Extra setup for pom.xml:
|
||||
### GPG
|
||||
|
||||
The Maven GPG Plugin configuration in the pom.xml file should contain the following structure to avoid possible issues like `Inappropriate ioctl for device` or `gpg: signing failed: No such file or directory`:
|
||||
The example above uses the [Maven GPG Plugin](https://maven.apache.org/plugins/maven-gpg-plugin/)'s Bouncy Castle signer (`-Dgpg.signer=bc`, available since `maven-gpg-plugin` 3.2.0). It is a pure-Java signer that reads the key directly from the `MAVEN_GPG_KEY` environment variable, so it does **not** require the `gpg` executable, importing the key into a GPG keychain, or the `--pinentry-mode loopback` workaround in your `pom.xml`. The key must be an ASCII-armored secret key (transferable secret key format).
|
||||
|
||||
**GPG key should be exported by: `gpg --armor --export-secret-keys YOUR_ID`**
|
||||
|
||||
See the help docs on [Publishing a Package](https://help.github.com/en/github/managing-packages-with-github-packages/configuring-apache-maven-for-use-with-github-packages#publishing-a-package) for more information on the `pom.xml` file.
|
||||
|
||||
#### Legacy / alternative: let setup-java import the key
|
||||
|
||||
If you use `maven-gpg-plugin` older than 3.2.0, or you prefer signing with the `gpg` executable, you can let setup-java import the key instead by providing the `gpg-private-key` and `gpg-passphrase` inputs. The private key is written to a file in the runner's temp directory, imported into the GPG keychain, and the file is promptly removed before proceeding with the rest of the setup process. A cleanup step removes the imported private key from the GPG keychain after the job completes regardless of the job status. This ensures that the private key is no longer accessible on self-hosted runners and cannot "leak" between jobs (hosted runners are always clean instances).
|
||||
|
||||
```yaml
|
||||
- name: Set up Apache Maven Central
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '11'
|
||||
server-id: maven # Value of the distributionManagement/repository/id field of the pom.xml
|
||||
server-username: MAVEN_USERNAME # env variable for username in deploy
|
||||
server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy
|
||||
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
|
||||
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
|
||||
|
||||
- name: Publish to Apache Maven Central
|
||||
run: mvn deploy
|
||||
env:
|
||||
MAVEN_USERNAME: maven_username123
|
||||
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
|
||||
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
|
||||
```
|
||||
|
||||
With these inputs, setup-java adds a `gpg.passphrase` server to the generated `settings.xml`:
|
||||
|
||||
```xml
|
||||
<server>
|
||||
<id>gpg.passphrase</id>
|
||||
<passphrase>${env.MAVEN_GPG_PASSPHRASE}</passphrase>
|
||||
</server>
|
||||
```
|
||||
|
||||
When signing with the `gpg` executable, the Maven GPG Plugin configuration in your `pom.xml` should contain the following structure to avoid possible issues like `Inappropriate ioctl for device` or `gpg: signing failed: No such file or directory`:
|
||||
|
||||
```xml
|
||||
<configuration>
|
||||
@@ -650,17 +695,10 @@ The Maven GPG Plugin configuration in the pom.xml file should contain the follow
|
||||
</gpgArguments>
|
||||
</configuration>
|
||||
```
|
||||
|
||||
GPG 2.1 requires `--pinentry-mode` to be set to `loopback` in order to pick up the `gpg.passphrase` value defined in Maven `settings.xml`.
|
||||
|
||||
### GPG
|
||||
|
||||
If `gpg-private-key` input is provided, the private key will be written to a file in the runner's temp directory, the private key file will be imported into the GPG keychain, and then the file will be promptly removed before proceeding with the rest of the setup process. A cleanup step will remove the imported private key from the GPG keychain after the job completes regardless of the job status. This ensures that the private key is no longer accessible on self-hosted runners and cannot "leak" between jobs (hosted runners are always clean instances).
|
||||
|
||||
**GPG key should be exported by: `gpg --armor --export-secret-keys YOUR_ID`**
|
||||
|
||||
See the help docs on [Publishing a Package](https://help.github.com/en/github/managing-packages-with-github-packages/configuring-apache-maven-for-use-with-github-packages#publishing-a-package) for more information on the `pom.xml` file.
|
||||
|
||||
***NOTE***: If the error that states, `gpg: Sorry, no terminal at all requested - can't get input` [is encountered](https://github.com/actions/setup-java/issues/554), please update the version of `maven-gpg-plugin` to 1.6 or higher.
|
||||
***NOTE***: If, when using the default `gpg` signer, the error `gpg: Sorry, no terminal at all requested - can't get input` [is encountered](https://github.com/actions/setup-java/issues/554), please update the version of `maven-gpg-plugin` to 1.6 or higher.
|
||||
|
||||
## Apache Maven with a settings path
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
TemurinImplementation
|
||||
} from './temurin/installer.js';
|
||||
import {LibericaDistributions} from './liberica/installer.js';
|
||||
import {LibericaNikDistributions} from './liberica-nik/installer.js';
|
||||
import {MicrosoftDistributions} from './microsoft/installer.js';
|
||||
import {SemeruDistribution} from './semeru/installer.js';
|
||||
import {CorrettoDistribution} from './corretto/installer.js';
|
||||
@@ -28,6 +29,7 @@ enum JavaDistribution {
|
||||
Temurin = 'temurin',
|
||||
Zulu = 'zulu',
|
||||
Liberica = 'liberica',
|
||||
LibericaNik = 'liberica-nik',
|
||||
JdkFile = 'jdkfile',
|
||||
Microsoft = 'microsoft',
|
||||
Semeru = 'semeru',
|
||||
@@ -69,6 +71,8 @@ export function getJavaDistribution(
|
||||
return new ZuluDistribution(installerOptions);
|
||||
case JavaDistribution.Liberica:
|
||||
return new LibericaDistributions(installerOptions);
|
||||
case JavaDistribution.LibericaNik:
|
||||
return new LibericaNikDistributions(installerOptions);
|
||||
case JavaDistribution.Microsoft:
|
||||
return new MicrosoftDistributions(installerOptions);
|
||||
case JavaDistribution.Semeru:
|
||||
|
||||
180
src/distributions/liberica-nik/installer.ts
Normal file
180
src/distributions/liberica-nik/installer.ts
Normal file
@@ -0,0 +1,180 @@
|
||||
import {JavaBase} from '../base-installer.js';
|
||||
import {
|
||||
JavaDownloadRelease,
|
||||
JavaInstallerOptions,
|
||||
JavaInstallerResults
|
||||
} from '../base-models.js';
|
||||
import semver from 'semver';
|
||||
import {
|
||||
extractJdkFile,
|
||||
getDownloadArchiveExtension,
|
||||
isVersionSatisfies,
|
||||
renameWinArchive
|
||||
} from '../../util.js';
|
||||
import * as core from '@actions/core';
|
||||
import {ArchitectureOptions, NikVersion, OsVersions} from './models.js';
|
||||
import * as tc from '@actions/tool-cache';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
const supportedPlatform = `'linux', 'macos', 'windows'`;
|
||||
|
||||
const supportedArchitectures = `'x64', 'aarch64'`;
|
||||
|
||||
export class LibericaNikDistributions extends JavaBase {
|
||||
constructor(installerOptions: JavaInstallerOptions) {
|
||||
super('Liberica_NIK', installerOptions);
|
||||
}
|
||||
|
||||
protected async downloadTool(
|
||||
javaRelease: JavaDownloadRelease
|
||||
): Promise<JavaInstallerResults> {
|
||||
core.info(
|
||||
`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`
|
||||
);
|
||||
let javaArchivePath = await tc.downloadTool(javaRelease.url);
|
||||
|
||||
core.info(`Extracting Java archive...`);
|
||||
const extension = getDownloadArchiveExtension();
|
||||
if (process.platform === 'win32') {
|
||||
javaArchivePath = renameWinArchive(javaArchivePath);
|
||||
}
|
||||
const extractedJavaPath = await extractJdkFile(javaArchivePath, extension);
|
||||
|
||||
const archiveName = fs.readdirSync(extractedJavaPath)[0];
|
||||
const archivePath = path.join(extractedJavaPath, archiveName);
|
||||
|
||||
const javaPath = await tc.cacheDir(
|
||||
archivePath,
|
||||
this.toolcacheFolderName,
|
||||
this.getToolcacheVersionName(javaRelease.version),
|
||||
this.architecture
|
||||
);
|
||||
|
||||
return {version: javaRelease.version, path: javaPath};
|
||||
}
|
||||
|
||||
protected async findPackageForDownload(
|
||||
range: string
|
||||
): Promise<JavaDownloadRelease> {
|
||||
const availableVersionsRaw = await this.getAvailableVersions();
|
||||
|
||||
const availableVersions = availableVersionsRaw
|
||||
.map(item => {
|
||||
const jdkVersion = this.getJdkVersion(item);
|
||||
return jdkVersion ? {url: item.downloadUrl, version: jdkVersion} : null;
|
||||
})
|
||||
.filter((item): item is {url: string; version: string} => item !== null);
|
||||
|
||||
const satisfiedVersion = availableVersions
|
||||
.filter(item => isVersionSatisfies(range, item.version))
|
||||
.sort((a, b) => -semver.compareBuild(a.version, b.version))[0];
|
||||
|
||||
if (!satisfiedVersion) {
|
||||
const availableVersionStrings = availableVersions.map(
|
||||
item => item.version
|
||||
);
|
||||
throw this.createVersionNotFoundError(range, availableVersionStrings);
|
||||
}
|
||||
|
||||
return satisfiedVersion;
|
||||
}
|
||||
|
||||
private async getAvailableVersions(): Promise<NikVersion[]> {
|
||||
if (core.isDebug()) {
|
||||
console.time('Retrieving available versions for Liberica NIK took'); // eslint-disable-line no-console
|
||||
}
|
||||
const url = this.prepareAvailableVersionsUrl();
|
||||
|
||||
core.debug(`Gathering available versions from '${url}'`);
|
||||
|
||||
const availableVersions =
|
||||
(await this.http.getJson<NikVersion[]>(url)).result ?? [];
|
||||
|
||||
if (core.isDebug()) {
|
||||
core.startGroup('Print information about available versions');
|
||||
console.timeEnd('Retrieving available versions for Liberica NIK took'); // eslint-disable-line no-console
|
||||
core.debug(`Available versions: [${availableVersions.length}]`);
|
||||
core.debug(availableVersions.map(item => item.version).join(', '));
|
||||
core.endGroup();
|
||||
}
|
||||
|
||||
return availableVersions;
|
||||
}
|
||||
|
||||
private prepareAvailableVersionsUrl() {
|
||||
const urlOptions = {
|
||||
os: this.getPlatformOption(),
|
||||
'bundle-type': this.getBundleType(),
|
||||
...this.getArchitectureOptions(),
|
||||
'build-type': this.stable ? 'all' : 'ea',
|
||||
'installation-type': 'archive',
|
||||
fields: 'downloadUrl,version,components,component,embedded'
|
||||
};
|
||||
|
||||
const searchParams = new URLSearchParams(urlOptions).toString();
|
||||
|
||||
return `https://api.bell-sw.com/v1/nik/releases?${searchParams}`;
|
||||
}
|
||||
|
||||
// NIK's top-level `version` is the GraalVM/NIK version; the JDK version that
|
||||
// users select on lives in the embedded `liberica` component.
|
||||
private getJdkVersion(release: NikVersion): string | null {
|
||||
const liberica = release.components?.find(
|
||||
component => component.component === 'liberica'
|
||||
);
|
||||
return liberica ? this.convertVersionToSemver(liberica.version) : null;
|
||||
}
|
||||
|
||||
// The `full` bundle adds JavaFX/Swing GUI support; otherwise use `standard`.
|
||||
private getBundleType(): string {
|
||||
const [, feature] = this.packageType.split('+');
|
||||
return feature?.includes('fx') ? 'full' : 'standard';
|
||||
}
|
||||
|
||||
private getArchitectureOptions(): ArchitectureOptions {
|
||||
const arch = this.distributionArchitecture();
|
||||
switch (arch) {
|
||||
case 'x64':
|
||||
return {bitness: '64', arch: 'x86'};
|
||||
case 'aarch64':
|
||||
return {bitness: '64', arch: 'arm'};
|
||||
default:
|
||||
throw new Error(
|
||||
`Architecture '${this.architecture}' is not supported. Supported architectures: ${supportedArchitectures}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private getPlatformOption(
|
||||
platform: NodeJS.Platform = process.platform
|
||||
): OsVersions {
|
||||
switch (platform) {
|
||||
case 'darwin':
|
||||
return 'macos';
|
||||
case 'win32':
|
||||
case 'cygwin':
|
||||
return 'windows';
|
||||
case 'linux':
|
||||
return 'linux';
|
||||
default:
|
||||
throw new Error(
|
||||
`Platform '${platform}' is not supported. Supported platforms: ${supportedPlatform}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// JDK versions come as strings like '25.0.1+16', '23+38' or '11.0.15.1+2'.
|
||||
// Normalize them to valid SemVer while preserving build metadata so newer
|
||||
// NIK builds of the same JDK sort ahead of older ones.
|
||||
private convertVersionToSemver(jdkVersion: string): string {
|
||||
const [main, build] = jdkVersion.split('+');
|
||||
const parts = main.split('.');
|
||||
while (parts.length < 3) {
|
||||
parts.push('0');
|
||||
}
|
||||
const base = parts.slice(0, 3).join('.');
|
||||
const buildMeta = [...parts.slice(3), ...(build ? [build] : [])];
|
||||
return buildMeta.length ? `${base}+${buildMeta.join('.')}` : base;
|
||||
}
|
||||
}
|
||||
26
src/distributions/liberica-nik/models.ts
Normal file
26
src/distributions/liberica-nik/models.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
// Models from https://api.bell-sw.com/api.html (NIK product)
|
||||
|
||||
export type Bitness = '32' | '64';
|
||||
export type ArchType = 'arm' | 'ppc' | 'sparc' | 'x86';
|
||||
|
||||
export type OsVersions = 'linux' | 'linux-musl' | 'macos' | 'windows';
|
||||
|
||||
export interface ArchitectureOptions {
|
||||
bitness: Bitness;
|
||||
arch: ArchType;
|
||||
}
|
||||
|
||||
export interface NikComponent {
|
||||
component: string;
|
||||
version: string;
|
||||
embedded?: boolean;
|
||||
}
|
||||
|
||||
export interface NikVersion {
|
||||
// The main Liberica NIK VM bundle download URL.
|
||||
downloadUrl: string;
|
||||
// NIK/GraalVM version (e.g. '24.1.0+1'), kept for logging only.
|
||||
version: string;
|
||||
// The embedded `liberica` component carries the actual JDK version.
|
||||
components: NikComponent[];
|
||||
}
|
||||
Reference in New Issue
Block a user