mirror of
https://github.com/actions/setup-java.git
synced 2026-04-07 15:38:53 +00:00
Minimize diff: remove unnecessary helper methods and inline logic
Agent-Logs-Url: https://github.com/nbauma109/setup-java/sessions/a37adb56-8276-47ac-bd00-5e054fab3f61 Co-authored-by: nbauma109 <9403560+nbauma109@users.noreply.github.com>
This commit is contained in:
parent
3721876b1b
commit
a7b700f304
61
dist/setup/index.js
vendored
61
dist/setup/index.js
vendored
@ -114733,7 +114733,7 @@ class ZuluDistribution extends base_installer_1.JavaBase {
|
|||||||
const satisfiedVersions = availableVersions
|
const satisfiedVersions = availableVersions
|
||||||
.filter(item => (0, util_1.isVersionSatisfies)(version, item.version))
|
.filter(item => (0, util_1.isVersionSatisfies)(version, item.version))
|
||||||
.sort((a, b) => {
|
.sort((a, b) => {
|
||||||
// Azul provides two versions: java_version and distro_version
|
// Azul provides two versions: jdk_version and azul_version
|
||||||
// we should sort by both fields by descending
|
// we should sort by both fields by descending
|
||||||
return (-semver_1.default.compareBuild(a.version, b.version) ||
|
return (-semver_1.default.compareBuild(a.version, b.version) ||
|
||||||
-semver_1.default.compareBuild(a.zuluVersion, b.zuluVersion));
|
-semver_1.default.compareBuild(a.zuluVersion, b.zuluVersion));
|
||||||
@ -114786,20 +114786,24 @@ class ZuluDistribution extends base_installer_1.JavaBase {
|
|||||||
if (core.isDebug()) {
|
if (core.isDebug()) {
|
||||||
console.time('Retrieving available versions for Zulu took'); // eslint-disable-line no-console
|
console.time('Retrieving available versions for Zulu took'); // eslint-disable-line no-console
|
||||||
}
|
}
|
||||||
// Map old API parameters to new metadata API parameters
|
|
||||||
const osParam = this.getOsParam(platform);
|
|
||||||
const archiveType = this.getArchiveType(extension);
|
|
||||||
const archParam = this.getArchParam(arch, hw_bitness);
|
|
||||||
// Fetch all pages to avoid missing packages when there are > 100 results
|
// Fetch all pages to avoid missing packages when there are > 100 results
|
||||||
let allVersions = [];
|
let allVersions = [];
|
||||||
let page = 1;
|
let page = 1;
|
||||||
const pageSize = 100;
|
const pageSize = 100;
|
||||||
let hasMore = true;
|
let hasMore = true;
|
||||||
while (hasMore) {
|
while (hasMore) {
|
||||||
|
// Map architecture for new metadata API (x86+64bit -> x64, arm+64bit -> aarch64, etc.)
|
||||||
|
let archParam = arch;
|
||||||
|
if (arch === 'x86' && hw_bitness === '64') {
|
||||||
|
archParam = 'x64';
|
||||||
|
}
|
||||||
|
else if (arch === 'arm' && hw_bitness === '64') {
|
||||||
|
archParam = 'aarch64';
|
||||||
|
}
|
||||||
const requestArguments = [
|
const requestArguments = [
|
||||||
`os=${osParam}`,
|
`os=${platform === 'linux' ? 'linux-glibc' : platform}`,
|
||||||
`arch=${archParam}`,
|
`arch=${archParam}`,
|
||||||
`archive_type=${archiveType}`,
|
`archive_type=${extension}`,
|
||||||
`java_package_type=${bundleType}`,
|
`java_package_type=${bundleType}`,
|
||||||
`javafx_bundled=${javafx}`,
|
`javafx_bundled=${javafx}`,
|
||||||
`crac_supported=${crac}`,
|
`crac_supported=${crac}`,
|
||||||
@ -114857,49 +114861,6 @@ class ZuluDistribution extends base_installer_1.JavaBase {
|
|||||||
return process.platform;
|
return process.platform;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getOsParam(platform) {
|
|
||||||
// Map platform to new metadata API OS parameter
|
|
||||||
// The new API uses more specific OS names like 'linux-glibc', 'macos', 'windows'
|
|
||||||
switch (platform) {
|
|
||||||
case 'linux':
|
|
||||||
return 'linux-glibc';
|
|
||||||
case 'macos':
|
|
||||||
return 'macos';
|
|
||||||
case 'windows':
|
|
||||||
return 'windows';
|
|
||||||
default:
|
|
||||||
return platform;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
getArchParam(arch, hw_bitness) {
|
|
||||||
// Map architecture to new metadata API arch parameter
|
|
||||||
// The new API uses x64, x86, aarch64, arm
|
|
||||||
if (arch === 'x86' && hw_bitness === '64') {
|
|
||||||
return 'x64';
|
|
||||||
}
|
|
||||||
else if (arch === 'x86' && hw_bitness === '32') {
|
|
||||||
return 'x86';
|
|
||||||
}
|
|
||||||
else if (arch === 'arm' && hw_bitness === '64') {
|
|
||||||
return 'aarch64';
|
|
||||||
}
|
|
||||||
else if (arch === 'arm' && hw_bitness === '') {
|
|
||||||
return 'arm';
|
|
||||||
}
|
|
||||||
// Fallback for other architectures
|
|
||||||
return arch;
|
|
||||||
}
|
|
||||||
getArchiveType(extension) {
|
|
||||||
// Map extension to archive_type parameter for new API
|
|
||||||
switch (extension) {
|
|
||||||
case 'tar.gz':
|
|
||||||
return 'tar.gz';
|
|
||||||
case 'zip':
|
|
||||||
return 'zip';
|
|
||||||
default:
|
|
||||||
return extension;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
exports.ZuluDistribution = ZuluDistribution;
|
exports.ZuluDistribution = ZuluDistribution;
|
||||||
|
|
||||||
|
|||||||
@ -40,7 +40,7 @@ export class ZuluDistribution extends JavaBase {
|
|||||||
const satisfiedVersions = availableVersions
|
const satisfiedVersions = availableVersions
|
||||||
.filter(item => isVersionSatisfies(version, item.version))
|
.filter(item => isVersionSatisfies(version, item.version))
|
||||||
.sort((a, b) => {
|
.sort((a, b) => {
|
||||||
// Azul provides two versions: java_version and distro_version
|
// Azul provides two versions: jdk_version and azul_version
|
||||||
// we should sort by both fields by descending
|
// we should sort by both fields by descending
|
||||||
return (
|
return (
|
||||||
-semver.compareBuild(a.version, b.version) ||
|
-semver.compareBuild(a.version, b.version) ||
|
||||||
@ -112,11 +112,6 @@ export class ZuluDistribution extends JavaBase {
|
|||||||
console.time('Retrieving available versions for Zulu took'); // eslint-disable-line no-console
|
console.time('Retrieving available versions for Zulu took'); // eslint-disable-line no-console
|
||||||
}
|
}
|
||||||
|
|
||||||
// Map old API parameters to new metadata API parameters
|
|
||||||
const osParam = this.getOsParam(platform);
|
|
||||||
const archiveType = this.getArchiveType(extension);
|
|
||||||
const archParam = this.getArchParam(arch, hw_bitness);
|
|
||||||
|
|
||||||
// Fetch all pages to avoid missing packages when there are > 100 results
|
// Fetch all pages to avoid missing packages when there are > 100 results
|
||||||
let allVersions: IZuluVersions[] = [];
|
let allVersions: IZuluVersions[] = [];
|
||||||
let page = 1;
|
let page = 1;
|
||||||
@ -124,10 +119,18 @@ export class ZuluDistribution extends JavaBase {
|
|||||||
let hasMore = true;
|
let hasMore = true;
|
||||||
|
|
||||||
while (hasMore) {
|
while (hasMore) {
|
||||||
|
// Map architecture for new metadata API (x86+64bit -> x64, arm+64bit -> aarch64, etc.)
|
||||||
|
let archParam = arch;
|
||||||
|
if (arch === 'x86' && hw_bitness === '64') {
|
||||||
|
archParam = 'x64';
|
||||||
|
} else if (arch === 'arm' && hw_bitness === '64') {
|
||||||
|
archParam = 'aarch64';
|
||||||
|
}
|
||||||
|
|
||||||
const requestArguments = [
|
const requestArguments = [
|
||||||
`os=${osParam}`,
|
`os=${platform === 'linux' ? 'linux-glibc' : platform}`,
|
||||||
`arch=${archParam}`,
|
`arch=${archParam}`,
|
||||||
`archive_type=${archiveType}`,
|
`archive_type=${extension}`,
|
||||||
`java_package_type=${bundleType}`,
|
`java_package_type=${bundleType}`,
|
||||||
`javafx_bundled=${javafx}`,
|
`javafx_bundled=${javafx}`,
|
||||||
`crac_supported=${crac}`,
|
`crac_supported=${crac}`,
|
||||||
@ -200,47 +203,4 @@ export class ZuluDistribution extends JavaBase {
|
|||||||
return process.platform;
|
return process.platform;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private getOsParam(platform: string): string {
|
|
||||||
// Map platform to new metadata API OS parameter
|
|
||||||
// The new API uses more specific OS names like 'linux-glibc', 'macos', 'windows'
|
|
||||||
switch (platform) {
|
|
||||||
case 'linux':
|
|
||||||
return 'linux-glibc';
|
|
||||||
case 'macos':
|
|
||||||
return 'macos';
|
|
||||||
case 'windows':
|
|
||||||
return 'windows';
|
|
||||||
default:
|
|
||||||
return platform;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private getArchParam(arch: string, hw_bitness: string): string {
|
|
||||||
// Map architecture to new metadata API arch parameter
|
|
||||||
// The new API uses x64, x86, aarch64, arm
|
|
||||||
if (arch === 'x86' && hw_bitness === '64') {
|
|
||||||
return 'x64';
|
|
||||||
} else if (arch === 'x86' && hw_bitness === '32') {
|
|
||||||
return 'x86';
|
|
||||||
} else if (arch === 'arm' && hw_bitness === '64') {
|
|
||||||
return 'aarch64';
|
|
||||||
} else if (arch === 'arm' && hw_bitness === '') {
|
|
||||||
return 'arm';
|
|
||||||
}
|
|
||||||
// Fallback for other architectures
|
|
||||||
return arch;
|
|
||||||
}
|
|
||||||
|
|
||||||
private getArchiveType(extension: string): string {
|
|
||||||
// Map extension to archive_type parameter for new API
|
|
||||||
switch (extension) {
|
|
||||||
case 'tar.gz':
|
|
||||||
return 'tar.gz';
|
|
||||||
case 'zip':
|
|
||||||
return 'zip';
|
|
||||||
default:
|
|
||||||
return extension;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user