mirror of
https://github.com/actions/setup-java.git
synced 2025-04-19 17:36:45 +00:00
testing with one regex
This commit is contained in:
parent
7abdf1c01e
commit
a7f2ec4000
3 changed files with 19 additions and 20 deletions
13
dist/cleanup/index.js
vendored
13
dist/cleanup/index.js
vendored
|
@ -87889,13 +87889,12 @@ function isCacheFeatureAvailable() {
|
||||||
exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
|
exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
|
||||||
function getVersionFromFileContent(content, distributionName, versionFile) {
|
function getVersionFromFileContent(content, distributionName, versionFile) {
|
||||||
var _a, _b, _c, _d, _e;
|
var _a, _b, _c, _d, _e;
|
||||||
let javaVersionRegExp;
|
const javaVersionRegExp = /^java\s+(?:\S+-)?v?(?<version>[^\s]+)$/m;
|
||||||
if (versionFile == '.tool-versions') {
|
// if (versionFile == '.tool-versions') {
|
||||||
javaVersionRegExp = /^java\s+(?:\S+-)?v?(?<version>[^\s]+)$/m;
|
// javaVersionRegExp = /^java\s+(?:\S+-)?v?(?<version>[^\s]+)$/m;
|
||||||
}
|
// } else {
|
||||||
else {
|
// javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/;
|
||||||
javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/;
|
// }
|
||||||
}
|
|
||||||
const fileContent = ((_b = (_a = content.match(javaVersionRegExp)) === null || _a === void 0 ? void 0 : _a.groups) === null || _b === void 0 ? void 0 : _b.version)
|
const fileContent = ((_b = (_a = content.match(javaVersionRegExp)) === null || _a === void 0 ? void 0 : _a.groups) === null || _b === void 0 ? void 0 : _b.version)
|
||||||
? (_d = (_c = content.match(javaVersionRegExp)) === null || _c === void 0 ? void 0 : _c.groups) === null || _d === void 0 ? void 0 : _d.version
|
? (_d = (_c = content.match(javaVersionRegExp)) === null || _c === void 0 ? void 0 : _c.groups) === null || _d === void 0 ? void 0 : _d.version
|
||||||
: '';
|
: '';
|
||||||
|
|
13
dist/setup/index.js
vendored
13
dist/setup/index.js
vendored
|
@ -125263,13 +125263,12 @@ function isCacheFeatureAvailable() {
|
||||||
exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
|
exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
|
||||||
function getVersionFromFileContent(content, distributionName, versionFile) {
|
function getVersionFromFileContent(content, distributionName, versionFile) {
|
||||||
var _a, _b, _c, _d, _e;
|
var _a, _b, _c, _d, _e;
|
||||||
let javaVersionRegExp;
|
const javaVersionRegExp = /^java\s+(?:\S+-)?v?(?<version>[^\s]+)$/m;
|
||||||
if (versionFile == '.tool-versions') {
|
// if (versionFile == '.tool-versions') {
|
||||||
javaVersionRegExp = /^java\s+(?:\S+-)?v?(?<version>[^\s]+)$/m;
|
// javaVersionRegExp = /^java\s+(?:\S+-)?v?(?<version>[^\s]+)$/m;
|
||||||
}
|
// } else {
|
||||||
else {
|
// javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/;
|
||||||
javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/;
|
// }
|
||||||
}
|
|
||||||
const fileContent = ((_b = (_a = content.match(javaVersionRegExp)) === null || _a === void 0 ? void 0 : _a.groups) === null || _b === void 0 ? void 0 : _b.version)
|
const fileContent = ((_b = (_a = content.match(javaVersionRegExp)) === null || _a === void 0 ? void 0 : _a.groups) === null || _b === void 0 ? void 0 : _b.version)
|
||||||
? (_d = (_c = content.match(javaVersionRegExp)) === null || _c === void 0 ? void 0 : _c.groups) === null || _d === void 0 ? void 0 : _d.version
|
? (_d = (_c = content.match(javaVersionRegExp)) === null || _c === void 0 ? void 0 : _c.groups) === null || _d === void 0 ? void 0 : _d.version
|
||||||
: '';
|
: '';
|
||||||
|
|
13
src/util.ts
13
src/util.ts
|
@ -118,12 +118,13 @@ export function getVersionFromFileContent(
|
||||||
distributionName: string,
|
distributionName: string,
|
||||||
versionFile: string
|
versionFile: string
|
||||||
): string | null {
|
): string | null {
|
||||||
let javaVersionRegExp: RegExp;
|
const javaVersionRegExp = /^java\s+(?:\S+-)?v?(?<version>[^\s]+)$/m;
|
||||||
if (versionFile == '.tool-versions') {
|
|
||||||
javaVersionRegExp = /^java\s+(?:\S+-)?v?(?<version>[^\s]+)$/m;
|
// if (versionFile == '.tool-versions') {
|
||||||
} else {
|
// javaVersionRegExp = /^java\s+(?:\S+-)?v?(?<version>[^\s]+)$/m;
|
||||||
javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/;
|
// } else {
|
||||||
}
|
// javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/;
|
||||||
|
// }
|
||||||
|
|
||||||
const fileContent = content.match(javaVersionRegExp)?.groups?.version
|
const fileContent = content.match(javaVersionRegExp)?.groups?.version
|
||||||
? (content.match(javaVersionRegExp)?.groups?.version as string)
|
? (content.match(javaVersionRegExp)?.groups?.version as string)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue