mirror of
https://github.com/actions/setup-java.git
synced 2024-11-27 03:59:02 +00:00
Add support for Liberica JDK (#225)
This commit is contained in:
parent
ae26cabe43
commit
d61af71edf
20
.github/workflows/e2e-versions.yml
vendored
20
.github/workflows/e2e-versions.yml
vendored
@ -20,7 +20,7 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
||||
distribution: ['temurin', 'adopt', 'adopt-openj9', 'zulu'] # internally 'adopt-hotspot' is the same as 'adopt'
|
||||
distribution: ['temurin', 'adopt', 'adopt-openj9', 'zulu', 'liberica'] # internally 'adopt-hotspot' is the same as 'adopt'
|
||||
version: ['8', '11', '16']
|
||||
steps:
|
||||
- name: Checkout
|
||||
@ -43,7 +43,7 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
||||
distribution: ['temurin', 'zulu']
|
||||
distribution: ['temurin', 'zulu', 'liberica']
|
||||
version:
|
||||
- '11.0'
|
||||
- '8.0.302'
|
||||
@ -69,7 +69,7 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
||||
distribution: ['temurin', 'zulu']
|
||||
distribution: ['temurin', 'zulu', 'liberica']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
@ -136,7 +136,7 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
||||
distribution: ['temurin', 'zulu']
|
||||
distribution: ['temurin', 'zulu', 'liberica']
|
||||
java-package: ['jre']
|
||||
version: ['16.0']
|
||||
include:
|
||||
@ -148,6 +148,14 @@ jobs:
|
||||
java-package: jdk+fx
|
||||
version: '8.0.242'
|
||||
os: ubuntu-latest
|
||||
- distribution: 'liberica'
|
||||
java-package: jdk+fx
|
||||
version: '8'
|
||||
os: ubuntu-latest
|
||||
- distribution: 'liberica'
|
||||
java-package: jre+fx
|
||||
version: '11'
|
||||
os: ubuntu-latest
|
||||
exclude:
|
||||
# Eclipse Temurin currently doesn't publish JREs, only JDKs
|
||||
- distribution: 'temurin'
|
||||
@ -173,9 +181,9 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# Only Zulu provides x86 arch for now and only for windows / ubuntu
|
||||
# Only Zulu and Liberica provides x86 arch for now and only for windows / ubuntu
|
||||
os: [windows-latest, ubuntu-latest]
|
||||
distribution: ['zulu']
|
||||
distribution: ['zulu', 'liberica']
|
||||
version: ['11']
|
||||
steps:
|
||||
- name: Checkout
|
||||
|
@ -57,7 +57,8 @@ Currently, the following distributions are supported:
|
||||
| `temurin` | Eclipse Temurin | [Link](https://adoptium.net/) | [Link](https://adoptium.net/about.html)
|
||||
| `zulu` | Zulu OpenJDK | [Link](https://www.azul.com/downloads/zulu-community/?package=jdk) | [Link](https://www.azul.com/products/zulu-and-zulu-enterprise/zulu-terms-of-use/) |
|
||||
| `adopt` or `adopt-hotspot` | Adopt OpenJDK Hotspot | [Link](https://adoptopenjdk.net/) | [Link](https://adoptopenjdk.net/about.html) |
|
||||
| `adopt-openj9` | Adopt OpenJDK OpenJ9 | [Link](https://adoptopenjdk.net/) | [Link](https://adoptopenjdk.net/about.html)
|
||||
| `adopt-openj9` | Adopt OpenJDK OpenJ9 | [Link](https://adoptopenjdk.net/) | [Link](https://adoptopenjdk.net/about.html) |
|
||||
| `liberica` | Liberica JDK | [Link](https://bell-sw.com/) | [Link](https://bell-sw.com/liberica_eula/) |
|
||||
|
||||
**NOTE:** The different distributors can provide discrepant list of available versions / supported configurations. Please refer to the official documentation to see the list of supported versions.
|
||||
|
||||
@ -134,6 +135,7 @@ jobs:
|
||||
- [Eclipse Temurin](docs/advanced-usage.md#Eclipse-Temurin)
|
||||
- [Adopt](docs/advanced-usage.md#Adopt)
|
||||
- [Zulu](docs/advanced-usage.md#Zulu)
|
||||
- [Liberica](docs/advanced-usage.md#Liberica)
|
||||
- [Installing custom Java package type](docs/advanced-usage.md#Installing-custom-Java-package-type)
|
||||
- [Installing custom Java architecture](docs/advanced-usage.md#Installing-custom-Java-architecture)
|
||||
- [Installing custom Java distribution from local file](docs/advanced-usage.md#Installing-Java-from-local-file)
|
||||
|
434
__tests__/data/liberica.json
Normal file
434
__tests__/data/liberica.json
Normal file
@ -0,0 +1,434 @@
|
||||
[
|
||||
{
|
||||
"buildVersion": 36,
|
||||
"updateVersion": 0,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/14+36/bellsoft-jdk14+36-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "14+36",
|
||||
"featureVersion": 14
|
||||
},
|
||||
{
|
||||
"buildVersion": 9,
|
||||
"updateVersion": 11,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.11+9/bellsoft-jdk11.0.11+9-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "11.0.11+9",
|
||||
"featureVersion": 11
|
||||
},
|
||||
{
|
||||
"buildVersion": 8,
|
||||
"updateVersion": 1,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/14.0.1+8/bellsoft-jdk14.0.1+8-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "14.0.1+8",
|
||||
"featureVersion": 14
|
||||
},
|
||||
{
|
||||
"buildVersion": 10,
|
||||
"updateVersion": 262,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u262+10/bellsoft-jdk8u262+10-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "8u262+10",
|
||||
"featureVersion": 8
|
||||
},
|
||||
{
|
||||
"buildVersion": 1,
|
||||
"updateVersion": 275,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u275+1/bellsoft-jdk8u275+1-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "8u275+1",
|
||||
"featureVersion": 8
|
||||
},
|
||||
{
|
||||
"buildVersion": 1,
|
||||
"updateVersion": 9,
|
||||
"patchVersion": 1,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.9.1+1/bellsoft-jdk11.0.9.1+1-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "11.0.9.1+1",
|
||||
"featureVersion": 11
|
||||
},
|
||||
{
|
||||
"buildVersion": 8,
|
||||
"updateVersion": 202,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u202/bellsoft-jdk8u202-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "8u202+8",
|
||||
"featureVersion": 8
|
||||
},
|
||||
{
|
||||
"buildVersion": 33,
|
||||
"updateVersion": 0,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/12/bellsoft-jdk12-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "12+33",
|
||||
"featureVersion": 12
|
||||
},
|
||||
{
|
||||
"buildVersion": 8,
|
||||
"updateVersion": 282,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u282+8/bellsoft-jdk8u282+8-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "8u282+8",
|
||||
"featureVersion": 8
|
||||
},
|
||||
{
|
||||
"buildVersion": 11,
|
||||
"updateVersion": 9,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.9+11/bellsoft-jdk11.0.9+11-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "11.0.9+11",
|
||||
"featureVersion": 11
|
||||
},
|
||||
{
|
||||
"buildVersion": 33,
|
||||
"updateVersion": 0,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/13/bellsoft-jdk13-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "13+33",
|
||||
"featureVersion": 13
|
||||
},
|
||||
{
|
||||
"buildVersion": 12,
|
||||
"updateVersion": 9,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.9+12/bellsoft-jdk11.0.9+12-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "11.0.9+12",
|
||||
"featureVersion": 11
|
||||
},
|
||||
{
|
||||
"buildVersion": 7,
|
||||
"updateVersion": 242,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u242+7/bellsoft-jdk8u242+7-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "8u242+7",
|
||||
"featureVersion": 8
|
||||
},
|
||||
{
|
||||
"buildVersion": 9,
|
||||
"updateVersion": 2,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/13.0.2+9/bellsoft-jdk13.0.2+9-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "13.0.2+9",
|
||||
"featureVersion": 13
|
||||
},
|
||||
{
|
||||
"buildVersion": 9,
|
||||
"updateVersion": 1,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/13.0.1/bellsoft-jdk13.0.1-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "13.0.1+9",
|
||||
"featureVersion": 13
|
||||
},
|
||||
{
|
||||
"buildVersion": 1,
|
||||
"updateVersion": 265,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u265+1/bellsoft-jdk8u265+1-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "8u265+1",
|
||||
"featureVersion": 8
|
||||
},
|
||||
{
|
||||
"buildVersion": 9,
|
||||
"updateVersion": 1,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/15.0.1+9/bellsoft-jdk15.0.1+9-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "15.0.1+9",
|
||||
"featureVersion": 15
|
||||
},
|
||||
{
|
||||
"buildVersion": 10,
|
||||
"updateVersion": 272,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u272+10/bellsoft-jdk8u272+10-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "8u272+10",
|
||||
"featureVersion": 8
|
||||
},
|
||||
{
|
||||
"buildVersion": 7,
|
||||
"updateVersion": 2,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/16.0.2+7/bellsoft-jdk16.0.2+7-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "16.0.2+7",
|
||||
"featureVersion": 16
|
||||
},
|
||||
{
|
||||
"buildVersion": 10,
|
||||
"updateVersion": 6,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.6+10/bellsoft-jdk11.0.6+10-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "11.0.6+10",
|
||||
"featureVersion": 11
|
||||
},
|
||||
{
|
||||
"buildVersion": 9,
|
||||
"updateVersion": 252,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u252+9/bellsoft-jdk8u252+9-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "8u252+9",
|
||||
"featureVersion": 8
|
||||
},
|
||||
{
|
||||
"buildVersion": 12,
|
||||
"updateVersion": 212,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u212/bellsoft-jdk8u212-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "8u212+12",
|
||||
"featureVersion": 8
|
||||
},
|
||||
{
|
||||
"buildVersion": 10,
|
||||
"updateVersion": 2,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/15.0.2+10/bellsoft-jdk15.0.2+10-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "15.0.2+10",
|
||||
"featureVersion": 15
|
||||
},
|
||||
{
|
||||
"buildVersion": 9,
|
||||
"updateVersion": 10,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.10+9/bellsoft-jdk11.0.10+9-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "11.0.10+9",
|
||||
"featureVersion": 11
|
||||
},
|
||||
{
|
||||
"buildVersion": 0,
|
||||
"updateVersion": 1,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.1/bellsoft-jdk11.0.1-macos-amd64.tar.gz",
|
||||
"interimVersion": 0,
|
||||
"version": "11.0.1+0",
|
||||
"featureVersion": 11
|
||||
},
|
||||
{
|
||||
"buildVersion": 7,
|
||||
"updateVersion": 12,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.12+7/bellsoft-jdk11.0.12+7-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "11.0.12+7",
|
||||
"featureVersion": 11
|
||||
},
|
||||
{
|
||||
"buildVersion": 36,
|
||||
"updateVersion": 0,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/16+36/bellsoft-jdk16+36-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "16+36",
|
||||
"featureVersion": 16
|
||||
},
|
||||
{
|
||||
"buildVersion": 12,
|
||||
"updateVersion": 3,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.3/bellsoft-jdk11.0.3-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "11.0.3+12",
|
||||
"featureVersion": 11
|
||||
},
|
||||
{
|
||||
"buildVersion": 10,
|
||||
"updateVersion": 8,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.8+10/bellsoft-jdk11.0.8+10-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "11.0.8+10",
|
||||
"featureVersion": 11
|
||||
},
|
||||
{
|
||||
"buildVersion": 7,
|
||||
"updateVersion": 2,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.2/bellsoft-jdk11.0.2-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "11.0.2+7",
|
||||
"featureVersion": 11
|
||||
},
|
||||
{
|
||||
"buildVersion": 10,
|
||||
"updateVersion": 5,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.5/bellsoft-jdk11.0.5-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "11.0.5+10",
|
||||
"featureVersion": 11
|
||||
},
|
||||
{
|
||||
"buildVersion": 10,
|
||||
"updateVersion": 4,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.4/bellsoft-jdk11.0.4-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "11.0.4+10",
|
||||
"featureVersion": 11
|
||||
},
|
||||
{
|
||||
"buildVersion": 10,
|
||||
"updateVersion": 2,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/12.0.2/bellsoft-jdk12.0.2-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "12.0.2+10",
|
||||
"featureVersion": 12
|
||||
},
|
||||
{
|
||||
"buildVersion": 12,
|
||||
"updateVersion": 1,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/12.0.1/bellsoft-jdk12.0.1-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "12.0.1+12",
|
||||
"featureVersion": 12
|
||||
},
|
||||
{
|
||||
"buildVersion": 10,
|
||||
"updateVersion": 1,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/13.0.1+10/bellsoft-jdk13.0.1+10-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "13.0.1+10",
|
||||
"featureVersion": 13
|
||||
},
|
||||
{
|
||||
"buildVersion": 11,
|
||||
"updateVersion": 5,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.5+11/bellsoft-jdk11.0.5+11-macos-amd64.tar.gz",
|
||||
"interimVersion": 0,
|
||||
"version": "11.0.5+11",
|
||||
"featureVersion": 11
|
||||
},
|
||||
{
|
||||
"buildVersion": 11,
|
||||
"updateVersion": 5,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.5+11/bellsoft-jdk11.0.5+11-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "11.0.5+11",
|
||||
"featureVersion": 11
|
||||
},
|
||||
{
|
||||
"buildVersion": 10,
|
||||
"updateVersion": 292,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u292+10/bellsoft-jdk8u292+10-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "8u292+10",
|
||||
"featureVersion": 8
|
||||
},
|
||||
{
|
||||
"buildVersion": 11,
|
||||
"updateVersion": 222,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u222/bellsoft-jdk8u222-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "8u222+11",
|
||||
"featureVersion": 8
|
||||
},
|
||||
{
|
||||
"buildVersion": 36,
|
||||
"updateVersion": 0,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/15+36/bellsoft-jdk15+36-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "15+36",
|
||||
"featureVersion": 15
|
||||
},
|
||||
{
|
||||
"buildVersion": 10,
|
||||
"updateVersion": 7,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.7+10/bellsoft-jdk11.0.7+10-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "11.0.7+10",
|
||||
"featureVersion": 11
|
||||
},
|
||||
{
|
||||
"buildVersion": 10,
|
||||
"updateVersion": 232,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u232+10/bellsoft-jdk8u232+10-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "8u232+10",
|
||||
"featureVersion": 8
|
||||
},
|
||||
{
|
||||
"buildVersion": 8,
|
||||
"updateVersion": 2,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/15.0.2+8/bellsoft-jdk15.0.2+8-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "15.0.2+8",
|
||||
"featureVersion": 15
|
||||
},
|
||||
{
|
||||
"buildVersion": 8,
|
||||
"updateVersion": 302,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u302+8/bellsoft-jdk8u302+8-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "8u302+8",
|
||||
"featureVersion": 8
|
||||
},
|
||||
{
|
||||
"buildVersion": 12,
|
||||
"updateVersion": 192,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u192.all/bellsoft-jdk1.8.0-macos-amd64.tar.gz",
|
||||
"interimVersion": 0,
|
||||
"version": "8u192+12",
|
||||
"featureVersion": 8
|
||||
},
|
||||
{
|
||||
"buildVersion": 13,
|
||||
"updateVersion": 2,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/14.0.2+13/bellsoft-jdk14.0.2+13-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "14.0.2+13",
|
||||
"featureVersion": 14
|
||||
},
|
||||
{
|
||||
"buildVersion": 9,
|
||||
"updateVersion": 1,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/16.0.1+9/bellsoft-jdk16.0.1+9-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "16.0.1+9",
|
||||
"featureVersion": 16
|
||||
},
|
||||
{
|
||||
"buildVersion": 9,
|
||||
"updateVersion": 232,
|
||||
"patchVersion": 0,
|
||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u232/bellsoft-jdk8u232-macos-amd64.zip",
|
||||
"interimVersion": 0,
|
||||
"version": "8u232+9",
|
||||
"featureVersion": 8
|
||||
}
|
||||
]
|
196
__tests__/distributors/liberica-installer.test.ts
Normal file
196
__tests__/distributors/liberica-installer.test.ts
Normal file
@ -0,0 +1,196 @@
|
||||
import { LibericaDistributions } from '../../src/distributions/liberica/installer';
|
||||
import { ArchitectureOptions, LibericaVersion } from '../../src/distributions/liberica/models';
|
||||
import { HttpClient } from '@actions/http-client';
|
||||
|
||||
const manifestData = require('../data/liberica.json') as LibericaVersion[];
|
||||
|
||||
describe('getAvailableVersions', () => {
|
||||
let spyHttpClient: jest.SpyInstance;
|
||||
|
||||
beforeEach(() => {
|
||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||
spyHttpClient.mockReturnValue({
|
||||
statusCode: 200,
|
||||
headers: {},
|
||||
result: manifestData
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jest.resetAllMocks();
|
||||
jest.clearAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
it.each([
|
||||
[
|
||||
{ version: '11.x', architecture: 'x86', packageType: 'jdk', checkLatest: false },
|
||||
'bundle-type=jdk&bitness=32&arch=x86&build-type=all'
|
||||
],
|
||||
[
|
||||
{ version: '11-ea', architecture: 'x86', packageType: 'jdk', checkLatest: false },
|
||||
'bundle-type=jdk&bitness=32&arch=x86&build-type=ea'
|
||||
],
|
||||
[
|
||||
{ version: '16.0.2', architecture: 'x64', packageType: 'jdk', checkLatest: false },
|
||||
'bundle-type=jdk&bitness=64&arch=x86&build-type=all'
|
||||
],
|
||||
[
|
||||
{ version: '16.0.2', architecture: 'x64', packageType: 'jre', checkLatest: false },
|
||||
'bundle-type=jre&bitness=64&arch=x86&build-type=all'
|
||||
],
|
||||
[
|
||||
{ version: '8', architecture: 'armv7', packageType: 'jdk+fx', checkLatest: false },
|
||||
'bundle-type=jdk-full&bitness=32&arch=arm&build-type=all'
|
||||
],
|
||||
[
|
||||
{ version: '8', architecture: 'aarch64', packageType: 'jre+fx', checkLatest: false },
|
||||
'bundle-type=jre-full&bitness=64&arch=arm&build-type=all'
|
||||
]
|
||||
])('build correct url for %s -> %s', async (input, urlParams) => {
|
||||
const additionalParams =
|
||||
'&installation-type=archive&fields=downloadUrl%2Cversion%2CfeatureVersion%2CinterimVersion%2C' +
|
||||
'updateVersion%2CbuildVersion';
|
||||
const distribution = new LibericaDistributions(input);
|
||||
distribution['getPlatformOption'] = () => 'macos';
|
||||
const buildUrl = `https://api.bell-sw.com/v1/liberica/releases?os=macos&${urlParams}${additionalParams}`;
|
||||
|
||||
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 LibericaDistributions({
|
||||
version: '11',
|
||||
architecture: 'x64',
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
});
|
||||
const availableVersions = await distribution['getAvailableVersions']();
|
||||
expect(availableVersions).toEqual(manifestData);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getArchitectureOptions', () => {
|
||||
it.each([
|
||||
['x86', { bitness: '32', arch: 'x86' }],
|
||||
['x64', { bitness: '64', arch: 'x86' }],
|
||||
['armv7', { bitness: '32', arch: 'arm' }],
|
||||
['aarch64', { bitness: '64', arch: 'arm' }],
|
||||
['ppc64le', { bitness: '64', arch: 'ppc' }]
|
||||
] as [string, ArchitectureOptions][])('parse architecture %s -> %s', (input, expected) => {
|
||||
const distributions = new LibericaDistributions({
|
||||
architecture: input,
|
||||
checkLatest: false,
|
||||
packageType: '',
|
||||
version: ''
|
||||
});
|
||||
|
||||
expect(distributions['getArchitectureOptions']()).toEqual(expected);
|
||||
});
|
||||
|
||||
it.each(['armv6', 's390x'])('not support architecture %s', input => {
|
||||
const distributions = new LibericaDistributions({
|
||||
architecture: input,
|
||||
checkLatest: false,
|
||||
packageType: '',
|
||||
version: ''
|
||||
});
|
||||
|
||||
expect(() => distributions['getArchitectureOptions']()).toThrow(
|
||||
/Architecture '\w+' is not supported\. Supported architectures: .*/
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('findPackageForDownload', () => {
|
||||
let distribution: LibericaDistributions;
|
||||
|
||||
beforeEach(() => {
|
||||
distribution = new LibericaDistributions({
|
||||
version: '',
|
||||
architecture: 'x64',
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
});
|
||||
distribution['getAvailableVersions'] = async () => manifestData;
|
||||
});
|
||||
|
||||
it.each([
|
||||
['8', '8.0.302+8'],
|
||||
['11.x', '11.0.12+7'],
|
||||
['8.0', '8.0.302+8'],
|
||||
['11.0.x', '11.0.12+7'],
|
||||
['15', '15.0.2+10'],
|
||||
['15.0', '15.0.2+10'],
|
||||
['15.0.0', '15.0.0+36'],
|
||||
['8.0.232', '8.0.232+10'],
|
||||
['8.0.232+9', '8.0.232+9'],
|
||||
['15.0.2+8', '15.0.2+8'],
|
||||
['15.0.2+10', '15.0.2+10']
|
||||
])('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']('17')).rejects.toThrow(
|
||||
/Could not find satisfied version for semver */
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getPlatformOption', () => {
|
||||
const distributions = new LibericaDistributions({
|
||||
architecture: 'x64',
|
||||
version: '11',
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
});
|
||||
|
||||
it.each([
|
||||
['linux', 'linux'],
|
||||
['darwin', 'macos'],
|
||||
['win32', 'windows'],
|
||||
['cygwin', 'windows'],
|
||||
['sunos', 'solaris']
|
||||
])('os version %s -> %s', (input, expected) => {
|
||||
const actual = distributions['getPlatformOption'](input as NodeJS.Platform);
|
||||
|
||||
expect(actual).toEqual(expected);
|
||||
});
|
||||
|
||||
it.each(['aix', 'android', 'freebsd', 'openbsd', 'netbsd'])(
|
||||
'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 LibericaDistributions({
|
||||
architecture: 'x64',
|
||||
version: '11',
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
});
|
||||
|
||||
it.each([
|
||||
[{ featureVersion: 11, interimVersion: 0, updateVersion: 12, buildVersion: 7 }, '11.0.12+7'],
|
||||
[{ featureVersion: 11, interimVersion: 0, updateVersion: 12, buildVersion: 0 }, '11.0.12'],
|
||||
[{ featureVersion: 11, interimVersion: 0, updateVersion: 0, buildVersion: 13 }, '11.0.0+13']
|
||||
])('%s -> %s', (input, expected) => {
|
||||
const actual = distributions['convertVersionToSemver']({
|
||||
downloadUrl: '',
|
||||
version: '',
|
||||
...input
|
||||
});
|
||||
|
||||
expect(actual).toEqual(expected);
|
||||
});
|
||||
});
|
164
dist/setup/index.js
vendored
164
dist/setup/index.js
vendored
@ -38551,7 +38551,165 @@ module.exports = clean
|
||||
/* 504 */,
|
||||
/* 505 */,
|
||||
/* 506 */,
|
||||
/* 507 */,
|
||||
/* 507 */
|
||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.LibericaDistributions = void 0;
|
||||
const base_installer_1 = __webpack_require__(83);
|
||||
const semver_1 = __importDefault(__webpack_require__(876));
|
||||
const util_1 = __webpack_require__(322);
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
const tc = __importStar(__webpack_require__(139));
|
||||
const fs_1 = __importDefault(__webpack_require__(747));
|
||||
const path_1 = __importDefault(__webpack_require__(622));
|
||||
const supportedPlatform = `'linux', 'linux-musl', 'macos', 'solaris', 'windows'`;
|
||||
const supportedArchitecture = `'x86', 'x64', 'armv7', 'aarch64', 'ppc64le'`;
|
||||
class LibericaDistributions extends base_installer_1.JavaBase {
|
||||
constructor(installerOptions) {
|
||||
super('Liberica', installerOptions);
|
||||
}
|
||||
downloadTool(javaRelease) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
core.info(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`);
|
||||
const javaArchivePath = yield tc.downloadTool(javaRelease.url);
|
||||
core.info(`Extracting Java archive...`);
|
||||
const extension = util_1.getDownloadArchiveExtension();
|
||||
const extractedJavaPath = yield util_1.extractJdkFile(javaArchivePath, extension);
|
||||
const archiveName = fs_1.default.readdirSync(extractedJavaPath)[0];
|
||||
const archivePath = path_1.default.join(extractedJavaPath, archiveName);
|
||||
const javaPath = yield tc.cacheDir(archivePath, this.toolcacheFolderName, this.getToolcacheVersionName(javaRelease.version), this.architecture);
|
||||
return { version: javaRelease.version, path: javaPath };
|
||||
});
|
||||
}
|
||||
findPackageForDownload(range) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const availableVersionsRaw = yield this.getAvailableVersions();
|
||||
const availableVersions = availableVersionsRaw.map(item => ({
|
||||
url: item.downloadUrl,
|
||||
version: this.convertVersionToSemver(item)
|
||||
}));
|
||||
const satisfiedVersion = availableVersions
|
||||
.filter(item => util_1.isVersionSatisfies(range, item.version))
|
||||
.sort((a, b) => -semver_1.default.compareBuild(a.version, b.version))[0];
|
||||
if (!satisfiedVersion) {
|
||||
const availableOptions = availableVersions.map(item => item.version).join(', ');
|
||||
const availableOptionsMessage = availableOptions
|
||||
? `\nAvailable versions: ${availableOptions}`
|
||||
: '';
|
||||
throw new Error(`Could not find satisfied version for semver ${range}. ${availableOptionsMessage}`);
|
||||
}
|
||||
return satisfiedVersion;
|
||||
});
|
||||
}
|
||||
getAvailableVersions() {
|
||||
var _a;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
console.time('liberica-retrieve-available-versions');
|
||||
const url = this.prepareAvailableVersionsUrl();
|
||||
if (core.isDebug()) {
|
||||
core.debug(`Gathering available versions from '${url}'`);
|
||||
}
|
||||
const availableVersions = (_a = (yield this.http.getJson(url)).result) !== null && _a !== void 0 ? _a : [];
|
||||
if (core.isDebug()) {
|
||||
core.startGroup('Print information about available versions');
|
||||
console.timeEnd('liberica-retrieve-available-versions');
|
||||
console.log(`Available versions: [${availableVersions.length}]`);
|
||||
console.log(availableVersions.map(item => item.version));
|
||||
core.endGroup();
|
||||
}
|
||||
return availableVersions;
|
||||
});
|
||||
}
|
||||
prepareAvailableVersionsUrl() {
|
||||
const urlOptions = Object.assign(Object.assign({ os: this.getPlatformOption(), 'bundle-type': this.getBundleType() }, this.getArchitectureOptions()), { 'build-type': this.stable ? 'all' : 'ea', 'installation-type': 'archive', fields: 'downloadUrl,version,featureVersion,interimVersion,updateVersion,buildVersion' });
|
||||
const searchParams = new URLSearchParams(urlOptions).toString();
|
||||
return `https://api.bell-sw.com/v1/liberica/releases?${searchParams}`;
|
||||
}
|
||||
getBundleType() {
|
||||
const [bundleType, feature] = this.packageType.split('+');
|
||||
if (feature === null || feature === void 0 ? void 0 : feature.includes('fx')) {
|
||||
return bundleType + '-full';
|
||||
}
|
||||
return bundleType;
|
||||
}
|
||||
getArchitectureOptions() {
|
||||
switch (this.architecture) {
|
||||
case 'x86':
|
||||
return { bitness: '32', arch: 'x86' };
|
||||
case 'x64':
|
||||
return { bitness: '64', arch: 'x86' };
|
||||
case 'armv7':
|
||||
return { bitness: '32', arch: 'arm' };
|
||||
case 'aarch64':
|
||||
return { bitness: '64', arch: 'arm' };
|
||||
case 'ppc64le':
|
||||
return { bitness: '64', arch: 'ppc' };
|
||||
default:
|
||||
throw new Error(`Architecture '${this.architecture}' is not supported. Supported architectures: ${supportedArchitecture}`);
|
||||
}
|
||||
}
|
||||
getPlatformOption(platform = process.platform) {
|
||||
switch (platform) {
|
||||
case 'darwin':
|
||||
return 'macos';
|
||||
case 'win32':
|
||||
case 'cygwin':
|
||||
return 'windows';
|
||||
case 'linux':
|
||||
return 'linux';
|
||||
case 'sunos':
|
||||
return 'solaris';
|
||||
default:
|
||||
throw new Error(`Platform '${platform}' is not supported. Supported platforms: ${supportedPlatform}`);
|
||||
}
|
||||
}
|
||||
convertVersionToSemver(version) {
|
||||
let { buildVersion, featureVersion, interimVersion, updateVersion } = version;
|
||||
const mainVersion = [featureVersion, interimVersion, updateVersion].join('.');
|
||||
if (buildVersion != 0) {
|
||||
return `${mainVersion}+${buildVersion}`;
|
||||
}
|
||||
return mainVersion;
|
||||
}
|
||||
}
|
||||
exports.LibericaDistributions = LibericaDistributions;
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 508 */,
|
||||
/* 509 */,
|
||||
/* 510 */
|
||||
@ -55912,6 +56070,7 @@ const installer_1 = __webpack_require__(757);
|
||||
const installer_2 = __webpack_require__(834);
|
||||
const installer_3 = __webpack_require__(584);
|
||||
const installer_4 = __webpack_require__(439);
|
||||
const installer_5 = __webpack_require__(507);
|
||||
var JavaDistribution;
|
||||
(function (JavaDistribution) {
|
||||
JavaDistribution["Adopt"] = "adopt";
|
||||
@ -55919,6 +56078,7 @@ var JavaDistribution;
|
||||
JavaDistribution["AdoptOpenJ9"] = "adopt-openj9";
|
||||
JavaDistribution["Temurin"] = "temurin";
|
||||
JavaDistribution["Zulu"] = "zulu";
|
||||
JavaDistribution["Liberica"] = "liberica";
|
||||
JavaDistribution["JdkFile"] = "jdkfile";
|
||||
})(JavaDistribution || (JavaDistribution = {}));
|
||||
function getJavaDistribution(distributionName, installerOptions, jdkFile) {
|
||||
@ -55934,6 +56094,8 @@ function getJavaDistribution(distributionName, installerOptions, jdkFile) {
|
||||
return new installer_4.TemurinDistribution(installerOptions, installer_4.TemurinImplementation.Hotspot);
|
||||
case JavaDistribution.Zulu:
|
||||
return new installer_2.ZuluDistribution(installerOptions);
|
||||
case JavaDistribution.Liberica:
|
||||
return new installer_5.LibericaDistributions(installerOptions);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
@ -53,6 +53,18 @@ steps:
|
||||
- run: java -cp java HelloWorldApp
|
||||
```
|
||||
|
||||
### Liberica
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-java@v2
|
||||
with:
|
||||
distribution: 'liberica'
|
||||
java-version: '11'
|
||||
java-package: jdk # optional (jdk, jre, jdk+fx or jre+fx) - defaults to jdk
|
||||
- run: java -cp java HelloWorldApp
|
||||
```
|
||||
|
||||
## Installing custom Java package type
|
||||
```yaml
|
||||
steps:
|
||||
|
@ -4,6 +4,7 @@ import { LocalDistribution } from './local/installer';
|
||||
import { ZuluDistribution } from './zulu/installer';
|
||||
import { AdoptDistribution, AdoptImplementation } from './adopt/installer';
|
||||
import { TemurinDistribution, TemurinImplementation } from './temurin/installer';
|
||||
import { LibericaDistributions } from './liberica/installer';
|
||||
|
||||
enum JavaDistribution {
|
||||
Adopt = 'adopt',
|
||||
@ -11,6 +12,7 @@ enum JavaDistribution {
|
||||
AdoptOpenJ9 = 'adopt-openj9',
|
||||
Temurin = 'temurin',
|
||||
Zulu = 'zulu',
|
||||
Liberica = 'liberica',
|
||||
JdkFile = 'jdkfile'
|
||||
}
|
||||
|
||||
@ -31,6 +33,8 @@ export function getJavaDistribution(
|
||||
return new TemurinDistribution(installerOptions, TemurinImplementation.Hotspot);
|
||||
case JavaDistribution.Zulu:
|
||||
return new ZuluDistribution(installerOptions);
|
||||
case JavaDistribution.Liberica:
|
||||
return new LibericaDistributions(installerOptions);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
157
src/distributions/liberica/installer.ts
Normal file
157
src/distributions/liberica/installer.ts
Normal file
@ -0,0 +1,157 @@
|
||||
import { JavaBase } from '../base-installer';
|
||||
import { JavaDownloadRelease, JavaInstallerOptions, JavaInstallerResults } from '../base-models';
|
||||
import semver from 'semver';
|
||||
import { extractJdkFile, getDownloadArchiveExtension, isVersionSatisfies } from '../../util';
|
||||
import * as core from '@actions/core';
|
||||
import { ArchitectureOptions, LibericaVersion, OsVersions } from './models';
|
||||
import * as tc from '@actions/tool-cache';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
const supportedPlatform = `'linux', 'linux-musl', 'macos', 'solaris', 'windows'`;
|
||||
|
||||
const supportedArchitecture = `'x86', 'x64', 'armv7', 'aarch64', 'ppc64le'`;
|
||||
|
||||
export class LibericaDistributions extends JavaBase {
|
||||
constructor(installerOptions: JavaInstallerOptions) {
|
||||
super('Liberica', installerOptions);
|
||||
}
|
||||
|
||||
protected async downloadTool(javaRelease: JavaDownloadRelease): Promise<JavaInstallerResults> {
|
||||
core.info(
|
||||
`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`
|
||||
);
|
||||
const javaArchivePath = await tc.downloadTool(javaRelease.url);
|
||||
|
||||
core.info(`Extracting Java archive...`);
|
||||
const extension = getDownloadArchiveExtension();
|
||||
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 => ({
|
||||
url: item.downloadUrl,
|
||||
version: this.convertVersionToSemver(item)
|
||||
}));
|
||||
|
||||
const satisfiedVersion = availableVersions
|
||||
.filter(item => isVersionSatisfies(range, item.version))
|
||||
.sort((a, b) => -semver.compareBuild(a.version, b.version))[0];
|
||||
|
||||
if (!satisfiedVersion) {
|
||||
const availableOptions = availableVersions.map(item => item.version).join(', ');
|
||||
const availableOptionsMessage = availableOptions
|
||||
? `\nAvailable versions: ${availableOptions}`
|
||||
: '';
|
||||
throw new Error(
|
||||
`Could not find satisfied version for semver ${range}. ${availableOptionsMessage}`
|
||||
);
|
||||
}
|
||||
|
||||
return satisfiedVersion;
|
||||
}
|
||||
|
||||
private async getAvailableVersions(): Promise<LibericaVersion[]> {
|
||||
console.time('liberica-retrieve-available-versions');
|
||||
const url = this.prepareAvailableVersionsUrl();
|
||||
|
||||
if (core.isDebug()) {
|
||||
core.debug(`Gathering available versions from '${url}'`);
|
||||
}
|
||||
|
||||
const availableVersions = (await this.http.getJson<LibericaVersion[]>(url)).result ?? [];
|
||||
|
||||
if (core.isDebug()) {
|
||||
core.startGroup('Print information about available versions');
|
||||
console.timeEnd('liberica-retrieve-available-versions');
|
||||
console.log(`Available versions: [${availableVersions.length}]`);
|
||||
console.log(availableVersions.map(item => item.version));
|
||||
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,featureVersion,interimVersion,updateVersion,buildVersion'
|
||||
};
|
||||
|
||||
const searchParams = new URLSearchParams(urlOptions).toString();
|
||||
|
||||
return `https://api.bell-sw.com/v1/liberica/releases?${searchParams}`;
|
||||
}
|
||||
|
||||
private getBundleType(): string {
|
||||
const [bundleType, feature] = this.packageType.split('+');
|
||||
if (feature?.includes('fx')) {
|
||||
return bundleType + '-full';
|
||||
}
|
||||
return bundleType;
|
||||
}
|
||||
|
||||
private getArchitectureOptions(): ArchitectureOptions {
|
||||
switch (this.architecture) {
|
||||
case 'x86':
|
||||
return { bitness: '32', arch: 'x86' };
|
||||
case 'x64':
|
||||
return { bitness: '64', arch: 'x86' };
|
||||
case 'armv7':
|
||||
return { bitness: '32', arch: 'arm' };
|
||||
case 'aarch64':
|
||||
return { bitness: '64', arch: 'arm' };
|
||||
case 'ppc64le':
|
||||
return { bitness: '64', arch: 'ppc' };
|
||||
default:
|
||||
throw new Error(
|
||||
`Architecture '${this.architecture}' is not supported. Supported architectures: ${supportedArchitecture}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private getPlatformOption(platform: NodeJS.Platform = process.platform): OsVersions {
|
||||
switch (platform) {
|
||||
case 'darwin':
|
||||
return 'macos';
|
||||
case 'win32':
|
||||
case 'cygwin':
|
||||
return 'windows';
|
||||
case 'linux':
|
||||
return 'linux';
|
||||
case 'sunos':
|
||||
return 'solaris';
|
||||
default:
|
||||
throw new Error(
|
||||
`Platform '${platform}' is not supported. Supported platforms: ${supportedPlatform}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private convertVersionToSemver(version: LibericaVersion): string {
|
||||
let { buildVersion, featureVersion, interimVersion, updateVersion } = version;
|
||||
const mainVersion = [featureVersion, interimVersion, updateVersion].join('.');
|
||||
if (buildVersion != 0) {
|
||||
return `${mainVersion}+${buildVersion}`;
|
||||
}
|
||||
return mainVersion;
|
||||
}
|
||||
}
|
20
src/distributions/liberica/models.ts
Normal file
20
src/distributions/liberica/models.ts
Normal file
@ -0,0 +1,20 @@
|
||||
// Models from https://api.bell-sw.com/api.html
|
||||
|
||||
export type Bitness = '32' | '64';
|
||||
export type ArchType = 'arm' | 'ppc' | 'sparc' | 'x86';
|
||||
|
||||
export type OsVersions = 'linux' | 'linux-musl' | 'macos' | 'solaris' | 'windows';
|
||||
|
||||
export interface ArchitectureOptions {
|
||||
bitness: Bitness;
|
||||
arch: ArchType;
|
||||
}
|
||||
|
||||
export interface LibericaVersion {
|
||||
downloadUrl: string;
|
||||
version: string;
|
||||
featureVersion: number;
|
||||
interimVersion: number;
|
||||
updateVersion: number;
|
||||
buildVersion: number;
|
||||
}
|
Loading…
Reference in New Issue
Block a user