mirror of
https://github.com/actions/setup-java.git
synced 2025-04-19 09:26:46 +00:00
updated the regex
This commit is contained in:
parent
108d3372dc
commit
600bab6918
3 changed files with 3 additions and 9 deletions
4
dist/cleanup/index.js
vendored
4
dist/cleanup/index.js
vendored
|
@ -87891,12 +87891,10 @@ function getVersionFromFileContent(content, distributionName, versionFile) {
|
||||||
var _a, _b, _c, _d, _e;
|
var _a, _b, _c, _d, _e;
|
||||||
let javaVersionRegExp;
|
let javaVersionRegExp;
|
||||||
if (versionFile == '.tool-versions') {
|
if (versionFile == '.tool-versions') {
|
||||||
javaVersionRegExp = /^java\s+(?:\S+-)?v?(?<version>[^\s-]+(?:-\S+)?)$/m;
|
javaVersionRegExp = /^java\s\d+(-\w+)?(\.\d+)*$/m;
|
||||||
core.info(`Tool version javaVersionRegExp: ${javaVersionRegExp}`);
|
|
||||||
}
|
}
|
||||||
else if (versionFile == '.java-version') {
|
else if (versionFile == '.java-version') {
|
||||||
javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/;
|
javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/;
|
||||||
core.info(`java version javaVersionRegExp: ${javaVersionRegExp}`);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new Error('Invalid version file');
|
throw new Error('Invalid version file');
|
||||||
|
|
4
dist/setup/index.js
vendored
4
dist/setup/index.js
vendored
|
@ -125265,12 +125265,10 @@ function getVersionFromFileContent(content, distributionName, versionFile) {
|
||||||
var _a, _b, _c, _d, _e;
|
var _a, _b, _c, _d, _e;
|
||||||
let javaVersionRegExp;
|
let javaVersionRegExp;
|
||||||
if (versionFile == '.tool-versions') {
|
if (versionFile == '.tool-versions') {
|
||||||
javaVersionRegExp = /^java\s+(?:\S+-)?v?(?<version>[^\s-]+(?:-\S+)?)$/m;
|
javaVersionRegExp = /^java\s\d+(-\w+)?(\.\d+)*$/m;
|
||||||
core.info(`Tool version javaVersionRegExp: ${javaVersionRegExp}`);
|
|
||||||
}
|
}
|
||||||
else if (versionFile == '.java-version') {
|
else if (versionFile == '.java-version') {
|
||||||
javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/;
|
javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/;
|
||||||
core.info(`java version javaVersionRegExp: ${javaVersionRegExp}`);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new Error('Invalid version file');
|
throw new Error('Invalid version file');
|
||||||
|
|
|
@ -120,11 +120,9 @@ export function getVersionFromFileContent(
|
||||||
): string | null {
|
): string | null {
|
||||||
let javaVersionRegExp: RegExp;
|
let javaVersionRegExp: RegExp;
|
||||||
if (versionFile == '.tool-versions') {
|
if (versionFile == '.tool-versions') {
|
||||||
javaVersionRegExp = /^java\s+(?:\S+-)?v?(?<version>[^\s-]+(?:-\S+)?)$/m;
|
javaVersionRegExp = /^java\s\d+(-\w+)?(\.\d+)*$/m;
|
||||||
core.info(`Tool version javaVersionRegExp: ${javaVersionRegExp}`);
|
|
||||||
} else if (versionFile == '.java-version') {
|
} else if (versionFile == '.java-version') {
|
||||||
javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/;
|
javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/;
|
||||||
core.info(`java version javaVersionRegExp: ${javaVersionRegExp}`);
|
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Invalid version file');
|
throw new Error('Invalid version file');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue