mirror of
https://github.com/github/codeql-action.git
synced 2026-11-05 04:29:40 +00:00
Make Xcode regex more flexible
This commit is contained in:
2
lib/entry-points.js
generated
2
lib/entry-points.js
generated
@@ -183441,7 +183441,7 @@ function darwinVersion(action) {
|
||||
}
|
||||
var XCODE_SELECT_LINK_PATH = "/private/var/db/xcode_select_link";
|
||||
var XCODE_APP_FILENAME_PATTERN = new RegExp(
|
||||
/(?<filename>Xcode_(?<majorMinor>\d+(\.\d+)?)\.app)/
|
||||
/(?<filename>Xcode_(?<majorMinor>\d+(\.\d+)?).*\.app)/
|
||||
);
|
||||
function xcodeVersion(logger2) {
|
||||
try {
|
||||
|
||||
@@ -251,3 +251,32 @@ test.serial("xcodeVersion returns major version from resolved path", (t) => {
|
||||
t.is(readlinkSync.callCount, 1);
|
||||
t.deepEqual(readlinkSync.args[0], [XCODE_SELECT_LINK_PATH]);
|
||||
});
|
||||
|
||||
test.serial(
|
||||
"xcodeVersion allows more version components in resolved path",
|
||||
(t) => {
|
||||
const logger = new RecordingLogger();
|
||||
|
||||
const lstatSync = sinon
|
||||
.stub(fs, "lstatSync")
|
||||
.returns({ isSymbolicLink: () => true } as fs.Stats);
|
||||
const readlinkSync = sinon
|
||||
.stub(fs, "readlinkSync")
|
||||
.returns("/Applications/Xcode_16.5.9.app/Contents/Developer");
|
||||
|
||||
const result = xcodeVersion(logger);
|
||||
|
||||
if (t.truthy(result)) {
|
||||
t.is(result.major, 16);
|
||||
t.is(result.minor, 5);
|
||||
}
|
||||
|
||||
t.is(lstatSync.callCount, 1);
|
||||
t.deepEqual(lstatSync.args[0], [
|
||||
XCODE_SELECT_LINK_PATH,
|
||||
{ throwIfNoEntry: false },
|
||||
]);
|
||||
t.is(readlinkSync.callCount, 1);
|
||||
t.deepEqual(readlinkSync.args[0], [XCODE_SELECT_LINK_PATH]);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -63,7 +63,7 @@ export const XCODE_SELECT_LINK_PATH = "/private/var/db/xcode_select_link";
|
||||
|
||||
/** The pattern we expect to find in the Xcode path. */
|
||||
export const XCODE_APP_FILENAME_PATTERN = new RegExp(
|
||||
/(?<filename>Xcode_(?<majorMinor>\d+(\.\d+)?)\.app)/,
|
||||
/(?<filename>Xcode_(?<majorMinor>\d+(\.\d+)?).*\.app)/,
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user