mirror of
https://github.com/actions/setup-java.git
synced 2025-04-19 17:36:45 +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
|
||||
const availableVersions = tc
|
||||
.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)}`);
|
||||
const satisfiedVersions = availableVersions
|
||||
.filter(item => util_1.isVersionSatisfies(this.version, item.replace(/-ea$/, '').replace('-', '+')))
|
||||
.sort(semver_1.default.rcompare);
|
||||
.filter(item => util_1.isVersionSatisfies(this.version, item.version))
|
||||
.filter(item => item.path !== null)
|
||||
.sort((a, b) => {
|
||||
return -semver_1.default.compareBuild(a.version, b.version);
|
||||
});
|
||||
if (!satisfiedVersions || satisfiedVersions.length === 0) {
|
||||
return null;
|
||||
}
|
||||
console.log(`satisfiedVersions = ${JSON.stringify(satisfiedVersions)}`);
|
||||
const javaPath = util_1.getToolcachePath(this.toolcacheFolderName, satisfiedVersions[0], this.architecture);
|
||||
if (!javaPath) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
version: util_1.getVersionFromToolcachePath(javaPath),
|
||||
path: javaPath
|
||||
};
|
||||
return satisfiedVersions[0];
|
||||
}
|
||||
normalizeVersion(version) {
|
||||
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
|
||||
const availableVersions = tc
|
||||
.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)}`);
|
||||
|
||||
const satisfiedVersions = availableVersions
|
||||
.filter(item => isVersionSatisfies(this.version, item.replace(/-ea$/, '').replace('-', '+')))
|
||||
.sort(semver.rcompare);
|
||||
.filter(item => isVersionSatisfies(this.version, item.version))
|
||||
.filter(item => item.path !== null)
|
||||
.sort((a, b) => {
|
||||
return -semver.compareBuild(a.version, b.version);
|
||||
});
|
||||
if (!satisfiedVersions || satisfiedVersions.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
console.log(`satisfiedVersions = ${JSON.stringify(satisfiedVersions)}`);
|
||||
|
||||
const javaPath = getToolcachePath(
|
||||
this.toolcacheFolderName,
|
||||
satisfiedVersions[0],
|
||||
this.architecture
|
||||
);
|
||||
if (!javaPath) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
version: getVersionFromToolcachePath(javaPath),
|
||||
path: javaPath
|
||||
};
|
||||
return satisfiedVersions[0];
|
||||
}
|
||||
|
||||
protected normalizeVersion(version: string) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue