Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
c3eb4ca
Merge pull request #1 from actions/main
v-mahabaleshwars Mar 4, 2024
7abdf1c
added support for tool version file
v-mahabaleshwars Mar 4, 2024
a7f2ec4
testing with one regex
v-mahabaleshwars Mar 4, 2024
12fa539
working regex
v-mahabaleshwars Mar 4, 2024
3ac7f4d
Checked for the file extension
v-mahabaleshwars Mar 4, 2024
7ac1739
added e2e checks for tool version
v-mahabaleshwars Mar 4, 2024
c2eed4c
removed error warning
v-mahabaleshwars Mar 5, 2024
d6dce30
updated regex to support early version
v-mahabaleshwars Mar 7, 2024
15bd552
updated regex for early version support
v-mahabaleshwars Mar 7, 2024
091c706
updated regex for early version
v-mahabaleshwars Mar 7, 2024
23f648d
updated regex to accept early versions
v-mahabaleshwars Mar 8, 2024
108d337
added coreinfo to analyze
v-mahabaleshwars Mar 8, 2024
600bab6
updated the regex
v-mahabaleshwars Mar 8, 2024
7e1d245
updated regex
v-mahabaleshwars Mar 8, 2024
7c2ba30
new regex for early version
v-mahabaleshwars Mar 8, 2024
4963182
updated regex to match the new version file format
v-mahabaleshwars Mar 8, 2024
5633ed7
new regex
v-mahabaleshwars Mar 8, 2024
0bd564a
changed the regex
v-mahabaleshwars Mar 8, 2024
dc07897
redex updated
v-mahabaleshwars Mar 8, 2024
ac5ac98
used java version regex
v-mahabaleshwars Mar 8, 2024
00ea4e3
regex updated
v-mahabaleshwars Mar 8, 2024
3a44440
regex modified
v-mahabaleshwars Mar 8, 2024
ae1e7f4
regex updated
v-mahabaleshwars Mar 8, 2024
4ef246e
regex updated
v-mahabaleshwars Mar 8, 2024
8c268be
regex updated
v-mahabaleshwars Mar 8, 2024
c5831e8
updated regex to support early versions
v-mahabaleshwars Mar 8, 2024
0d65cda
Regex updated to support all java versions
v-mahabaleshwars Mar 8, 2024
4253d87
Documentation updated to add tool version description
v-mahabaleshwars Mar 11, 2024
33cfd28
Documentation updated for the tool version file
v-mahabaleshwars Mar 12, 2024
b71bea4
update the advanced doc and readme file to specify tool version changes
v-mahabaleshwars Mar 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
new regex for early version
  • Loading branch information
v-mahabaleshwars committed Mar 8, 2024
commit 7c2ba3003dfc4e87f0fd690f958c730bcc599018
2 changes: 1 addition & 1 deletion dist/cleanup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87891,7 +87891,7 @@ function getVersionFromFileContent(content, distributionName, versionFile) {
var _a, _b, _c, _d, _e;
let javaVersionRegExp;
if (versionFile == '.tool-versions') {
javaVersionRegExp = /^java\s+(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/;
javaVersionRegExp = /^java\s+(\S+)/m;
core.info(`Using .tool-versions file regx: ${javaVersionRegExp}`);
}
else if (versionFile == '.java-version') {
Expand Down
2 changes: 1 addition & 1 deletion dist/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -125265,7 +125265,7 @@ function getVersionFromFileContent(content, distributionName, versionFile) {
var _a, _b, _c, _d, _e;
let javaVersionRegExp;
if (versionFile == '.tool-versions') {
javaVersionRegExp = /^java\s+(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/;
javaVersionRegExp = /^java\s+(\S+)/m;
core.info(`Using .tool-versions file regx: ${javaVersionRegExp}`);

@rtyley rtyley Mar 14, 2024 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this regex will not accept full java versions commonly generated in asdf using latest - eg:

asdf local java latest:corretto-21

...will generate a file with this line:

java corretto-21.0.2.13.1

The regex doesn't recognise this, so setup-java will fail with this message:

Error: No supported version was found in file .tool-versions

If we play around with the regex, we can see that we have to edit the string down to java corretto-21.0.2 in order to get it to work:

image

}
else if (versionFile == '.java-version') {
Expand Down
2 changes: 1 addition & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export function getVersionFromFileContent(
): string | null {
let javaVersionRegExp: RegExp;
if (versionFile == '.tool-versions') {
javaVersionRegExp = /^java\s+(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/;
javaVersionRegExp = /^java\s+(\S+)/m;
core.info(`Using .tool-versions file regx: ${javaVersionRegExp}`);
} else if (versionFile == '.java-version') {
javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/;
Expand Down