Change bundle type processing for correct support JavaFX in liberica

This commit is contained in:
Daniil Razorenov 2021-11-10 12:56:55 +03:00
parent 221194fabc
commit 4b51db1630
3 changed files with 23 additions and 13 deletions

View file

@ -25,27 +25,27 @@ describe('getAvailableVersions', () => {
it.each([ it.each([
[ [
{ version: '11.x', architecture: 'x86', packageType: 'jdk', checkLatest: false }, { version: '11.x', architecture: 'x86', packageType: 'jdk', checkLatest: false },
'bundle-type=jdk&fx=false&bitness=32&arch=x86&build-type=all' 'bundle-type=jdk&bitness=32&arch=x86&build-type=all'
], ],
[ [
{ version: '11-ea', architecture: 'x86', packageType: 'jdk', checkLatest: false }, { version: '11-ea', architecture: 'x86', packageType: 'jdk', checkLatest: false },
'bundle-type=jdk&fx=false&bitness=32&arch=x86&build-type=ea' 'bundle-type=jdk&bitness=32&arch=x86&build-type=ea'
], ],
[ [
{ version: '16.0.2', architecture: 'x64', packageType: 'jdk', checkLatest: false }, { version: '16.0.2', architecture: 'x64', packageType: 'jdk', checkLatest: false },
'bundle-type=jdk&fx=false&bitness=64&arch=x86&build-type=all' 'bundle-type=jdk&bitness=64&arch=x86&build-type=all'
], ],
[ [
{ version: '16.0.2', architecture: 'x64', packageType: 'jre', checkLatest: false }, { version: '16.0.2', architecture: 'x64', packageType: 'jre', checkLatest: false },
'bundle-type=jre&fx=false&bitness=64&arch=x86&build-type=all' 'bundle-type=jre&bitness=64&arch=x86&build-type=all'
], ],
[ [
{ version: '8', architecture: 'armv7', packageType: 'jdk+fx', checkLatest: false }, { version: '8', architecture: 'armv7', packageType: 'jdk+fx', checkLatest: false },
'bundle-type=jdk&fx=true&bitness=32&arch=arm&build-type=all' 'bundle-type=jdk-full&bitness=32&arch=arm&build-type=all'
], ],
[ [
{ version: '8', architecture: 'aarch64', packageType: 'jre+fx', checkLatest: false }, { version: '8', architecture: 'aarch64', packageType: 'jre+fx', checkLatest: false },
'bundle-type=jre&fx=true&bitness=64&arch=arm&build-type=all' 'bundle-type=jre-full&bitness=64&arch=arm&build-type=all'
] ]
])('build correct url for %s -> %s', async (input, urlParams) => { ])('build correct url for %s -> %s', async (input, urlParams) => {
const additionalParams = const additionalParams =

11
dist/setup/index.js vendored
View file

@ -38655,12 +38655,17 @@ class LibericaDistributions extends base_installer_1.JavaBase {
}); });
} }
prepareAvailableVersionsUrl() { prepareAvailableVersionsUrl() {
var _a, _b; 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 [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,featureVersion,interimVersion,updateVersion,buildVersion' });
const searchParams = new URLSearchParams(urlOptions).toString(); const searchParams = new URLSearchParams(urlOptions).toString();
return `https://api.bell-sw.com/v1/liberica/releases?${searchParams}`; 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() { getArchitectureOptions() {
switch (this.architecture) { switch (this.architecture) {
case 'x86': case 'x86':

View file

@ -87,12 +87,9 @@ export class LibericaDistributions extends JavaBase {
} }
private prepareAvailableVersionsUrl() { private prepareAvailableVersionsUrl() {
const [bundleType, feature] = this.packageType.split('+');
const urlOptions = { const urlOptions = {
os: this.getPlatformOption(), os: this.getPlatformOption(),
'bundle-type': bundleType, 'bundle-type': this.getBundleType(),
fx: feature?.includes('fx')?.toString() ?? 'false',
...this.getArchitectureOptions(), ...this.getArchitectureOptions(),
'build-type': this.stable ? 'all' : 'ea', 'build-type': this.stable ? 'all' : 'ea',
'installation-type': 'archive', 'installation-type': 'archive',
@ -104,6 +101,14 @@ export class LibericaDistributions extends JavaBase {
return `https://api.bell-sw.com/v1/liberica/releases?${searchParams}`; 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 { private getArchitectureOptions(): ArchitectureOptions {
switch (this.architecture) { switch (this.architecture) {
case 'x86': case 'x86':