Skip to content

Commit 30261a8

Browse files
petermzfniephaus
authored andcommitted
Use java-package input instead of version
1 parent 6670574 commit 30261a8

File tree

9 files changed

+47
-35
lines changed

9 files changed

+47
-35
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,12 @@ jobs:
245245
if: runner.os == 'Windows'
246246
test-liberica:
247247
needs: test
248-
name: Liberica (${{ matrix.java-version }}, '${{ matrix.version }}', ${{ matrix.os }})
248+
name: Liberica (${{ matrix.java-version }}, '${{ matrix.java-package }}', ${{ matrix.os }})
249249
runs-on: ${{ matrix.os }}
250250
strategy:
251251
matrix:
252252
java-version: ['17', '21.0.2']
253-
version: ['', 'std', 'full']
253+
java-package: ['', 'jdk', 'jdk+fx']
254254
os: [ubuntu-latest, macos-latest, windows-latest]
255255
steps:
256256
- uses: actions/checkout@v4
@@ -259,7 +259,7 @@ jobs:
259259
with:
260260
distribution: liberica
261261
java-version: ${{ matrix.java-version }}
262-
version: ${{ matrix.version }}
262+
java-package: ${{ matrix.java-package }}
263263
github-token: ${{ secrets.GITHUB_TOKEN }}
264264
- name: Check environment
265265
run: |

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ can be replaced with:
189189
|-----------------|:--------:|-------------|
190190
| `java-version`<br>*(required)* | n/a | Java version <ul><li>major versions: `'21'`, `'17'`, `'11'`, `'8'`</li><li>specific versions: `'21.0.2'`, `'17.0.7'`</li><li>early access (EA) builds: `'22-ea'` *(requires `distribution: 'graalvm'`)*</li><li>latest EA build: `'latest-ea'` *(requires `distribution: 'graalvm'`)*</li><li>dev builds: `'dev'`</li></ul> |
191191
| `distribution` | `'graalvm'` | GraalVM distribution <ul><li>Oracle GraalVM: `'graalvm'`</li><li>GraalVM Community Edition: `'graalvm-community'`</li><li>Mandrel: `'mandrel'`</li><li>Liberica: `'liberica'`</li></ul> |
192+
| `java-package` | `'jdk'` | The package type (`'jdk'` or `'jdk+fx'`). Currently applies to Liberica only. |
192193
| `github-token` | `'${{ github.token }}'` | Token for communication with the GitHub API. Please set this to `${{ secrets.GITHUB_TOKEN }}` (see [templates](#templates)) to allow the action to authenticate with the GitHub API, which helps reduce rate-limiting issues. |
193194
| `set-java-home` | `'true'` | If set to `'true'`, instructs the action to set `$JAVA_HOME` to the path of the GraalVM installation. Overrides any previous action or command that sets `$JAVA_HOME`. |
194195
| `cache` | `''` | Name of the build platform to cache dependencies. Turned off by default (`''`). It can also be `'maven'`, `'gradle'`, or `'sbt'` and works the same way as described in [actions/setup-java][setup-java-caching]. |
@@ -197,7 +198,7 @@ can be replaced with:
197198
| `native-image-job-reports` *) | `'false'` | If set to `'true'`, post a job summary containing a Native Image build report. |
198199
| `native-image-pr-reports` *) | `'false'` | If set to `'true'`, post a comment containing a Native Image build report on pull requests. Requires `write` permissions for the [`pull-requests` scope][gha-permissions]. |
199200
| `components` | `''` | Comma-separated list of GraalVM components (e.g., `native-image` or `ruby,nodejs`) that will be installed by the [GraalVM Updater][gu]. |
200-
| `version` | `''` | `X.Y.Z` (e.g., `22.3.0`) for a specific [GraalVM release][releases] up to `22.3.2`<br>`mandrel-X.Y.Z.W` or `X.Y.Z.W-Final` (e.g., `mandrel-21.3.0.0-Final` or `21.3.0.0-Final`) for a specific [Mandrel release][mandrel-releases],<br>`mandrel-latest` or `latest` for the latest Mandrel stable release, <br>`std` (default) or `full` for Liberica|
201+
| `version` | `''` | `X.Y.Z` (e.g., `22.3.0`) for a specific [GraalVM release][releases] up to `22.3.2`<br>`mandrel-X.Y.Z.W` or `X.Y.Z.W-Final` (e.g., `mandrel-21.3.0.0-Final` or `21.3.0.0-Final`) for a specific [Mandrel release][mandrel-releases],<br>`mandrel-latest` or `latest` for the latest Mandrel stable release. |
201202
| `gds-token` | `''` | Download token for the GraalVM Download Service. If a non-empty token is provided, the action will set up GraalVM Enterprise Edition (see [GraalVM EE template](#template-for-graalvm-enterprise-edition)). |
202203

203204
**) Make sure that Native Image is used only once per build job. Otherwise, the report is only generated for the last Native Image build.*

__tests__/liberica.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ test('find latest JDK version', async () => {
3737

3838
test('find asset URL', async () => {
3939
await expectURL('11.0.22+12', '', 'bellsoft-liberica-vm-openjdk11.0.22')
40-
await expectURL('17.0.10+13', 'std', 'bellsoft-liberica-vm-openjdk17.0.10')
40+
await expectURL('17.0.10+13', 'jdk', 'bellsoft-liberica-vm-openjdk17.0.10')
4141

4242
if (!c.IS_LINUX) {
43-
// This check can fail on Linux because there's no `full` version for aarch64 and/or musl
43+
// This check can fail on Linux because there's no `jdk+fx` package for aarch64 and/or musl
4444
await expectURL(
4545
'21.0.2+14',
46-
'full',
46+
'jdk+fx',
4747
'bellsoft-liberica-vm-full-openjdk21.0.2'
4848
)
4949
}
@@ -127,10 +127,10 @@ async function expectLatestToFail(pattern: string) {
127127

128128
async function expectURL(
129129
javaVersion: string,
130-
version: string,
130+
javaPackage: string,
131131
expectedPrefix: string
132132
) {
133-
const url = await liberica.findLibericaURL(javaVersion, version)
133+
const url = await liberica.findLibericaURL(javaVersion, javaPackage)
134134
expect(url).toBeDefined()
135135
const parts = url.split('/')
136136
const file = parts[parts.length - 1]

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ inputs:
88
java-version:
99
required: true
1010
description: 'Java version. See examples of supported syntax in the README file.'
11+
java-package:
12+
description: 'The package type (jdk or jdk+fx). Currently applies to Liberica only.'
13+
required: false
14+
default: 'jdk'
1115
distribution:
1216
description: 'GraalVM distribution. See the list of available distributions in the README file.'
1317
required: false

dist/cleanup/index.js

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/main/index.js

Lines changed: 15 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as otypes from '@octokit/types'
33
export const INPUT_VERSION = 'version'
44
export const INPUT_GDS_TOKEN = 'gds-token'
55
export const INPUT_JAVA_VERSION = 'java-version'
6+
export const INPUT_JAVA_PACKAGE = 'java-package'
67
export const INPUT_DISTRIBUTION = 'distribution'
78
export const INPUT_COMPONENTS = 'components'
89
export const INPUT_GITHUB_TOKEN = 'github-token'

src/liberica.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ const LIBERICA_VM_PREFIX = 'bellsoft-liberica-vm-'
1515

1616
export async function setUpLiberica(
1717
javaVersion: string,
18-
version: string
18+
javaPackage: string
1919
): Promise<string> {
2020
const resolvedJavaVersion = await findLatestLibericaJavaVersion(javaVersion)
21-
const downloadUrl = await findLibericaURL(resolvedJavaVersion, version)
22-
const toolName = determineToolName(javaVersion, version)
21+
const downloadUrl = await findLibericaURL(resolvedJavaVersion, javaPackage)
22+
const toolName = determineToolName(javaVersion, javaPackage)
2323
return downloadExtractAndCacheJDK(
2424
async () => downloadTool(downloadUrl),
2525
toolName,
@@ -61,16 +61,16 @@ export async function findLatestLibericaJavaVersion(
6161

6262
export async function findLibericaURL(
6363
javaVersion: string,
64-
version: string
64+
javaPackage: string
6565
): Promise<string> {
6666
const release = await getTaggedRelease(
6767
LIBERICA_GH_USER,
6868
LIBERICA_RELEASES_REPO,
6969
LIBERICA_JDK_TAG_PREFIX + javaVersion
7070
)
7171
const platform = determinePlatformPart()
72-
const assetPrefix = `${LIBERICA_VM_PREFIX}${determineToolVersionPart(
73-
version
72+
const assetPrefix = `${LIBERICA_VM_PREFIX}${determineVariantPart(
73+
javaPackage
7474
)}openjdk${javaVersion}`
7575
const assetSuffix = `-${platform}${c.GRAALVM_FILE_EXTENSION}`
7676
for (const asset of release.assets) {
@@ -82,18 +82,18 @@ export async function findLibericaURL(
8282
}
8383
}
8484
throw new Error(
85-
`Unable to find asset for java-version: ${javaVersion}, version: ${version}, platform: ${platform}`
85+
`Unable to find asset for java-version: ${javaVersion}, java-package: ${javaPackage}, platform: ${platform}`
8686
)
8787
}
8888

89-
function determineToolVersionPart(version: string) {
90-
return version === 'std' || version === '' ? '' : `${version}-`
89+
function determineToolName(javaVersion: string, javaPackage: string) {
90+
const variant = determineVariantPart(javaPackage)
91+
const platform = determinePlatformPart()
92+
return `${LIBERICA_VM_PREFIX}${variant}openjdk${javaVersion}-${platform}`
9193
}
9294

93-
function determineToolName(javaVersion: string, version: string) {
94-
return `${LIBERICA_VM_PREFIX}${determineToolVersionPart(
95-
version
96-
)}openjdk${javaVersion}-${determinePlatformPart()}`
95+
function determineVariantPart(javaPackage: string) {
96+
return javaPackage !== null && javaPackage.includes('+fx') ? 'full-' : ''
9797
}
9898

9999
function determinePlatformPart() {

src/main.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {exec} from '@actions/exec'
1818
async function run(): Promise<void> {
1919
try {
2020
const javaVersion = core.getInput(c.INPUT_JAVA_VERSION, {required: true})
21+
const javaPackage = core.getInput(c.INPUT_JAVA_PACKAGE)
2122
const distribution = core.getInput(c.INPUT_DISTRIBUTION)
2223
const graalVMVersion = core.getInput(c.INPUT_VERSION)
2324
const gdsToken = core.getInput(c.INPUT_GDS_TOKEN)
@@ -67,7 +68,7 @@ async function run(): Promise<void> {
6768
graalVMHome = await setUpMandrel(graalVMVersion, javaVersion)
6869
break
6970
case c.DISTRIBUTION_LIBERICA:
70-
graalVMHome = await setUpLiberica(javaVersion, graalVMVersion)
71+
graalVMHome = await setUpLiberica(javaVersion, javaPackage)
7172
break
7273
case '':
7374
if (javaVersion === c.VERSION_DEV) {

0 commit comments

Comments
 (0)