From 1eb0ec886ac730c56f8b73d14851f3a1ee2cd0a0 Mon Sep 17 00:00:00 2001 From: Daniil Razorenov Date: Wed, 10 Nov 2021 11:18:26 +0300 Subject: [PATCH] fix URL for download available versions --- __tests__/distributors/liberica-installer.test.ts | 8 +++++--- dist/setup/index.js | 10 ++++------ src/distributions/liberica/installer.ts | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/__tests__/distributors/liberica-installer.test.ts b/__tests__/distributors/liberica-installer.test.ts index 272d8745..0b209af9 100644 --- a/__tests__/distributors/liberica-installer.test.ts +++ b/__tests__/distributors/liberica-installer.test.ts @@ -48,7 +48,9 @@ describe('getAvailableVersions', () => { 'bundle-type=jre&fx=true&bitness=64&arch=arm&build-type=all' ] ])('build correct url for %s -> %s', async (input, urlParams) => { - const additionalParams = '&installation-type=archive&fields=downloadUrl%2Cversion'; + 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}`; @@ -98,7 +100,7 @@ describe('getArchitectureOptions', () => { }); expect(() => distributions['getArchitectureOptions']()).toThrow( - /Architecture '\w+' not supported\. Supported architecture: .*/ + /Architecture '\w+' is not supported\. Supported architectures: .*/ ); }); }); @@ -164,7 +166,7 @@ describe('getPlatformOption', () => { 'not support os version %s', input => { expect(() => distributions['getPlatformOption'](input as NodeJS.Platform)).toThrow( - /Platform '\w+' not supported\. Supported platform: .+/ + /Platform '\w+' is not supported\. Supported platforms: .+/ ); } ); diff --git a/dist/setup/index.js b/dist/setup/index.js index 9912bca4..07fa7f29 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -38598,7 +38598,6 @@ 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'`; -const first = () => true; class LibericaDistributions extends base_installer_1.JavaBase { constructor(installerOptions) { super('Liberica', installerOptions); @@ -38624,8 +38623,7 @@ class LibericaDistributions extends base_installer_1.JavaBase { })); const satisfiedVersion = availableVersions .filter(item => util_1.isVersionSatisfies(range, item.version)) - .sort((a, b) => -semver_1.default.compareBuild(a.version, b.version)) - .find(first); + .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 @@ -38658,7 +38656,7 @@ class LibericaDistributions extends base_installer_1.JavaBase { prepareAvailableVersionsUrl() { var _a, _b; const [bundleType, feature] = this.packageType.split('+'); - const urlOptions = Object.assign(Object.assign({ os: this.getPlatformOption(), 'bundle-type': bundleType, fx: (_b = (_a = feature === null || feature === void 0 ? void 0 : feature.includes('fx')) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : 'false' }, this.getArchitectureOptions()), { 'build-type': this.stable ? 'all' : 'ea', 'installation-type': 'archive', fields: 'downloadUrl,version' }); + const urlOptions = Object.assign(Object.assign({ os: this.getPlatformOption(), 'bundle-type': bundleType, fx: (_b = (_a = feature === null || feature === void 0 ? void 0 : feature.includes('fx')) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : 'false' }, 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}`; } @@ -38675,7 +38673,7 @@ class LibericaDistributions extends base_installer_1.JavaBase { case 'ppc64le': return { bitness: '64', arch: 'ppc' }; default: - throw new Error(`Architecture '${this.architecture}' not supported. Supported architecture: ${supportedArchitecture}`); + throw new Error(`Architecture '${this.architecture}' is not supported. Supported architectures: ${supportedArchitecture}`); } } getPlatformOption(platform = process.platform) { @@ -38690,7 +38688,7 @@ class LibericaDistributions extends base_installer_1.JavaBase { case 'sunos': return 'solaris'; default: - throw new Error(`Platform '${platform}' not supported. Supported platform: ${supportedPlatform}`); + throw new Error(`Platform '${platform}' is not supported. Supported platforms: ${supportedPlatform}`); } } convertVersionToSemver(version) { diff --git a/src/distributions/liberica/installer.ts b/src/distributions/liberica/installer.ts index 6c147f95..c54e0974 100644 --- a/src/distributions/liberica/installer.ts +++ b/src/distributions/liberica/installer.ts @@ -95,7 +95,7 @@ export class LibericaDistributions extends JavaBase { ...this.getArchitectureOptions(), 'build-type': this.stable ? 'all' : 'ea', 'installation-type': 'archive', - fields: 'downloadUrl,version' + fields: 'downloadUrl,version,featureVersion,interimVersion,updateVersion,buildVersion' }; const searchParams = new URLSearchParams(urlOptions).toString();