From 5b26cf56c2a25754bc50928b0245e8ec4577a7a1 Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Wed, 24 Mar 2021 20:30:55 +0300 Subject: [PATCH] more fixes --- .github/workflows/e2e-versions.yml | 20 ++++++++++++++++++-- dist/setup/index.js | 20 ++++++++++++++------ src/distributions/base-installer.ts | 24 ++++++++++++++++-------- 3 files changed, 48 insertions(+), 16 deletions(-) diff --git a/.github/workflows/e2e-versions.yml b/.github/workflows/e2e-versions.yml index d7133eda..ec5d5275 100644 --- a/.github/workflows/e2e-versions.yml +++ b/.github/workflows/e2e-versions.yml @@ -81,7 +81,6 @@ jobs: setup-java-ea-versions-zulu: name: zulu ${{ matrix.version }} (jdk-x64) - ${{ matrix.os }} - needs: setup-java-major-minor-versions runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -100,10 +99,18 @@ jobs: - name: Verify Java run: bash __tests__/verify-java.sh "${{ matrix.version }}" "${{ steps.setup-java.outputs.path }}" shell: bash + - name: setup-java + uses: ./ + id: setup-java2 + with: + java-version: ${{ matrix.version }} + distribution: zulu + - name: Verify Java + run: bash __tests__/verify-java.sh "${{ matrix.version }}" "${{ steps.setup-java2.outputs.path }}" + shell: bash setup-java-ea-versions-adopt: name: adopt ${{ matrix.version }} (jdk-x64) - ${{ matrix.os }} - needs: setup-java-major-minor-versions runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -122,6 +129,15 @@ jobs: - name: Verify Java run: bash __tests__/verify-java.sh "${{ matrix.version }}" "${{ steps.setup-java.outputs.path }}" shell: bash + - name: setup-java + uses: ./ + id: setup-java2 + with: + java-version: ${{ matrix.version }} + distribution: zulu + - name: Verify Java + run: bash __tests__/verify-java.sh "${{ matrix.version }}" "${{ steps.setup-java2.outputs.path }}" + shell: bash setup-java-custom-package-type: name: ${{ matrix.distribution }} ${{ matrix.version }} (${{ matrix.java-package }}-x64) - ${{ matrix.os }} diff --git a/dist/setup/index.js b/dist/setup/index.js index 33ed805f..72f5db1e 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -3933,8 +3933,12 @@ class JavaBase { } getToolcacheVersionName(version) { if (!this.stable) { - const cleanVersion = semver_1.default.clean(version); - return `${cleanVersion}-ea`; + if (version.includes('+')) { + return version.replace('+', '-ea.'); + } + else { + return `${version}-ea`; + } } return version.replace('+', '-'); } @@ -3943,13 +3947,17 @@ class JavaBase { // if *-ea is provided, take only ea versions from toolcache, otherwise - only stable versions const availableVersions = tc .findAllVersions(this.toolcacheFolderName, this.architecture) - .filter(item => item.endsWith('-ea') === !this.stable) .map(item => { return { - version: item.replace(/-ea$/, '').replace('-', '+'), - path: util_1.getToolcachePath(this.toolcacheFolderName, item, this.architecture) + version: item + .replace('-ea.', '+') + .replace(/-ea$/, '') + .replace('-', '+'), + path: util_1.getToolcachePath(this.toolcacheFolderName, item, this.architecture), + stable: item.includes('-ea') }; - }); + }) + .filter(item => item.stable === this.stable); console.log(`availableVersions = ${JSON.stringify(availableVersions)}`); const satisfiedVersions = availableVersions .filter(item => util_1.isVersionSatisfies(this.version, item.version)) diff --git a/src/distributions/base-installer.ts b/src/distributions/base-installer.ts index 4b4f7eec..8d823b76 100644 --- a/src/distributions/base-installer.ts +++ b/src/distributions/base-installer.ts @@ -60,9 +60,13 @@ export abstract class JavaBase { protected getToolcacheVersionName(version: string): string { if (!this.stable) { - const cleanVersion = semver.clean(version); - return `${cleanVersion}-ea`; + if (version.includes('+')) { + return version.replace('+', '-ea.'); + } else { + return `${version}-ea`; + } } + return version.replace('+', '-'); } @@ -71,13 +75,17 @@ export abstract class JavaBase { // if *-ea is provided, take only ea versions from toolcache, otherwise - only stable versions const availableVersions = tc .findAllVersions(this.toolcacheFolderName, this.architecture) - .filter(item => item.endsWith('-ea') === !this.stable) .map(item => { return { - version: item.replace(/-ea$/, '').replace('-', '+'), - path: getToolcachePath(this.toolcacheFolderName, item, this.architecture) - } as JavaInstallerResults; - }); + version: item + .replace('-ea.', '+') + .replace(/-ea$/, '') + .replace('-', '+'), + path: getToolcachePath(this.toolcacheFolderName, item, this.architecture), + stable: item.includes('-ea') + }; + }) + .filter(item => item.stable === this.stable); console.log(`availableVersions = ${JSON.stringify(availableVersions)}`); @@ -93,7 +101,7 @@ export abstract class JavaBase { console.log(`satisfiedVersions = ${JSON.stringify(satisfiedVersions)}`); - return satisfiedVersions[0]; + return satisfiedVersions[0] as JavaInstallerResults; } protected normalizeVersion(version: string) {