mirror of
https://github.com/actions/setup-java.git
synced 2025-04-20 01:46:46 +00:00
test 1
This commit is contained in:
parent
d96b43dd0d
commit
8326d77a03
2 changed files with 26 additions and 28 deletions
24
dist/setup/index.js
vendored
24
dist/setup/index.js
vendored
|
@ -3943,23 +3943,25 @@ class JavaBase {
|
||||||
// if *-ea is provided, take only ea versions from toolcache, otherwise - only stable versions
|
// if *-ea is provided, take only ea versions from toolcache, otherwise - only stable versions
|
||||||
const availableVersions = tc
|
const availableVersions = tc
|
||||||
.findAllVersions(this.toolcacheFolderName, this.architecture)
|
.findAllVersions(this.toolcacheFolderName, this.architecture)
|
||||||
.filter(item => item.endsWith('-ea') === !this.stable);
|
.filter(item => item.endsWith('-ea') === !this.stable)
|
||||||
|
.map(item => {
|
||||||
|
return {
|
||||||
|
version: item.replace(/-ea$/, '').replace('-', '+'),
|
||||||
|
path: util_1.getToolcachePath(this.toolcacheFolderName, item, this.architecture)
|
||||||
|
};
|
||||||
|
});
|
||||||
console.log(`availableVersions = ${JSON.stringify(availableVersions)}`);
|
console.log(`availableVersions = ${JSON.stringify(availableVersions)}`);
|
||||||
const satisfiedVersions = availableVersions
|
const satisfiedVersions = availableVersions
|
||||||
.filter(item => util_1.isVersionSatisfies(this.version, item.replace(/-ea$/, '').replace('-', '+')))
|
.filter(item => util_1.isVersionSatisfies(this.version, item.version))
|
||||||
.sort(semver_1.default.rcompare);
|
.filter(item => item.path !== null)
|
||||||
|
.sort((a, b) => {
|
||||||
|
return -semver_1.default.compareBuild(a.version, b.version);
|
||||||
|
});
|
||||||
if (!satisfiedVersions || satisfiedVersions.length === 0) {
|
if (!satisfiedVersions || satisfiedVersions.length === 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
console.log(`satisfiedVersions = ${JSON.stringify(satisfiedVersions)}`);
|
console.log(`satisfiedVersions = ${JSON.stringify(satisfiedVersions)}`);
|
||||||
const javaPath = util_1.getToolcachePath(this.toolcacheFolderName, satisfiedVersions[0], this.architecture);
|
return satisfiedVersions[0];
|
||||||
if (!javaPath) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
version: util_1.getVersionFromToolcachePath(javaPath),
|
|
||||||
path: javaPath
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
normalizeVersion(version) {
|
normalizeVersion(version) {
|
||||||
let stable = true;
|
let stable = true;
|
||||||
|
|
|
@ -71,33 +71,29 @@ export abstract class JavaBase {
|
||||||
// if *-ea is provided, take only ea versions from toolcache, otherwise - only stable versions
|
// if *-ea is provided, take only ea versions from toolcache, otherwise - only stable versions
|
||||||
const availableVersions = tc
|
const availableVersions = tc
|
||||||
.findAllVersions(this.toolcacheFolderName, this.architecture)
|
.findAllVersions(this.toolcacheFolderName, this.architecture)
|
||||||
.filter(item => item.endsWith('-ea') === !this.stable);
|
.filter(item => item.endsWith('-ea') === !this.stable)
|
||||||
|
.map(item => {
|
||||||
|
return {
|
||||||
|
version: item.replace(/-ea$/, '').replace('-', '+'),
|
||||||
|
path: getToolcachePath(this.toolcacheFolderName, item, this.architecture)
|
||||||
|
} as JavaInstallerResults;
|
||||||
|
});
|
||||||
|
|
||||||
console.log(`availableVersions = ${JSON.stringify(availableVersions)}`);
|
console.log(`availableVersions = ${JSON.stringify(availableVersions)}`);
|
||||||
|
|
||||||
const satisfiedVersions = availableVersions
|
const satisfiedVersions = availableVersions
|
||||||
.filter(item => isVersionSatisfies(this.version, item.replace(/-ea$/, '').replace('-', '+')))
|
.filter(item => isVersionSatisfies(this.version, item.version))
|
||||||
.sort(semver.rcompare);
|
.filter(item => item.path !== null)
|
||||||
|
.sort((a, b) => {
|
||||||
|
return -semver.compareBuild(a.version, b.version);
|
||||||
|
});
|
||||||
if (!satisfiedVersions || satisfiedVersions.length === 0) {
|
if (!satisfiedVersions || satisfiedVersions.length === 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
console.log(`satisfiedVersions = ${JSON.stringify(satisfiedVersions)}`);
|
console.log(`satisfiedVersions = ${JSON.stringify(satisfiedVersions)}`);
|
||||||
|
|
||||||
const javaPath = getToolcachePath(
|
return satisfiedVersions[0];
|
||||||
this.toolcacheFolderName,
|
|
||||||
satisfiedVersions[0],
|
|
||||||
this.architecture
|
|
||||||
);
|
|
||||||
if (!javaPath) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
version: getVersionFromToolcachePath(javaPath),
|
|
||||||
path: javaPath
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected normalizeVersion(version: string) {
|
protected normalizeVersion(version: string) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue