From 1bab076d1f9e2eca5c6eae0ba538fe168aab132f Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Fri, 9 Oct 2026 18:11:41 +0100 Subject: [PATCH] Check if Xcode version is unsupported --- lib/entry-points.js | 645 ++++++++++++++++++++---------------- src/languages/swift.test.ts | 194 +++++++++++ src/languages/swift.ts | 132 +++++--- 3 files changed, 633 insertions(+), 338 deletions(-) diff --git a/lib/entry-points.js b/lib/entry-points.js index 44c96daa6..7935a8265 100644 --- a/lib/entry-points.js +++ b/lib/entry-points.js @@ -213,7 +213,7 @@ var require_file_command = __commonJS({ exports2.issueFileCommand = issueFileCommand; exports2.prepareKeyValueMessage = prepareKeyValueMessage; var crypto3 = __importStar2(require("crypto")); - var fs33 = __importStar2(require("fs")); + var fs34 = __importStar2(require("fs")); var os8 = __importStar2(require("os")); var utils_1 = require_utils(); function issueFileCommand(command, message) { @@ -221,10 +221,10 @@ var require_file_command = __commonJS({ if (!filePath) { throw new Error(`Unable to find environment variable for file command ${command}`); } - if (!fs33.existsSync(filePath)) { + if (!fs34.existsSync(filePath)) { throw new Error(`Missing file at path: ${filePath}`); } - fs33.appendFileSync(filePath, `${(0, utils_1.toCommandValue)(message)}${os8.EOL}`, { + fs34.appendFileSync(filePath, `${(0, utils_1.toCommandValue)(message)}${os8.EOL}`, { encoding: "utf8" }); } @@ -20443,13 +20443,13 @@ var require_io_util = __commonJS({ exports2.isRooted = isRooted; exports2.tryGetExecutablePath = tryGetExecutablePath; exports2.getCmdPath = getCmdPath; - var fs33 = __importStar2(require("fs")); + var fs34 = __importStar2(require("fs")); var path30 = __importStar2(require("path")); - _a6 = fs33.promises, exports2.chmod = _a6.chmod, exports2.copyFile = _a6.copyFile, exports2.lstat = _a6.lstat, exports2.mkdir = _a6.mkdir, exports2.open = _a6.open, exports2.readdir = _a6.readdir, exports2.rename = _a6.rename, exports2.rm = _a6.rm, exports2.rmdir = _a6.rmdir, exports2.stat = _a6.stat, exports2.symlink = _a6.symlink, exports2.unlink = _a6.unlink; + _a6 = fs34.promises, exports2.chmod = _a6.chmod, exports2.copyFile = _a6.copyFile, exports2.lstat = _a6.lstat, exports2.mkdir = _a6.mkdir, exports2.open = _a6.open, exports2.readdir = _a6.readdir, exports2.rename = _a6.rename, exports2.rm = _a6.rm, exports2.rmdir = _a6.rmdir, exports2.stat = _a6.stat, exports2.symlink = _a6.symlink, exports2.unlink = _a6.unlink; exports2.IS_WINDOWS = process.platform === "win32"; function readlink(fsPath) { return __awaiter2(this, void 0, void 0, function* () { - const result = yield fs33.promises.readlink(fsPath); + const result = yield fs34.promises.readlink(fsPath); if (exports2.IS_WINDOWS && !result.endsWith("\\")) { return `${result}\\`; } @@ -20457,7 +20457,7 @@ var require_io_util = __commonJS({ }); } exports2.UV_FS_O_EXLOCK = 268435456; - exports2.READONLY = fs33.constants.O_RDONLY; + exports2.READONLY = fs34.constants.O_RDONLY; function exists(fsPath) { return __awaiter2(this, void 0, void 0, function* () { try { @@ -33065,7 +33065,7 @@ var require_internal_globber = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.DefaultGlobber = void 0; var core29 = __importStar2(require_core()); - var fs33 = __importStar2(require("fs")); + var fs34 = __importStar2(require("fs")); var globOptionsHelper = __importStar2(require_internal_glob_options_helper()); var path30 = __importStar2(require("path")); var patternHelper = __importStar2(require_internal_pattern_helper()); @@ -33119,7 +33119,7 @@ var require_internal_globber = __commonJS({ for (const searchPath of patternHelper.getSearchPaths(patterns)) { core29.debug(`Search path '${searchPath}'`); try { - yield __await2(fs33.promises.lstat(searchPath)); + yield __await2(fs34.promises.lstat(searchPath)); } catch (err) { if (err.code === "ENOENT") { continue; @@ -33153,7 +33153,7 @@ var require_internal_globber = __commonJS({ continue; } const childLevel = item.level + 1; - const childItems = (yield __await2(fs33.promises.readdir(item.path))).map((x) => new internal_search_state_1.SearchState(path30.join(item.path, x), childLevel)); + const childItems = (yield __await2(fs34.promises.readdir(item.path))).map((x) => new internal_search_state_1.SearchState(path30.join(item.path, x), childLevel)); stack.push(...childItems.reverse()); } else if (match2 & internal_match_kind_1.MatchKind.File) { yield yield __await2(item.path); @@ -33188,7 +33188,7 @@ var require_internal_globber = __commonJS({ let stats; if (options.followSymbolicLinks) { try { - stats = yield fs33.promises.stat(item.path); + stats = yield fs34.promises.stat(item.path); } catch (err) { if (err.code === "ENOENT") { if (options.omitBrokenSymbolicLinks) { @@ -33200,10 +33200,10 @@ var require_internal_globber = __commonJS({ throw err; } } else { - stats = yield fs33.promises.lstat(item.path); + stats = yield fs34.promises.lstat(item.path); } if (stats.isDirectory() && options.followSymbolicLinks) { - const realPath = yield fs33.promises.realpath(item.path); + const realPath = yield fs34.promises.realpath(item.path); while (traversalChain.length >= item.level) { traversalChain.pop(); } @@ -33312,7 +33312,7 @@ var require_internal_hash_files = __commonJS({ exports2.hashFiles = hashFiles2; var crypto3 = __importStar2(require("crypto")); var core29 = __importStar2(require_core()); - var fs33 = __importStar2(require("fs")); + var fs34 = __importStar2(require("fs")); var stream2 = __importStar2(require("stream")); var util4 = __importStar2(require("util")); var path30 = __importStar2(require("path")); @@ -33335,13 +33335,13 @@ var require_internal_hash_files = __commonJS({ writeDelegate(`Ignore '${file}' since it is not under GITHUB_WORKSPACE.`); continue; } - if (fs33.statSync(file).isDirectory()) { + if (fs34.statSync(file).isDirectory()) { writeDelegate(`Skip directory '${file}'.`); continue; } const hash2 = crypto3.createHash("sha256"); const pipeline2 = util4.promisify(stream2.pipeline); - yield pipeline2(fs33.createReadStream(file), hash2); + yield pipeline2(fs34.createReadStream(file), hash2); result.write(hash2.digest()); count++; if (!hasMatch) { @@ -34717,7 +34717,7 @@ var require_cacheUtils = __commonJS({ var glob2 = __importStar2(require_glob()); var io9 = __importStar2(require_io()); var crypto3 = __importStar2(require("crypto")); - var fs33 = __importStar2(require("fs")); + var fs34 = __importStar2(require("fs")); var path30 = __importStar2(require("path")); var semver13 = __importStar2(require_semver3()); var util4 = __importStar2(require("util")); @@ -34746,7 +34746,7 @@ var require_cacheUtils = __commonJS({ }); } function getArchiveFileSizeInBytes(filePath) { - return fs33.statSync(filePath).size; + return fs34.statSync(filePath).size; } function resolvePaths(patterns) { return __awaiter2(this, void 0, void 0, function* () { @@ -34784,7 +34784,7 @@ var require_cacheUtils = __commonJS({ } function unlinkFile(filePath) { return __awaiter2(this, void 0, void 0, function* () { - return util4.promisify(fs33.unlink)(filePath); + return util4.promisify(fs34.unlink)(filePath); }); } function getVersion(app_1) { @@ -34826,7 +34826,7 @@ var require_cacheUtils = __commonJS({ } function getGnuTarPathOnWindows() { return __awaiter2(this, void 0, void 0, function* () { - if (fs33.existsSync(constants_1.GnuTarPathOnWindows)) { + if (fs34.existsSync(constants_1.GnuTarPathOnWindows)) { return constants_1.GnuTarPathOnWindows; } const versionOutput = yield getVersion("tar"); @@ -99550,7 +99550,7 @@ var require_downloadUtils = __commonJS({ var http_client_1 = require_lib(); var storage_blob_1 = require_commonjs15(); var buffer = __importStar2(require("buffer")); - var fs33 = __importStar2(require("fs")); + var fs34 = __importStar2(require("fs")); var stream2 = __importStar2(require("stream")); var util4 = __importStar2(require("util")); var utils = __importStar2(require_cacheUtils()); @@ -99661,7 +99661,7 @@ var require_downloadUtils = __commonJS({ exports2.DownloadProgress = DownloadProgress; function downloadCacheHttpClient(archiveLocation, archivePath) { return __awaiter2(this, void 0, void 0, function* () { - const writeStream = fs33.createWriteStream(archivePath); + const writeStream = fs34.createWriteStream(archivePath); const httpClient = new http_client_1.HttpClient("actions/cache"); const downloadResponse = yield (0, requestUtils_1.retryHttpClientResponse)("downloadCache", () => __awaiter2(this, void 0, void 0, function* () { return httpClient.get(archiveLocation); @@ -99686,7 +99686,7 @@ var require_downloadUtils = __commonJS({ function downloadCacheHttpClientConcurrent(archiveLocation, archivePath, options) { return __awaiter2(this, void 0, void 0, function* () { var _a6; - const archiveDescriptor = yield fs33.promises.open(archivePath, "w"); + const archiveDescriptor = yield fs34.promises.open(archivePath, "w"); const httpClient = new http_client_1.HttpClient("actions/cache", void 0, { socketTimeout: options.timeoutInMs, keepAlive: true @@ -99802,7 +99802,7 @@ var require_downloadUtils = __commonJS({ } else { const maxSegmentSize = Math.min(134217728, buffer.constants.MAX_LENGTH); const downloadProgress = new DownloadProgress(contentLength); - const fd = fs33.openSync(archivePath, "w"); + const fd = fs34.openSync(archivePath, "w"); try { downloadProgress.startDisplayTimer(); const controller = new abort_controller_1.AbortController(); @@ -99820,12 +99820,12 @@ var require_downloadUtils = __commonJS({ controller.abort(); throw new Error("Aborting cache download as the download time exceeded the timeout."); } else if (Buffer.isBuffer(result)) { - fs33.writeFileSync(fd, result); + fs34.writeFileSync(fd, result); } } } finally { downloadProgress.stopDisplayTimer(); - fs33.closeSync(fd); + fs34.closeSync(fd); } } }); @@ -100164,7 +100164,7 @@ var require_cacheHttpClient = __commonJS({ var core29 = __importStar2(require_core()); var http_client_1 = require_lib(); var auth_1 = require_auth(); - var fs33 = __importStar2(require("fs")); + var fs34 = __importStar2(require("fs")); var url_1 = require("url"); var utils = __importStar2(require_cacheUtils()); var uploadUtils_1 = require_uploadUtils(); @@ -100305,7 +100305,7 @@ Other caches with similar key:`); return __awaiter2(this, void 0, void 0, function* () { const fileSize = utils.getArchiveFileSizeInBytes(archivePath); const resourceUrl = getCacheApiUrl(`caches/${cacheId.toString()}`); - const fd = fs33.openSync(archivePath, "r"); + const fd = fs34.openSync(archivePath, "r"); const uploadOptions = (0, options_1.getUploadOptions)(options); const concurrency = utils.assertDefined("uploadConcurrency", uploadOptions.uploadConcurrency); const maxChunkSize = utils.assertDefined("uploadChunkSize", uploadOptions.uploadChunkSize); @@ -100319,7 +100319,7 @@ Other caches with similar key:`); const start = offset; const end = offset + chunkSize - 1; offset += maxChunkSize; - yield uploadChunk(httpClient, resourceUrl, () => fs33.createReadStream(archivePath, { + yield uploadChunk(httpClient, resourceUrl, () => fs34.createReadStream(archivePath, { fd, start, end, @@ -100330,7 +100330,7 @@ Other caches with similar key:`); } }))); } finally { - fs33.closeSync(fd); + fs34.closeSync(fd); } return; }); @@ -106350,7 +106350,7 @@ var require_manifest = __commonJS({ var core_1 = require_core(); var os8 = require("os"); var cp = require("child_process"); - var fs33 = require("fs"); + var fs34 = require("fs"); function _findMatch(versionSpec, stable, candidates, archFilter) { return __awaiter2(this, void 0, void 0, function* () { const platFilter = os8.platform(); @@ -106412,10 +106412,10 @@ var require_manifest = __commonJS({ const lsbReleaseFile = "/etc/lsb-release"; const osReleaseFile = "/etc/os-release"; let contents = ""; - if (fs33.existsSync(lsbReleaseFile)) { - contents = fs33.readFileSync(lsbReleaseFile).toString(); - } else if (fs33.existsSync(osReleaseFile)) { - contents = fs33.readFileSync(osReleaseFile).toString(); + if (fs34.existsSync(lsbReleaseFile)) { + contents = fs34.readFileSync(lsbReleaseFile).toString(); + } else if (fs34.existsSync(osReleaseFile)) { + contents = fs34.readFileSync(osReleaseFile).toString(); } return contents; } @@ -106624,7 +106624,7 @@ var require_tool_cache = __commonJS({ var core29 = __importStar2(require_core()); var io9 = __importStar2(require_io()); var crypto3 = __importStar2(require("crypto")); - var fs33 = __importStar2(require("fs")); + var fs34 = __importStar2(require("fs")); var mm = __importStar2(require_manifest()); var os8 = __importStar2(require("os")); var path30 = __importStar2(require("path")); @@ -106670,7 +106670,7 @@ var require_tool_cache = __commonJS({ } function downloadToolAttempt(url2, dest, auth2, headers) { return __awaiter2(this, void 0, void 0, function* () { - if (fs33.existsSync(dest)) { + if (fs34.existsSync(dest)) { throw new Error(`Destination file path ${dest} already exists`); } const http = new httpm.HttpClient(userAgent2, [], { @@ -106694,7 +106694,7 @@ var require_tool_cache = __commonJS({ const readStream = responseMessageFactory(); let succeeded = false; try { - yield pipeline2(readStream, fs33.createWriteStream(dest)); + yield pipeline2(readStream, fs34.createWriteStream(dest)); core29.debug("download complete"); succeeded = true; return dest; @@ -106906,11 +106906,11 @@ var require_tool_cache = __commonJS({ arch2 = arch2 || os8.arch(); core29.debug(`Caching tool ${tool} ${version} ${arch2}`); core29.debug(`source dir: ${sourceDir}`); - if (!fs33.statSync(sourceDir).isDirectory()) { + if (!fs34.statSync(sourceDir).isDirectory()) { throw new Error("sourceDir is not a directory"); } const destPath = yield _createToolPath(tool, version, arch2); - for (const itemName of fs33.readdirSync(sourceDir)) { + for (const itemName of fs34.readdirSync(sourceDir)) { const s = path30.join(sourceDir, itemName); yield io9.cp(s, destPath, { recursive: true }); } @@ -106924,7 +106924,7 @@ var require_tool_cache = __commonJS({ arch2 = arch2 || os8.arch(); core29.debug(`Caching tool ${tool} ${version} ${arch2}`); core29.debug(`source file: ${sourceFile}`); - if (!fs33.statSync(sourceFile).isFile()) { + if (!fs34.statSync(sourceFile).isFile()) { throw new Error("sourceFile is not a file"); } const destFolder = yield _createToolPath(tool, version, arch2); @@ -106953,7 +106953,7 @@ var require_tool_cache = __commonJS({ versionSpec = semver13.clean(versionSpec) || ""; const cachePath = path30.join(_getCacheDirectory(), toolName, versionSpec, arch2); core29.debug(`checking cache: ${cachePath}`); - if (fs33.existsSync(cachePath) && fs33.existsSync(`${cachePath}.complete`)) { + if (fs34.existsSync(cachePath) && fs34.existsSync(`${cachePath}.complete`)) { core29.debug(`Found tool in cache ${toolName} ${versionSpec} ${arch2}`); toolPath = cachePath; } else { @@ -106966,12 +106966,12 @@ var require_tool_cache = __commonJS({ const versions = []; arch2 = arch2 || os8.arch(); const toolPath = path30.join(_getCacheDirectory(), toolName); - if (fs33.existsSync(toolPath)) { - const children = fs33.readdirSync(toolPath); + if (fs34.existsSync(toolPath)) { + const children = fs34.readdirSync(toolPath); for (const child of children) { if (isExplicitVersion(child)) { const fullPath = path30.join(toolPath, child, arch2 || ""); - if (fs33.existsSync(fullPath) && fs33.existsSync(`${fullPath}.complete`)) { + if (fs34.existsSync(fullPath) && fs34.existsSync(`${fullPath}.complete`)) { versions.push(child); } } @@ -107042,7 +107042,7 @@ var require_tool_cache = __commonJS({ function _completeToolPath(tool, version, arch2) { const folderPath = path30.join(_getCacheDirectory(), tool, semver13.clean(version) || version, arch2 || ""); const markerPath = `${folderPath}.complete`; - fs33.writeFileSync(markerPath, ""); + fs34.writeFileSync(markerPath, ""); core29.debug("finished caching tool"); } function isExplicitVersion(versionSpec) { @@ -113284,15 +113284,15 @@ var require_upload_zip_specification = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.getUploadZipSpecification = exports2.validateRootDirectory = void 0; - var fs33 = __importStar2(require("fs")); + var fs34 = __importStar2(require("fs")); var core_1 = require_core(); var path_1 = require("path"); var path_and_artifact_name_validation_1 = require_path_and_artifact_name_validation(); function validateRootDirectory(rootDirectory) { - if (!fs33.existsSync(rootDirectory)) { + if (!fs34.existsSync(rootDirectory)) { throw new Error(`The provided rootDirectory ${rootDirectory} does not exist`); } - if (!fs33.statSync(rootDirectory).isDirectory()) { + if (!fs34.statSync(rootDirectory).isDirectory()) { throw new Error(`The provided rootDirectory ${rootDirectory} is not a valid directory`); } (0, core_1.info)(`Root directory input is valid!`); @@ -113303,7 +113303,7 @@ var require_upload_zip_specification = __commonJS({ rootDirectory = (0, path_1.normalize)(rootDirectory); rootDirectory = (0, path_1.resolve)(rootDirectory); for (let file of filesToZip) { - const stats = fs33.lstatSync(file, { throwIfNoEntry: false }); + const stats = fs34.lstatSync(file, { throwIfNoEntry: false }); if (!stats) { throw new Error(`File ${file} does not exist`); } @@ -114378,13 +114378,13 @@ var require_minimatch2 = __commonJS({ var require_readdir_glob = __commonJS({ "node_modules/@actions/artifact/node_modules/readdir-glob/index.js"(exports2, module2) { module2.exports = readdirGlob2; - var fs33 = require("fs"); + var fs34 = require("fs"); var { EventEmitter: EventEmitter2 } = require("events"); var { Minimatch: Minimatch2 } = require_minimatch2(); var { resolve: resolve14 } = require("path"); function readdir3(dir, strict) { return new Promise((resolve15, reject) => { - fs33.readdir(dir, { withFileTypes: true }, (err, files) => { + fs34.readdir(dir, { withFileTypes: true }, (err, files) => { if (err) { switch (err.code) { case "ENOTDIR": @@ -114417,7 +114417,7 @@ var require_readdir_glob = __commonJS({ } function stat2(file, followSymlinks) { return new Promise((resolve15, reject) => { - const statFunc = followSymlinks ? fs33.stat : fs33.lstat; + const statFunc = followSymlinks ? fs34.stat : fs34.lstat; statFunc(file, (err, stats) => { if (err) { switch (err.code) { @@ -116482,54 +116482,54 @@ var require_polyfills = __commonJS({ } var chdir; module2.exports = patch; - function patch(fs33) { + function patch(fs34) { if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { - patchLchmod(fs33); + patchLchmod(fs34); } - if (!fs33.lutimes) { - patchLutimes(fs33); + if (!fs34.lutimes) { + patchLutimes(fs34); } - fs33.chown = chownFix(fs33.chown); - fs33.fchown = chownFix(fs33.fchown); - fs33.lchown = chownFix(fs33.lchown); - fs33.chmod = chmodFix(fs33.chmod); - fs33.fchmod = chmodFix(fs33.fchmod); - fs33.lchmod = chmodFix(fs33.lchmod); - fs33.chownSync = chownFixSync(fs33.chownSync); - fs33.fchownSync = chownFixSync(fs33.fchownSync); - fs33.lchownSync = chownFixSync(fs33.lchownSync); - fs33.chmodSync = chmodFixSync(fs33.chmodSync); - fs33.fchmodSync = chmodFixSync(fs33.fchmodSync); - fs33.lchmodSync = chmodFixSync(fs33.lchmodSync); - fs33.stat = statFix(fs33.stat); - fs33.fstat = statFix(fs33.fstat); - fs33.lstat = statFix(fs33.lstat); - fs33.statSync = statFixSync(fs33.statSync); - fs33.fstatSync = statFixSync(fs33.fstatSync); - fs33.lstatSync = statFixSync(fs33.lstatSync); - if (fs33.chmod && !fs33.lchmod) { - fs33.lchmod = function(path30, mode, cb) { + fs34.chown = chownFix(fs34.chown); + fs34.fchown = chownFix(fs34.fchown); + fs34.lchown = chownFix(fs34.lchown); + fs34.chmod = chmodFix(fs34.chmod); + fs34.fchmod = chmodFix(fs34.fchmod); + fs34.lchmod = chmodFix(fs34.lchmod); + fs34.chownSync = chownFixSync(fs34.chownSync); + fs34.fchownSync = chownFixSync(fs34.fchownSync); + fs34.lchownSync = chownFixSync(fs34.lchownSync); + fs34.chmodSync = chmodFixSync(fs34.chmodSync); + fs34.fchmodSync = chmodFixSync(fs34.fchmodSync); + fs34.lchmodSync = chmodFixSync(fs34.lchmodSync); + fs34.stat = statFix(fs34.stat); + fs34.fstat = statFix(fs34.fstat); + fs34.lstat = statFix(fs34.lstat); + fs34.statSync = statFixSync(fs34.statSync); + fs34.fstatSync = statFixSync(fs34.fstatSync); + fs34.lstatSync = statFixSync(fs34.lstatSync); + if (fs34.chmod && !fs34.lchmod) { + fs34.lchmod = function(path30, mode, cb) { if (cb) process.nextTick(cb); }; - fs33.lchmodSync = function() { + fs34.lchmodSync = function() { }; } - if (fs33.chown && !fs33.lchown) { - fs33.lchown = function(path30, uid, gid, cb) { + if (fs34.chown && !fs34.lchown) { + fs34.lchown = function(path30, uid, gid, cb) { if (cb) process.nextTick(cb); }; - fs33.lchownSync = function() { + fs34.lchownSync = function() { }; } if (platform2 === "win32") { - fs33.rename = typeof fs33.rename !== "function" ? fs33.rename : (function(fs$rename) { + fs34.rename = typeof fs34.rename !== "function" ? fs34.rename : (function(fs$rename) { function rename(from, to, cb) { var start = Date.now(); var backoff = 0; fs$rename(from, to, function CB(er) { if (er && (er.code === "EACCES" || er.code === "EPERM") && Date.now() - start < 6e4) { setTimeout(function() { - fs33.stat(to, function(stater, st) { + fs34.stat(to, function(stater, st) { if (stater && stater.code === "ENOENT") fs$rename(from, to, CB); else @@ -116545,9 +116545,9 @@ var require_polyfills = __commonJS({ } if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename); return rename; - })(fs33.rename); + })(fs34.rename); } - fs33.read = typeof fs33.read !== "function" ? fs33.read : (function(fs$read) { + fs34.read = typeof fs34.read !== "function" ? fs34.read : (function(fs$read) { function read(fd, buffer, offset, length, position, callback_) { var callback; if (callback_ && typeof callback_ === "function") { @@ -116555,22 +116555,22 @@ var require_polyfills = __commonJS({ callback = function(er, _2, __) { if (er && er.code === "EAGAIN" && eagCounter < 10) { eagCounter++; - return fs$read.call(fs33, fd, buffer, offset, length, position, callback); + return fs$read.call(fs34, fd, buffer, offset, length, position, callback); } callback_.apply(this, arguments); }; } - return fs$read.call(fs33, fd, buffer, offset, length, position, callback); + return fs$read.call(fs34, fd, buffer, offset, length, position, callback); } if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read); return read; - })(fs33.read); - fs33.readSync = typeof fs33.readSync !== "function" ? fs33.readSync : /* @__PURE__ */ (function(fs$readSync) { + })(fs34.read); + fs34.readSync = typeof fs34.readSync !== "function" ? fs34.readSync : /* @__PURE__ */ (function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { try { - return fs$readSync.call(fs33, fd, buffer, offset, length, position); + return fs$readSync.call(fs34, fd, buffer, offset, length, position); } catch (er) { if (er.code === "EAGAIN" && eagCounter < 10) { eagCounter++; @@ -116580,10 +116580,10 @@ var require_polyfills = __commonJS({ } } }; - })(fs33.readSync); - function patchLchmod(fs34) { - fs34.lchmod = function(path30, mode, callback) { - fs34.open( + })(fs34.readSync); + function patchLchmod(fs35) { + fs35.lchmod = function(path30, mode, callback) { + fs35.open( path30, constants.O_WRONLY | constants.O_SYMLINK, mode, @@ -116592,80 +116592,80 @@ var require_polyfills = __commonJS({ if (callback) callback(err); return; } - fs34.fchmod(fd, mode, function(err2) { - fs34.close(fd, function(err22) { + fs35.fchmod(fd, mode, function(err2) { + fs35.close(fd, function(err22) { if (callback) callback(err2 || err22); }); }); } ); }; - fs34.lchmodSync = function(path30, mode) { - var fd = fs34.openSync(path30, constants.O_WRONLY | constants.O_SYMLINK, mode); + fs35.lchmodSync = function(path30, mode) { + var fd = fs35.openSync(path30, constants.O_WRONLY | constants.O_SYMLINK, mode); var threw = true; var ret; try { - ret = fs34.fchmodSync(fd, mode); + ret = fs35.fchmodSync(fd, mode); threw = false; } finally { if (threw) { try { - fs34.closeSync(fd); + fs35.closeSync(fd); } catch (er) { } } else { - fs34.closeSync(fd); + fs35.closeSync(fd); } } return ret; }; } - function patchLutimes(fs34) { - if (constants.hasOwnProperty("O_SYMLINK") && fs34.futimes) { - fs34.lutimes = function(path30, at, mt, cb) { - fs34.open(path30, constants.O_SYMLINK, function(er, fd) { + function patchLutimes(fs35) { + if (constants.hasOwnProperty("O_SYMLINK") && fs35.futimes) { + fs35.lutimes = function(path30, at, mt, cb) { + fs35.open(path30, constants.O_SYMLINK, function(er, fd) { if (er) { if (cb) cb(er); return; } - fs34.futimes(fd, at, mt, function(er2) { - fs34.close(fd, function(er22) { + fs35.futimes(fd, at, mt, function(er2) { + fs35.close(fd, function(er22) { if (cb) cb(er2 || er22); }); }); }); }; - fs34.lutimesSync = function(path30, at, mt) { - var fd = fs34.openSync(path30, constants.O_SYMLINK); + fs35.lutimesSync = function(path30, at, mt) { + var fd = fs35.openSync(path30, constants.O_SYMLINK); var ret; var threw = true; try { - ret = fs34.futimesSync(fd, at, mt); + ret = fs35.futimesSync(fd, at, mt); threw = false; } finally { if (threw) { try { - fs34.closeSync(fd); + fs35.closeSync(fd); } catch (er) { } } else { - fs34.closeSync(fd); + fs35.closeSync(fd); } } return ret; }; - } else if (fs34.futimes) { - fs34.lutimes = function(_a6, _b2, _c2, cb) { + } else if (fs35.futimes) { + fs35.lutimes = function(_a6, _b2, _c2, cb) { if (cb) process.nextTick(cb); }; - fs34.lutimesSync = function() { + fs35.lutimesSync = function() { }; } } function chmodFix(orig) { if (!orig) return orig; return function(target, mode, cb) { - return orig.call(fs33, target, mode, function(er) { + return orig.call(fs34, target, mode, function(er) { if (chownErOk(er)) er = null; if (cb) cb.apply(this, arguments); }); @@ -116675,7 +116675,7 @@ var require_polyfills = __commonJS({ if (!orig) return orig; return function(target, mode) { try { - return orig.call(fs33, target, mode); + return orig.call(fs34, target, mode); } catch (er) { if (!chownErOk(er)) throw er; } @@ -116684,7 +116684,7 @@ var require_polyfills = __commonJS({ function chownFix(orig) { if (!orig) return orig; return function(target, uid, gid, cb) { - return orig.call(fs33, target, uid, gid, function(er) { + return orig.call(fs34, target, uid, gid, function(er) { if (chownErOk(er)) er = null; if (cb) cb.apply(this, arguments); }); @@ -116694,7 +116694,7 @@ var require_polyfills = __commonJS({ if (!orig) return orig; return function(target, uid, gid) { try { - return orig.call(fs33, target, uid, gid); + return orig.call(fs34, target, uid, gid); } catch (er) { if (!chownErOk(er)) throw er; } @@ -116714,13 +116714,13 @@ var require_polyfills = __commonJS({ } if (cb) cb.apply(this, arguments); } - return options ? orig.call(fs33, target, options, callback) : orig.call(fs33, target, callback); + return options ? orig.call(fs34, target, options, callback) : orig.call(fs34, target, callback); }; } function statFixSync(orig) { if (!orig) return orig; return function(target, options) { - var stats = options ? orig.call(fs33, target, options) : orig.call(fs33, target); + var stats = options ? orig.call(fs34, target, options) : orig.call(fs34, target); if (stats) { if (stats.uid < 0) stats.uid += 4294967296; if (stats.gid < 0) stats.gid += 4294967296; @@ -116749,7 +116749,7 @@ var require_legacy_streams = __commonJS({ "node_modules/graceful-fs/legacy-streams.js"(exports2, module2) { var Stream = require("stream").Stream; module2.exports = legacy; - function legacy(fs33) { + function legacy(fs34) { return { ReadStream, WriteStream @@ -116792,7 +116792,7 @@ var require_legacy_streams = __commonJS({ }); return; } - fs33.open(this.path, this.flags, this.mode, function(err, fd) { + fs34.open(this.path, this.flags, this.mode, function(err, fd) { if (err) { self2.emit("error", err); self2.readable = false; @@ -116831,7 +116831,7 @@ var require_legacy_streams = __commonJS({ this.busy = false; this._queue = []; if (this.fd === null) { - this._open = fs33.open; + this._open = fs34.open; this._queue.push([this._open, this.path, this.flags, this.mode, void 0]); this.flush(); } @@ -116866,7 +116866,7 @@ var require_clone = __commonJS({ // node_modules/graceful-fs/graceful-fs.js var require_graceful_fs = __commonJS({ "node_modules/graceful-fs/graceful-fs.js"(exports2, module2) { - var fs33 = require("fs"); + var fs34 = require("fs"); var polyfills = require_polyfills(); var legacy = require_legacy_streams(); var clone = require_clone(); @@ -116898,12 +116898,12 @@ var require_graceful_fs = __commonJS({ m = "GFS4: " + m.split(/\n/).join("\nGFS4: "); console.error(m); }; - if (!fs33[gracefulQueue]) { + if (!fs34[gracefulQueue]) { queue2 = global[gracefulQueue] || []; - publishQueue(fs33, queue2); - fs33.close = (function(fs$close) { + publishQueue(fs34, queue2); + fs34.close = (function(fs$close) { function close(fd, cb) { - return fs$close.call(fs33, fd, function(err) { + return fs$close.call(fs34, fd, function(err) { if (!err) { resetQueue(); } @@ -116915,40 +116915,40 @@ var require_graceful_fs = __commonJS({ value: fs$close }); return close; - })(fs33.close); - fs33.closeSync = (function(fs$closeSync) { + })(fs34.close); + fs34.closeSync = (function(fs$closeSync) { function closeSync(fd) { - fs$closeSync.apply(fs33, arguments); + fs$closeSync.apply(fs34, arguments); resetQueue(); } Object.defineProperty(closeSync, previousSymbol, { value: fs$closeSync }); return closeSync; - })(fs33.closeSync); + })(fs34.closeSync); if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) { process.on("exit", function() { - debug6(fs33[gracefulQueue]); - require("assert").equal(fs33[gracefulQueue].length, 0); + debug6(fs34[gracefulQueue]); + require("assert").equal(fs34[gracefulQueue].length, 0); }); } } var queue2; if (!global[gracefulQueue]) { - publishQueue(global, fs33[gracefulQueue]); + publishQueue(global, fs34[gracefulQueue]); } - module2.exports = patch(clone(fs33)); - if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs33.__patched) { - module2.exports = patch(fs33); - fs33.__patched = true; + module2.exports = patch(clone(fs34)); + if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs34.__patched) { + module2.exports = patch(fs34); + fs34.__patched = true; } - function patch(fs34) { - polyfills(fs34); - fs34.gracefulify = patch; - fs34.createReadStream = createReadStream4; - fs34.createWriteStream = createWriteStream3; - var fs$readFile = fs34.readFile; - fs34.readFile = readFile; + function patch(fs35) { + polyfills(fs35); + fs35.gracefulify = patch; + fs35.createReadStream = createReadStream4; + fs35.createWriteStream = createWriteStream3; + var fs$readFile = fs35.readFile; + fs35.readFile = readFile; function readFile(path30, options, cb) { if (typeof options === "function") cb = options, options = null; @@ -116964,8 +116964,8 @@ var require_graceful_fs = __commonJS({ }); } } - var fs$writeFile = fs34.writeFile; - fs34.writeFile = writeFile; + var fs$writeFile = fs35.writeFile; + fs35.writeFile = writeFile; function writeFile(path30, data, options, cb) { if (typeof options === "function") cb = options, options = null; @@ -116981,9 +116981,9 @@ var require_graceful_fs = __commonJS({ }); } } - var fs$appendFile = fs34.appendFile; + var fs$appendFile = fs35.appendFile; if (fs$appendFile) - fs34.appendFile = appendFile; + fs35.appendFile = appendFile; function appendFile(path30, data, options, cb) { if (typeof options === "function") cb = options, options = null; @@ -116999,9 +116999,9 @@ var require_graceful_fs = __commonJS({ }); } } - var fs$copyFile = fs34.copyFile; + var fs$copyFile = fs35.copyFile; if (fs$copyFile) - fs34.copyFile = copyFile2; + fs35.copyFile = copyFile2; function copyFile2(src, dest, flags, cb) { if (typeof flags === "function") { cb = flags; @@ -117019,8 +117019,8 @@ var require_graceful_fs = __commonJS({ }); } } - var fs$readdir = fs34.readdir; - fs34.readdir = readdir3; + var fs$readdir = fs35.readdir; + fs35.readdir = readdir3; var noReaddirOptionVersions = /^v[0-5]\./; function readdir3(path30, options, cb) { if (typeof options === "function") @@ -117061,21 +117061,21 @@ var require_graceful_fs = __commonJS({ } } if (process.version.substr(0, 4) === "v0.8") { - var legStreams = legacy(fs34); + var legStreams = legacy(fs35); ReadStream = legStreams.ReadStream; WriteStream = legStreams.WriteStream; } - var fs$ReadStream = fs34.ReadStream; + var fs$ReadStream = fs35.ReadStream; if (fs$ReadStream) { ReadStream.prototype = Object.create(fs$ReadStream.prototype); ReadStream.prototype.open = ReadStream$open; } - var fs$WriteStream = fs34.WriteStream; + var fs$WriteStream = fs35.WriteStream; if (fs$WriteStream) { WriteStream.prototype = Object.create(fs$WriteStream.prototype); WriteStream.prototype.open = WriteStream$open; } - Object.defineProperty(fs34, "ReadStream", { + Object.defineProperty(fs35, "ReadStream", { get: function() { return ReadStream; }, @@ -117085,7 +117085,7 @@ var require_graceful_fs = __commonJS({ enumerable: true, configurable: true }); - Object.defineProperty(fs34, "WriteStream", { + Object.defineProperty(fs35, "WriteStream", { get: function() { return WriteStream; }, @@ -117096,7 +117096,7 @@ var require_graceful_fs = __commonJS({ configurable: true }); var FileReadStream = ReadStream; - Object.defineProperty(fs34, "FileReadStream", { + Object.defineProperty(fs35, "FileReadStream", { get: function() { return FileReadStream; }, @@ -117107,7 +117107,7 @@ var require_graceful_fs = __commonJS({ configurable: true }); var FileWriteStream = WriteStream; - Object.defineProperty(fs34, "FileWriteStream", { + Object.defineProperty(fs35, "FileWriteStream", { get: function() { return FileWriteStream; }, @@ -117156,13 +117156,13 @@ var require_graceful_fs = __commonJS({ }); } function createReadStream4(path30, options) { - return new fs34.ReadStream(path30, options); + return new fs35.ReadStream(path30, options); } function createWriteStream3(path30, options) { - return new fs34.WriteStream(path30, options); + return new fs35.WriteStream(path30, options); } - var fs$open = fs34.open; - fs34.open = open; + var fs$open = fs35.open; + fs35.open = open; function open(path30, flags, mode, cb) { if (typeof mode === "function") cb = mode, mode = null; @@ -117178,20 +117178,20 @@ var require_graceful_fs = __commonJS({ }); } } - return fs34; + return fs35; } function enqueue(elem) { debug6("ENQUEUE", elem[0].name, elem[1]); - fs33[gracefulQueue].push(elem); + fs34[gracefulQueue].push(elem); retry2(); } var retryTimer; function resetQueue() { var now = Date.now(); - for (var i = 0; i < fs33[gracefulQueue].length; ++i) { - if (fs33[gracefulQueue][i].length > 2) { - fs33[gracefulQueue][i][3] = now; - fs33[gracefulQueue][i][4] = now; + for (var i = 0; i < fs34[gracefulQueue].length; ++i) { + if (fs34[gracefulQueue][i].length > 2) { + fs34[gracefulQueue][i][3] = now; + fs34[gracefulQueue][i][4] = now; } } retry2(); @@ -117199,9 +117199,9 @@ var require_graceful_fs = __commonJS({ function retry2() { clearTimeout(retryTimer); retryTimer = void 0; - if (fs33[gracefulQueue].length === 0) + if (fs34[gracefulQueue].length === 0) return; - var elem = fs33[gracefulQueue].shift(); + var elem = fs34[gracefulQueue].shift(); var fn = elem[0]; var args = elem[1]; var err = elem[2]; @@ -117223,7 +117223,7 @@ var require_graceful_fs = __commonJS({ debug6("RETRY", fn.name, args); fn.apply(null, args.concat([startTime])); } else { - fs33[gracefulQueue].push(elem); + fs34[gracefulQueue].push(elem); } } if (retryTimer === void 0) { @@ -128046,7 +128046,7 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur g.minimatch.escape = vi.escape; g.minimatch.unescape = Ei.unescape; }); - var fs33 = R((Wt) => { + var fs34 = R((Wt) => { "use strict"; Object.defineProperty(Wt, "__esModule", { value: true }); Wt.LRUCache = void 0; @@ -128915,7 +128915,7 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur }; Object.defineProperty(_2, "__esModule", { value: true }); _2.PathScurry = _2.Path = _2.PathScurryDarwin = _2.PathScurryPosix = _2.PathScurryWin32 = _2.PathScurryBase = _2.PathPosix = _2.PathWin32 = _2.PathBase = _2.ChildrenCache = _2.ResolveCache = void 0; - var Qt = fs33(), Yt = require("node:path"), yr = require("node:url"), pt = require("fs"), Sr = br(require("node:fs")), vr = pt.realpathSync.native, Ht = require("node:fs/promises"), bs = Oe(), mt = { lstatSync: pt.lstatSync, readdir: pt.readdir, readdirSync: pt.readdirSync, readlinkSync: pt.readlinkSync, realpathSync: vr, promises: { lstat: Ht.lstat, readdir: Ht.readdir, readlink: Ht.readlink, realpath: Ht.realpath } }, _s2 = (n) => !n || n === mt || n === Sr ? mt : { ...mt, ...n, promises: { ...mt.promises, ...n.promises || {} } }, Os = /^\\\\\?\\([a-z]:)\\?$/i, Er = (n) => n.replace(/\//g, "\\").replace(Os, "$1\\"), _r2 = /[\\\/]/, N = 0, xs = 1, Ts = 2, G = 4, Cs = 6, Rs = 8, Q = 10, As = 12, j = 15, dt = ~j, xe = 16, ys = 32, gt = 64, W = 128, Vt = 256, Xt = 512, Ss = gt | W | Xt, Or = 1023, Te = (n) => n.isFile() ? Rs : n.isDirectory() ? G : n.isSymbolicLink() ? Q : n.isCharacterDevice() ? Ts : n.isBlockDevice() ? Cs : n.isSocket() ? As : n.isFIFO() ? xs : N, vs = new Qt.LRUCache({ max: 2 ** 12 }), wt = (n) => { + var Qt = fs34(), Yt = require("node:path"), yr = require("node:url"), pt = require("fs"), Sr = br(require("node:fs")), vr = pt.realpathSync.native, Ht = require("node:fs/promises"), bs = Oe(), mt = { lstatSync: pt.lstatSync, readdir: pt.readdir, readdirSync: pt.readdirSync, readlinkSync: pt.readlinkSync, realpathSync: vr, promises: { lstat: Ht.lstat, readdir: Ht.readdir, readlink: Ht.readlink, realpath: Ht.realpath } }, _s2 = (n) => !n || n === mt || n === Sr ? mt : { ...mt, ...n, promises: { ...mt.promises, ...n.promises || {} } }, Os = /^\\\\\?\\([a-z]:)\\?$/i, Er = (n) => n.replace(/\//g, "\\").replace(Os, "$1\\"), _r2 = /[\\\/]/, N = 0, xs = 1, Ts = 2, G = 4, Cs = 6, Rs = 8, Q = 10, As = 12, j = 15, dt = ~j, xe = 16, ys = 32, gt = 64, W = 128, Vt = 256, Xt = 512, Ss = gt | W | Xt, Or = 1023, Te = (n) => n.isFile() ? Rs : n.isDirectory() ? G : n.isSymbolicLink() ? Q : n.isCharacterDevice() ? Ts : n.isBlockDevice() ? Cs : n.isSocket() ? As : n.isFIFO() ? xs : N, vs = new Qt.LRUCache({ max: 2 ** 12 }), wt = (n) => { let t = vs.get(n); if (t) return t; let e = n.normalize("NFKD"); @@ -130293,7 +130293,7 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur // node_modules/archiver-utils/file.js var require_file3 = __commonJS({ "node_modules/archiver-utils/file.js"(exports2, module2) { - var fs33 = require_graceful_fs(); + var fs34 = require_graceful_fs(); var path30 = require("path"); var flatten = require_flatten(); var difference = require_difference(); @@ -130320,7 +130320,7 @@ var require_file3 = __commonJS({ }; file.exists = function() { var filepath = path30.join.apply(path30, arguments); - return fs33.existsSync(filepath); + return fs34.existsSync(filepath); }; file.expand = function(...args) { var options = isPlainObject4(args[0]) ? args.shift() : {}; @@ -130338,7 +130338,7 @@ var require_file3 = __commonJS({ if (typeof options.filter === "function") { return options.filter(filepath); } else { - return fs33.statSync(filepath)[options.filter](); + return fs34.statSync(filepath)[options.filter](); } } catch (e) { return false; @@ -130446,7 +130446,7 @@ var require_file3 = __commonJS({ // node_modules/archiver-utils/index.js var require_archiver_utils = __commonJS({ "node_modules/archiver-utils/index.js"(exports2, module2) { - var fs33 = require_graceful_fs(); + var fs34 = require_graceful_fs(); var path30 = require("path"); var isStream2 = require_is_stream(); var lazystream = require_lazystream(); @@ -130495,7 +130495,7 @@ var require_archiver_utils = __commonJS({ }; utils.lazyReadStream = function(filepath) { return new lazystream.Readable(function() { - return fs33.createReadStream(filepath); + return fs34.createReadStream(filepath); }); }; utils.normalizeInputSource = function(source) { @@ -130523,7 +130523,7 @@ var require_archiver_utils = __commonJS({ callback = base; base = dirpath; } - fs33.readdir(dirpath, function(err, list) { + fs34.readdir(dirpath, function(err, list) { var i = 0; var file; var filepath; @@ -130536,7 +130536,7 @@ var require_archiver_utils = __commonJS({ return callback(null, results); } filepath = path30.join(dirpath, file); - fs33.stat(filepath, function(err2, stats) { + fs34.stat(filepath, function(err2, stats) { results.push({ path: filepath, relative: path30.relative(base, filepath).replace(/\\/g, "/"), @@ -130598,7 +130598,7 @@ var require_error3 = __commonJS({ // node_modules/@actions/artifact/node_modules/archiver/lib/core.js var require_core2 = __commonJS({ "node_modules/@actions/artifact/node_modules/archiver/lib/core.js"(exports2, module2) { - var fs33 = require("fs"); + var fs34 = require("fs"); var glob2 = require_readdir_glob(); var async = require_async(); var path30 = require("path"); @@ -130662,7 +130662,7 @@ var require_core2 = __commonJS({ data.sourcePath = filepath; task.data = data; this._entriesCount++; - if (data.stats && data.stats instanceof fs33.Stats) { + if (data.stats && data.stats instanceof fs34.Stats) { task = this._updateQueueTaskWithStats(task, data.stats); if (task) { if (data.stats.size) { @@ -130833,7 +130833,7 @@ var require_core2 = __commonJS({ callback(); return; } - fs33.lstat(task.filepath, function(err, stats) { + fs34.lstat(task.filepath, function(err, stats) { if (this._state.aborted) { setImmediate(callback); return; @@ -130876,7 +130876,7 @@ var require_core2 = __commonJS({ task.data.sourceType = "buffer"; task.source = Buffer.concat([]); } else if (stats.isSymbolicLink() && this._moduleSupports("symlink")) { - var linkPath = fs33.readlinkSync(task.filepath); + var linkPath = fs34.readlinkSync(task.filepath); var dirName = path30.dirname(task.filepath); task.data.type = "symlink"; task.data.linkname = path30.relative(dirName, path30.resolve(dirName, linkPath)); @@ -141778,7 +141778,7 @@ var require_parser_stream = __commonJS({ var require_mkdirp = __commonJS({ "node_modules/mkdirp/index.js"(exports2, module2) { var path30 = require("path"); - var fs33 = require("fs"); + var fs34 = require("fs"); var _0777 = parseInt("0777", 8); module2.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP; function mkdirP(p, opts, f, made) { @@ -141789,7 +141789,7 @@ var require_mkdirp = __commonJS({ opts = { mode: opts }; } var mode = opts.mode; - var xfs = opts.fs || fs33; + var xfs = opts.fs || fs34; if (mode === void 0) { mode = _0777; } @@ -141828,7 +141828,7 @@ var require_mkdirp = __commonJS({ opts = { mode: opts }; } var mode = opts.mode; - var xfs = opts.fs || fs33; + var xfs = opts.fs || fs34; if (mode === void 0) { mode = _0777; } @@ -141865,7 +141865,7 @@ var require_mkdirp = __commonJS({ // node_modules/unzip-stream/lib/extract.js var require_extract2 = __commonJS({ "node_modules/unzip-stream/lib/extract.js"(exports2, module2) { - var fs33 = require("fs"); + var fs34 = require("fs"); var path30 = require("path"); var util4 = require("util"); var mkdirp = require_mkdirp(); @@ -141912,7 +141912,7 @@ var require_extract2 = __commonJS({ var directory = entry.isDirectory ? destPath : path30.dirname(destPath); this.unfinishedEntries++; var writeFileFn = function() { - var pipedStream = fs33.createWriteStream(destPath); + var pipedStream = fs34.createWriteStream(destPath); pipedStream.on("close", function() { self2.unfinishedEntries--; self2._notifyAwaiter(); @@ -143110,7 +143110,7 @@ var require_file_command2 = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.prepareKeyValueMessage = exports2.issueFileCommand = void 0; var crypto3 = __importStar2(require("crypto")); - var fs33 = __importStar2(require("fs")); + var fs34 = __importStar2(require("fs")); var os8 = __importStar2(require("os")); var utils_1 = require_utils11(); function issueFileCommand(command, message) { @@ -143118,10 +143118,10 @@ var require_file_command2 = __commonJS({ if (!filePath) { throw new Error(`Unable to find environment variable for file command ${command}`); } - if (!fs33.existsSync(filePath)) { + if (!fs34.existsSync(filePath)) { throw new Error(`Missing file at path: ${filePath}`); } - fs33.appendFileSync(filePath, `${(0, utils_1.toCommandValue)(message)}${os8.EOL}`, { + fs34.appendFileSync(filePath, `${(0, utils_1.toCommandValue)(message)}${os8.EOL}`, { encoding: "utf8" }); } @@ -144444,12 +144444,12 @@ var require_io_util2 = __commonJS({ var _a6; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.getCmdPath = exports2.tryGetExecutablePath = exports2.isRooted = exports2.isDirectory = exports2.exists = exports2.READONLY = exports2.UV_FS_O_EXLOCK = exports2.IS_WINDOWS = exports2.unlink = exports2.symlink = exports2.stat = exports2.rmdir = exports2.rm = exports2.rename = exports2.readlink = exports2.readdir = exports2.open = exports2.mkdir = exports2.lstat = exports2.copyFile = exports2.chmod = void 0; - var fs33 = __importStar2(require("fs")); + var fs34 = __importStar2(require("fs")); var path30 = __importStar2(require("path")); - _a6 = fs33.promises, exports2.chmod = _a6.chmod, exports2.copyFile = _a6.copyFile, exports2.lstat = _a6.lstat, exports2.mkdir = _a6.mkdir, exports2.open = _a6.open, exports2.readdir = _a6.readdir, exports2.readlink = _a6.readlink, exports2.rename = _a6.rename, exports2.rm = _a6.rm, exports2.rmdir = _a6.rmdir, exports2.stat = _a6.stat, exports2.symlink = _a6.symlink, exports2.unlink = _a6.unlink; + _a6 = fs34.promises, exports2.chmod = _a6.chmod, exports2.copyFile = _a6.copyFile, exports2.lstat = _a6.lstat, exports2.mkdir = _a6.mkdir, exports2.open = _a6.open, exports2.readdir = _a6.readdir, exports2.readlink = _a6.readlink, exports2.rename = _a6.rename, exports2.rm = _a6.rm, exports2.rmdir = _a6.rmdir, exports2.stat = _a6.stat, exports2.symlink = _a6.symlink, exports2.unlink = _a6.unlink; exports2.IS_WINDOWS = process.platform === "win32"; exports2.UV_FS_O_EXLOCK = 268435456; - exports2.READONLY = fs33.constants.O_RDONLY; + exports2.READONLY = fs34.constants.O_RDONLY; function exists(fsPath) { return __awaiter2(this, void 0, void 0, function* () { try { @@ -145838,25 +145838,25 @@ var require_upload_specification = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.getUploadSpecification = void 0; - var fs33 = __importStar2(require("fs")); + var fs34 = __importStar2(require("fs")); var core_1 = require_core3(); var path_1 = require("path"); var path_and_artifact_name_validation_1 = require_path_and_artifact_name_validation2(); function getUploadSpecification(artifactName, rootDirectory, artifactFiles) { const specifications = []; - if (!fs33.existsSync(rootDirectory)) { + if (!fs34.existsSync(rootDirectory)) { throw new Error(`Provided rootDirectory ${rootDirectory} does not exist`); } - if (!fs33.statSync(rootDirectory).isDirectory()) { + if (!fs34.statSync(rootDirectory).isDirectory()) { throw new Error(`Provided rootDirectory ${rootDirectory} is not a valid directory`); } rootDirectory = (0, path_1.normalize)(rootDirectory); rootDirectory = (0, path_1.resolve)(rootDirectory); for (let file of artifactFiles) { - if (!fs33.existsSync(file)) { + if (!fs34.existsSync(file)) { throw new Error(`File ${file} does not exist`); } - if (!fs33.statSync(file).isDirectory()) { + if (!fs34.statSync(file).isDirectory()) { file = (0, path_1.normalize)(file); file = (0, path_1.resolve)(file); if (!file.startsWith(rootDirectory)) { @@ -145881,11 +145881,11 @@ var require_upload_specification = __commonJS({ // node_modules/tmp/lib/tmp.js var require_tmp = __commonJS({ "node_modules/tmp/lib/tmp.js"(exports2, module2) { - var fs33 = require("fs"); + var fs34 = require("fs"); var os8 = require("os"); var path30 = require("path"); var crypto3 = require("crypto"); - var _c2 = { fs: fs33.constants, os: os8.constants }; + var _c2 = { fs: fs34.constants, os: os8.constants }; var RANDOM_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; var TEMPLATE_PATTERN = /XXXXXX/; var DEFAULT_TRIES = 3; @@ -145897,13 +145897,13 @@ var require_tmp = __commonJS({ var FILE_MODE = 384; var EXIT = "exit"; var _removeObjects = []; - var FN_RMDIR_SYNC = fs33.rmdirSync.bind(fs33); + var FN_RMDIR_SYNC = fs34.rmdirSync.bind(fs34); var _gracefulCleanup = false; function rimraf(dirPath, callback) { - return fs33.rm(dirPath, { recursive: true }, callback); + return fs34.rm(dirPath, { recursive: true }, callback); } function FN_RIMRAF_SYNC(dirPath) { - return fs33.rmSync(dirPath, { recursive: true }); + return fs34.rmSync(dirPath, { recursive: true }); } function tmpName(options, callback) { const args = _parseArguments(options, callback), opts = args[0], cb = args[1]; @@ -145913,7 +145913,7 @@ var require_tmp = __commonJS({ (function _getUniqueName() { try { const name = _generateTmpName(sanitizedOptions); - fs33.stat(name, function(err2) { + fs34.stat(name, function(err2) { if (!err2) { if (tries-- > 0) return _getUniqueName(); return cb(new Error("Could not get a unique tmp filename, max tries reached " + name)); @@ -145933,7 +145933,7 @@ var require_tmp = __commonJS({ do { const name = _generateTmpName(sanitizedOptions); try { - fs33.statSync(name); + fs34.statSync(name); } catch (e) { return name; } @@ -145944,10 +145944,10 @@ var require_tmp = __commonJS({ const args = _parseArguments(options, callback), opts = args[0], cb = args[1]; tmpName(opts, function _tmpNameCreated(err, name) { if (err) return cb(err); - fs33.open(name, CREATE_FLAGS, opts.mode || FILE_MODE, function _fileCreated(err2, fd) { + fs34.open(name, CREATE_FLAGS, opts.mode || FILE_MODE, function _fileCreated(err2, fd) { if (err2) return cb(err2); if (opts.discardDescriptor) { - return fs33.close(fd, function _discardCallback(possibleErr) { + return fs34.close(fd, function _discardCallback(possibleErr) { return cb(possibleErr, name, void 0, _prepareTmpFileRemoveCallback(name, -1, opts, false)); }); } else { @@ -145961,9 +145961,9 @@ var require_tmp = __commonJS({ const args = _parseArguments(options), opts = args[0]; const discardOrDetachDescriptor = opts.discardDescriptor || opts.detachDescriptor; const name = tmpNameSync(opts); - let fd = fs33.openSync(name, CREATE_FLAGS, opts.mode || FILE_MODE); + let fd = fs34.openSync(name, CREATE_FLAGS, opts.mode || FILE_MODE); if (opts.discardDescriptor) { - fs33.closeSync(fd); + fs34.closeSync(fd); fd = void 0; } return { @@ -145976,7 +145976,7 @@ var require_tmp = __commonJS({ const args = _parseArguments(options, callback), opts = args[0], cb = args[1]; tmpName(opts, function _tmpNameCreated(err, name) { if (err) return cb(err); - fs33.mkdir(name, opts.mode || DIR_MODE, function _dirCreated(err2) { + fs34.mkdir(name, opts.mode || DIR_MODE, function _dirCreated(err2) { if (err2) return cb(err2); cb(null, name, _prepareTmpDirRemoveCallback(name, opts, false)); }); @@ -145985,7 +145985,7 @@ var require_tmp = __commonJS({ function dirSync(options) { const args = _parseArguments(options), opts = args[0]; const name = tmpNameSync(opts); - fs33.mkdirSync(name, opts.mode || DIR_MODE); + fs34.mkdirSync(name, opts.mode || DIR_MODE); return { name, removeCallback: _prepareTmpDirRemoveCallback(name, opts, true) @@ -145999,20 +145999,20 @@ var require_tmp = __commonJS({ next(); }; if (0 <= fdPath[0]) - fs33.close(fdPath[0], function() { - fs33.unlink(fdPath[1], _handler); + fs34.close(fdPath[0], function() { + fs34.unlink(fdPath[1], _handler); }); - else fs33.unlink(fdPath[1], _handler); + else fs34.unlink(fdPath[1], _handler); } function _removeFileSync(fdPath) { let rethrownException = null; try { - if (0 <= fdPath[0]) fs33.closeSync(fdPath[0]); + if (0 <= fdPath[0]) fs34.closeSync(fdPath[0]); } catch (e) { if (!_isEBADF(e) && !_isENOENT(e)) throw e; } finally { try { - fs33.unlinkSync(fdPath[1]); + fs34.unlinkSync(fdPath[1]); } catch (e) { if (!_isENOENT(e)) rethrownException = e; } @@ -146028,7 +146028,7 @@ var require_tmp = __commonJS({ return sync ? removeCallbackSync : removeCallback; } function _prepareTmpDirRemoveCallback(name, opts, sync) { - const removeFunction = opts.unsafeCleanup ? rimraf : fs33.rmdir.bind(fs33); + const removeFunction = opts.unsafeCleanup ? rimraf : fs34.rmdir.bind(fs34); const removeFunctionSync = opts.unsafeCleanup ? FN_RIMRAF_SYNC : FN_RMDIR_SYNC; const removeCallbackSync = _prepareRemoveCallback(removeFunctionSync, name, sync); const removeCallback = _prepareRemoveCallback(removeFunction, name, sync, removeCallbackSync); @@ -146091,24 +146091,24 @@ var require_tmp = __commonJS({ } function _resolvePath(name, tmpDir, cb) { const pathToResolve = path30.isAbsolute(name) ? name : path30.join(tmpDir, name); - fs33.stat(pathToResolve, function(err) { + fs34.stat(pathToResolve, function(err) { if (err) { - fs33.realpath(path30.dirname(pathToResolve), function(err2, parentDir) { + fs34.realpath(path30.dirname(pathToResolve), function(err2, parentDir) { if (err2) return cb(err2); cb(null, path30.join(parentDir, path30.basename(pathToResolve))); }); } else { - fs33.realpath(pathToResolve, cb); + fs34.realpath(pathToResolve, cb); } }); } function _resolvePathSync(name, tmpDir) { const pathToResolve = path30.isAbsolute(name) ? name : path30.join(tmpDir, name); try { - fs33.statSync(pathToResolve); - return fs33.realpathSync(pathToResolve); + fs34.statSync(pathToResolve); + return fs34.realpathSync(pathToResolve); } catch (_err) { - const parentDir = fs33.realpathSync(path30.dirname(pathToResolve)); + const parentDir = fs34.realpathSync(path30.dirname(pathToResolve)); return path30.join(parentDir, path30.basename(pathToResolve)); } } @@ -146229,10 +146229,10 @@ var require_tmp = __commonJS({ _gracefulCleanup = true; } function _getTmpDir(options, cb) { - return fs33.realpath(options && options.tmpdir || os8.tmpdir(), cb); + return fs34.realpath(options && options.tmpdir || os8.tmpdir(), cb); } function _getTmpDirSync(options) { - return fs33.realpathSync(options && options.tmpdir || os8.tmpdir()); + return fs34.realpathSync(options && options.tmpdir || os8.tmpdir()); } process.addListener(EXIT, _garbageCollector); Object.defineProperty(module2.exports, "tmpdir", { @@ -147086,10 +147086,10 @@ var require_upload_gzip = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.createGZipFileInBuffer = exports2.createGZipFileOnDisk = void 0; - var fs33 = __importStar2(require("fs")); + var fs34 = __importStar2(require("fs")); var zlib3 = __importStar2(require("zlib")); var util_1 = require("util"); - var stat2 = (0, util_1.promisify)(fs33.stat); + var stat2 = (0, util_1.promisify)(fs34.stat); var gzipExemptFileExtensions = [ ".gz", ".gzip", @@ -147122,9 +147122,9 @@ var require_upload_gzip = __commonJS({ } } return new Promise((resolve14, reject) => { - const inputStream = fs33.createReadStream(originalFilePath); + const inputStream = fs34.createReadStream(originalFilePath); const gzip = zlib3.createGzip(); - const outputStream = fs33.createWriteStream(tempFilePath); + const outputStream = fs34.createWriteStream(tempFilePath); inputStream.pipe(gzip).pipe(outputStream); outputStream.on("finish", () => __awaiter2(this, void 0, void 0, function* () { const size = (yield stat2(tempFilePath)).size; @@ -147142,7 +147142,7 @@ var require_upload_gzip = __commonJS({ return __awaiter2(this, void 0, void 0, function* () { return new Promise((resolve14) => __awaiter2(this, void 0, void 0, function* () { var _a6, e_1, _b2, _c2; - const inputStream = fs33.createReadStream(originalFilePath); + const inputStream = fs34.createReadStream(originalFilePath); const gzip = zlib3.createGzip(); inputStream.pipe(gzip); const chunks = []; @@ -147351,7 +147351,7 @@ var require_upload_http_client = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.UploadHttpClient = void 0; - var fs33 = __importStar2(require("fs")); + var fs34 = __importStar2(require("fs")); var core29 = __importStar2(require_core3()); var tmp2 = __importStar2(require_tmp_promise()); var stream2 = __importStar2(require("stream")); @@ -147365,7 +147365,7 @@ var require_upload_http_client = __commonJS({ var http_manager_1 = require_http_manager(); var upload_gzip_1 = require_upload_gzip(); var requestUtils_1 = require_requestUtils2(); - var stat2 = (0, util_1.promisify)(fs33.stat); + var stat2 = (0, util_1.promisify)(fs34.stat); var UploadHttpClient = class { constructor() { this.uploadHttpManager = new http_manager_1.HttpManager((0, config_variables_1.getUploadFileConcurrency)(), "@actions/artifact-upload"); @@ -147502,7 +147502,7 @@ var require_upload_http_client = __commonJS({ let openUploadStream; if (totalFileSize < buffer.byteLength) { core29.debug(`The gzip file created for ${parameters.file} did not help with reducing the size of the file. The original file will be uploaded as-is`); - openUploadStream = () => fs33.createReadStream(parameters.file); + openUploadStream = () => fs34.createReadStream(parameters.file); isGzip = false; uploadFileSize = totalFileSize; } else { @@ -147548,7 +147548,7 @@ var require_upload_http_client = __commonJS({ failedChunkSizes += chunkSize; continue; } - const result = yield this.uploadChunk(httpClientIndex, parameters.resourceUrl, () => fs33.createReadStream(uploadFilePath, { + const result = yield this.uploadChunk(httpClientIndex, parameters.resourceUrl, () => fs34.createReadStream(uploadFilePath, { start: startChunkIndex, end: endChunkIndex, autoClose: false @@ -147743,7 +147743,7 @@ var require_download_http_client = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.DownloadHttpClient = void 0; - var fs33 = __importStar2(require("fs")); + var fs34 = __importStar2(require("fs")); var core29 = __importStar2(require_core3()); var zlib3 = __importStar2(require("zlib")); var utils_1 = require_utils12(); @@ -147834,7 +147834,7 @@ var require_download_http_client = __commonJS({ return __awaiter2(this, void 0, void 0, function* () { let retryCount = 0; const retryLimit = (0, config_variables_1.getRetryLimit)(); - let destinationStream = fs33.createWriteStream(downloadPath); + let destinationStream = fs34.createWriteStream(downloadPath); const headers = (0, utils_1.getDownloadHeaders)("application/json", true, true); const makeDownloadRequest = () => __awaiter2(this, void 0, void 0, function* () { const client = this.downloadHttpManager.getClient(httpClientIndex); @@ -147876,7 +147876,7 @@ var require_download_http_client = __commonJS({ } }); yield (0, utils_1.rmFile)(fileDownloadPath); - destinationStream = fs33.createWriteStream(fileDownloadPath); + destinationStream = fs34.createWriteStream(fileDownloadPath); }); while (retryCount <= retryLimit) { let response; @@ -166228,21 +166228,21 @@ async function getFolderSize(itemPath, options) { getFolderSize.loose = async (itemPath, options) => await core2(itemPath, options); getFolderSize.strict = async (itemPath, options) => await core2(itemPath, options, { strict: true }); async function core2(rootItemPath, options = {}, returnType = {}) { - const fs33 = options.fs || await import("node:fs/promises"); + const fs34 = options.fs || await import("node:fs/promises"); let folderSize = 0n; const foundInos = /* @__PURE__ */ new Set(); const errors = []; await processItem(rootItemPath); async function processItem(itemPath) { if (options.ignore?.test(itemPath)) return; - const stats = returnType.strict ? await fs33.lstat(itemPath, { bigint: true }) : await fs33.lstat(itemPath, { bigint: true }).catch((error3) => errors.push(error3)); + const stats = returnType.strict ? await fs34.lstat(itemPath, { bigint: true }) : await fs34.lstat(itemPath, { bigint: true }).catch((error3) => errors.push(error3)); if (typeof stats !== "object") return; if (!foundInos.has(stats.ino)) { foundInos.add(stats.ino); folderSize += stats.size; } if (stats.isDirectory()) { - const directoryItems = returnType.strict ? await fs33.readdir(itemPath) : await fs33.readdir(itemPath).catch((error3) => errors.push(error3)); + const directoryItems = returnType.strict ? await fs34.readdir(itemPath) : await fs34.readdir(itemPath).catch((error3) => errors.push(error3)); if (typeof directoryItems !== "object") return; await Promise.all( directoryItems.map( @@ -186008,7 +186008,7 @@ async function runWrapper3() { } // src/init-action.ts -var fs30 = __toESM(require("fs")); +var fs31 = __toESM(require("fs")); var path25 = __toESM(require("path")); var core19 = __toESM(require_core()); var io7 = __toESM(require_io()); @@ -186049,12 +186049,85 @@ async function getToolsInput(action, repositoryProperties) { } // src/languages/swift.ts +var fs29 = __toESM(require("fs")); var semver11 = __toESM(require_semver2()); +var XCODE_SELECT_LINK_PATH = "/private/var/db/xcode_select_link"; var XCODE_APP_FILENAME_PATTERN = new RegExp( /(?Xcode_(?\d+.\d+).app)/ ); var SWIFT_TRACED_UNSUPPORTED_MACOS = 27; var SWIFT_TRACED_UNSUPPORTED_XCODE = 27; +function xcodeVersion(logger2) { + try { + const stats = fs29.statSync(XCODE_SELECT_LINK_PATH); + if (!stats.isSymbolicLink()) { + logger2.warning( + `${XCODE_SELECT_LINK_PATH} exists, but is not a symbolic link.` + ); + return void 0; + } + const xcodePath = fs29.readlinkSync(XCODE_SELECT_LINK_PATH); + if (xcodePath === "") { + logger2.warning( + `Resolving ${XCODE_SELECT_LINK_PATH} unexpectedly returned nothing.` + ); + return void 0; + } + const matchResult = xcodePath.match(XCODE_APP_FILENAME_PATTERN); + if (matchResult?.groups === void 0) { + logger2.warning( + `Xcode path '${xcodePath}' does not contain expected pattern.` + ); + return void 0; + } + const majorMinor = matchResult.groups["majorMinor"]; + const version = semver11.coerce(majorMinor); + if (version === null) { + logger2.warning(`Couldn't parse '${majorMinor}' as a semantic version.`); + return void 0; + } + return version; + } catch (err) { + logger2.warning( + `Unable to determine Xcode version: ${getErrorMessage(err)}` + ); + return void 0; + } +} +function handleUnsupportedVersion(logger2, config, skipUnsupportedTracedAnalysis, product, version) { + const baseMessage = [ + `Traced Swift analysis is not supported on ${product} ${SWIFT_TRACED_UNSUPPORTED_MACOS} or above.`, + `Configure your analysis to run on macOS ${SWIFT_TRACED_UNSUPPORTED_MACOS - 1} or below`, + `and XCode ${SWIFT_TRACED_UNSUPPORTED_XCODE - 1} or below.` + ].join(" "); + const attributeName = product === "macOS" ? "macOSVersion" : "xcodeVersion"; + addDiagnostic( + config, + "swift" /* swift */, + makeDiagnostic( + `codeql-action/unsupported-traced-swift-analysis-${product.toLowerCase()}`, + `Traced Swift analysis is not supported on this version of ${product}`, + { + attributes: { + languages: config.languages, + [attributeName]: version.toString() + }, + markdownMessage: baseMessage, + severity: skipUnsupportedTracedAnalysis ? "error" : "warning", + visibility: { + cliSummaryTable: true, + statusPage: true, + telemetry: true + } + } + ) + ); + if (skipUnsupportedTracedAnalysis) { + throw new ConfigurationError(baseMessage); + } else { + logger2.warning(baseMessage); + } +} async function isSwiftCompatible(action, config, codeql) { if (!config.languages.includes("swift" /* swift */)) { return; @@ -186068,47 +186141,31 @@ async function isSwiftCompatible(action, config, codeql) { `Swift analysis is only supported on macOS runner images. Please migrate to a macOS runner.` ); } + const skipUnsupportedTracedAnalysis = await action.features.getValue( + "swift_skip_unsupported_traced_analysis" /* SwiftSkipUnsupportedTracedAnalysis */ + ); if (typeof version === "string") { action.logger.warning( `Unable to determine version of macOS, got: ${version}` ); - return; - } - const skipUnsupportedTracedAnalysis = await action.features.getValue( - "swift_skip_unsupported_traced_analysis" /* SwiftSkipUnsupportedTracedAnalysis */ - ); - if (version.major >= SWIFT_TRACED_UNSUPPORTED_MACOS) { - const baseMessage = [ - `Traced Swift analysis is not supported on macOS ${SWIFT_TRACED_UNSUPPORTED_MACOS} or above.`, - `Configure your analysis to run on macOS ${SWIFT_TRACED_UNSUPPORTED_MACOS - 1} or below`, - `and XCode ${SWIFT_TRACED_UNSUPPORTED_XCODE - 1} or below.` - ].join(" "); - addDiagnostic( + } else if (version.major >= SWIFT_TRACED_UNSUPPORTED_MACOS) { + handleUnsupportedVersion( + action.logger, config, - "swift" /* swift */, - makeDiagnostic( - "codeql-action/unsupported-traced-swift-analysis-macos", - "Traced Swift analysis is not supported on this version of macOS", - { - attributes: { - languages: config.languages, - macOSVersion: version.toString() - }, - markdownMessage: baseMessage, - severity: skipUnsupportedTracedAnalysis ? "error" : "warning", - visibility: { - cliSummaryTable: true, - statusPage: true, - telemetry: true - } - } - ) + skipUnsupportedTracedAnalysis, + "macOS", + version + ); + } + const xcodeVer = xcodeVersion(action.logger); + if (xcodeVer !== void 0 && xcodeVer.major >= SWIFT_TRACED_UNSUPPORTED_XCODE) { + handleUnsupportedVersion( + action.logger, + config, + skipUnsupportedTracedAnalysis, + "Xcode", + xcodeVer ); - if (skipUnsupportedTracedAnalysis) { - throw new ConfigurationError(baseMessage); - } else { - action.logger.warning(baseMessage); - } } } @@ -186131,7 +186188,7 @@ function createInitToolsDownloadFields(report, toolsFeatureFlagsValid) { } // src/workflow.ts -var fs29 = __toESM(require("fs")); +var fs30 = __toESM(require("fs")); var path24 = __toESM(require("path")); var import_zlib3 = __toESM(require("zlib")); var core18 = __toESM(require_core()); @@ -186283,7 +186340,7 @@ async function getWorkflow(logger2) { ); } const workflowPath = await getWorkflowAbsolutePath(logger2); - return load(fs29.readFileSync(workflowPath, "utf-8")); + return load(fs30.readFileSync(workflowPath, "utf-8")); } async function getWorkflowAbsolutePath(logger2) { const relativePath2 = await getWorkflowRelativePath(); @@ -186291,7 +186348,7 @@ async function getWorkflowAbsolutePath(logger2) { getRequiredEnvParam("GITHUB_WORKSPACE"), relativePath2 ); - if (fs29.existsSync(absolutePath)) { + if (fs30.existsSync(absolutePath)) { logger2.debug( `Derived the following absolute path for the currently executing workflow: ${absolutePath}.` ); @@ -186726,16 +186783,16 @@ async function run3(actionState) { "codeql-action-go-tracing", "bin" ); - fs30.mkdirSync(tempBinPath, { recursive: true }); + fs31.mkdirSync(tempBinPath, { recursive: true }); core19.addPath(tempBinPath); const goWrapperPath = path25.resolve(tempBinPath, "go"); - fs30.writeFileSync( + fs31.writeFileSync( goWrapperPath, `#!/bin/bash exec ${goBinaryPath} "$@"` ); - fs30.chmodSync(goWrapperPath, "755"); + fs31.chmodSync(goWrapperPath, "755"); actionState.env.export("CODEQL_ACTION_GO_BINARY" /* GO_BINARY_LOCATION */, goWrapperPath); } catch (e) { logger2.warning( @@ -186917,7 +186974,7 @@ async function runWrapper4() { var core20 = __toESM(require_core()); // src/init-action-post-helper.ts -var fs31 = __toESM(require("fs")); +var fs32 = __toESM(require("fs")); var import_path8 = __toESM(require("path")); var github4 = __toESM(require_github()); function createFailedUploadFailedSarifResult(error3) { @@ -186990,7 +187047,7 @@ async function generateFailedSarif(logger2, features, config, category, checkout let diagnosticDir = getTempDiagnosticPath( config.tempDir ); - if (!fs31.existsSync(diagnosticDir)) { + if (!fs32.existsSync(diagnosticDir)) { diagnosticDir = void 0; } await codeql.diagnosticsExport(sarifFile, category, config, diagnosticDir); @@ -187107,7 +187164,7 @@ async function uploadFailureInfo(uploadAllAvailableDebugArtifacts, printDebugLog } if (isSelfHostedRunner() && config.dbLocation) { try { - fs31.rmSync(config.dbLocation, { + fs32.rmSync(config.dbLocation, { recursive: true, force: true, maxRetries: 3 @@ -188035,7 +188092,7 @@ function generateCertificateAuthority() { } // src/start-proxy/environment.ts -var fs32 = __toESM(require("fs")); +var fs33 = __toESM(require("fs")); var path28 = __toESM(require("path")); var toolrunner5 = __toESM(require_toolrunner()); var io8 = __toESM(require_io()); @@ -188108,9 +188165,9 @@ function checkJdkSettings(logger2, jdkHome) { for (const fileToCheck of filesToCheck) { const file = path28.join(jdkHome, fileToCheck); try { - if (fs32.existsSync(file)) { + if (fs33.existsSync(file)) { logger2.debug(`Found '${file}'.`); - const lines = String(fs32.readFileSync(file)).split("\n"); + const lines = String(fs33.readFileSync(file)).split("\n"); for (const line of lines) { for (const property of javaProperties) { if (line.startsWith(`${property}=`)) { diff --git a/src/languages/swift.test.ts b/src/languages/swift.test.ts index c45d97c90..89e15f807 100644 --- a/src/languages/swift.test.ts +++ b/src/languages/swift.test.ts @@ -9,6 +9,7 @@ import { ActionsEnvVars } from "../environment"; import { Feature } from "../feature-flags"; import { checkExpectedLogMessages, + checkUnexpectedLogMessages, createFeatures, createTestConfig, getTestEnv, @@ -379,3 +380,196 @@ test.serial( ]); }), ); + +// `addDiagnostic` changes global state and we must stub it, so this test must be serial. +test.serial( + "isSwiftCompatible doesn't add a diagnostic if Xcode version is supported", + async (t) => + withTmpDir(async (tmpDir) => { + const logger = new RecordingLogger(); + const env = getTestEnv(); + env.set(ActionsEnvVars.RUNNER_TEMP, tmpDir); + + const statSync = sinon + .stub(fs, "statSync") + .returns({ isSymbolicLink: () => true } as fs.Stats); + const readlinkSync = sinon + .stub(fs, "readlinkSync") + .returns("/Applications/Xcode_26.0.app/Contents/Developer"); + + const codeql = await getCodeQLForTesting( + "codeql-for-testing", + logger, + env, + ); + sinon.stub(codeql, "getVersion").resolves(makeVersionInfo("2.27.0")); + + const addDiagnostic = sinon.stub(diagnostics, "addDiagnostic"); + + const config = createTestConfig({ languages: [BuiltInLanguage.swift] }); + await isSwiftCompatible( + initAllState({ + logger, + platform: "darwin", + osRelease: "26.0.0", + env, + }), + config, + codeql, + ); + + t.is(statSync.callCount, 1); + t.deepEqual(statSync.args[0], [XCODE_SELECT_LINK_PATH]); + t.is(readlinkSync.callCount, 1); + t.deepEqual(readlinkSync.args[0], [XCODE_SELECT_LINK_PATH]); + + checkUnexpectedLogMessages(t, logger.messages, [ + "Traced Swift analysis is not supported on Xcode 27", + ]); + + t.is(addDiagnostic.callCount, 0); + }), +); + +// `addDiagnostic` changes global state and we must stub it, so this test must be serial. +test.serial( + "isSwiftCompatible logs and adds diagnostic if Xcode version is unsupported", + async (t) => + withTmpDir(async (tmpDir) => { + const logger = new RecordingLogger(); + const env = getTestEnv(); + env.set(ActionsEnvVars.RUNNER_TEMP, tmpDir); + + const statSync = sinon + .stub(fs, "statSync") + .returns({ isSymbolicLink: () => true } as fs.Stats); + const readlinkSync = sinon + .stub(fs, "readlinkSync") + .returns("/Applications/Xcode_27.0.app/Contents/Developer"); + + const codeql = await getCodeQLForTesting( + "codeql-for-testing", + logger, + env, + ); + sinon.stub(codeql, "getVersion").resolves(makeVersionInfo("2.27.0")); + + const addDiagnostic = sinon.stub(diagnostics, "addDiagnostic"); + + const config = createTestConfig({ languages: [BuiltInLanguage.swift] }); + await isSwiftCompatible( + initAllState({ + logger, + platform: "darwin", + osRelease: "26.0.0", + env, + }), + config, + codeql, + ); + + t.is(statSync.callCount, 1); + t.deepEqual(statSync.args[0], [XCODE_SELECT_LINK_PATH]); + t.is(readlinkSync.callCount, 1); + t.deepEqual(readlinkSync.args[0], [XCODE_SELECT_LINK_PATH]); + + checkExpectedLogMessages(t, logger.messages, [ + "Traced Swift analysis is not supported on Xcode 27", + ]); + + t.is(addDiagnostic.callCount, 1); + t.like(addDiagnostic.args[0], [ + config, + BuiltInLanguage.swift, + { + attributes: { + languages: [BuiltInLanguage.swift], + xcodeVersion: "27.0.0", + }, + severity: "warning", + source: { + id: "codeql-action/unsupported-traced-swift-analysis-xcode", + name: "Traced Swift analysis is not supported on this version of Xcode", + }, + visibility: { + cliSummaryTable: true, + statusPage: true, + telemetry: true, + }, + } satisfies Partial, + ]); + }), +); + +// `addDiagnostic` changes global state and we must stub it, so this test must be serial. +test.serial( + "isSwiftCompatible throws if Xcode version is unsupported and FF is enabled", + async (t) => + withTmpDir(async (tmpDir) => { + const logger = new RecordingLogger(); + const env = getTestEnv(); + env.set(ActionsEnvVars.RUNNER_TEMP, tmpDir); + + const statSync = sinon + .stub(fs, "statSync") + .returns({ isSymbolicLink: () => true } as fs.Stats); + const readlinkSync = sinon + .stub(fs, "readlinkSync") + .returns("/Applications/Xcode_27.0.app/Contents/Developer"); + + const features = createFeatures([ + Feature.SwiftSkipUnsupportedTracedAnalysis, + ]); + + const codeql = await getCodeQLForTesting( + "codeql-for-testing", + logger, + env, + ); + sinon.stub(codeql, "getVersion").resolves(makeVersionInfo("2.27.0")); + + const addDiagnostic = sinon.stub(diagnostics, "addDiagnostic"); + + const config = createTestConfig({ languages: [BuiltInLanguage.swift] }); + await t.throwsAsync( + isSwiftCompatible( + initAllState({ + logger, + platform: "darwin", + osRelease: "26.0.0", + env, + features, + }), + config, + codeql, + ), + ); + + t.is(statSync.callCount, 1); + t.deepEqual(statSync.args[0], [XCODE_SELECT_LINK_PATH]); + t.is(readlinkSync.callCount, 1); + t.deepEqual(readlinkSync.args[0], [XCODE_SELECT_LINK_PATH]); + + t.is(addDiagnostic.callCount, 1); + t.like(addDiagnostic.args[0], [ + config, + BuiltInLanguage.swift, + { + attributes: { + languages: [BuiltInLanguage.swift], + xcodeVersion: "27.0.0", + }, + severity: "error", + source: { + id: "codeql-action/unsupported-traced-swift-analysis-xcode", + name: "Traced Swift analysis is not supported on this version of Xcode", + }, + visibility: { + cliSummaryTable: true, + statusPage: true, + telemetry: true, + }, + } satisfies Partial, + ]); + }), +); diff --git a/src/languages/swift.ts b/src/languages/swift.ts index 7e70f113c..a35f9c30e 100644 --- a/src/languages/swift.ts +++ b/src/languages/swift.ts @@ -83,6 +83,66 @@ export function xcodeVersion(logger: Logger): semver.SemVer | undefined { } } +/** + * Creates a diagnostic indicating that `version` of `product` is unsupported for traced Swift analysis. + * Depending on `skipUnsupportedTracedAnalysis`, this function then either throws a {@link ConfigurationError} + * or logs the problem as a warning. + * + * @param logger The logger to use. + * @param config The CodeQL Action configuration. + * @param skipUnsupportedTracedAnalysis Whether this is a fatal error. + * @param product The product that the version is unsupported of. + * @param version The unsupported version. + */ +function handleUnsupportedVersion( + logger: Logger, + config: Config, + skipUnsupportedTracedAnalysis: boolean, + product: "macOS" | "Xcode", + version: semver.SemVer, +) { + const baseMessage = [ + `Traced Swift analysis is not supported on ${product} ${SWIFT_TRACED_UNSUPPORTED_MACOS} or above.`, + `Configure your analysis to run on macOS ${SWIFT_TRACED_UNSUPPORTED_MACOS - 1} or below`, + `and XCode ${SWIFT_TRACED_UNSUPPORTED_XCODE - 1} or below.`, + ].join(" "); + + const attributeName = product === "macOS" ? "macOSVersion" : "xcodeVersion"; + + // Create a diagnostic that will show up on the TSP. + addDiagnostic( + config, + BuiltInLanguage.swift, + makeDiagnostic( + `codeql-action/unsupported-traced-swift-analysis-${product.toLowerCase()}`, + `Traced Swift analysis is not supported on this version of ${product}`, + { + attributes: { + languages: config.languages, + [attributeName]: version.toString(), + }, + markdownMessage: baseMessage, + severity: skipUnsupportedTracedAnalysis ? "error" : "warning", + visibility: { + cliSummaryTable: true, + statusPage: true, + telemetry: true, + }, + }, + ), + ); + + // Throw an error to abort the analysis if the FF is enabled or log the message. + if (skipUnsupportedTracedAnalysis) { + // ConfigurationErrors are converted to the "aborted" status by the exception handler + // in `init-action.ts` that guards the call to `isSwiftCompatible`. + throw new ConfigurationError(baseMessage); + } else { + // This will also show up as a workflow annotation. + logger.warning(baseMessage); + } +} + /** * Determines whether we can run a Swift analysis on the current runner. * @@ -118,55 +178,39 @@ export async function isSwiftCompatible( `Swift analysis is only supported on macOS runner images. Please migrate to a macOS runner.`, ); } - // If we got a string, we are on macOS but couldn't parse the version string. - if (typeof version === "string") { - action.logger.warning( - `Unable to determine version of macOS, got: ${version}`, - ); - return; - } const skipUnsupportedTracedAnalysis = await action.features.getValue( Feature.SwiftSkipUnsupportedTracedAnalysis, ); - if (version.major >= SWIFT_TRACED_UNSUPPORTED_MACOS) { - const baseMessage = [ - `Traced Swift analysis is not supported on macOS ${SWIFT_TRACED_UNSUPPORTED_MACOS} or above.`, - `Configure your analysis to run on macOS ${SWIFT_TRACED_UNSUPPORTED_MACOS - 1} or below`, - `and XCode ${SWIFT_TRACED_UNSUPPORTED_XCODE - 1} or below.`, - ].join(" "); - - // Create a diagnostic that will show up on the TSP. - addDiagnostic( - config, - BuiltInLanguage.swift, - makeDiagnostic( - "codeql-action/unsupported-traced-swift-analysis-macos", - "Traced Swift analysis is not supported on this version of macOS", - { - attributes: { - languages: config.languages, - macOSVersion: version.toString(), - }, - markdownMessage: baseMessage, - severity: skipUnsupportedTracedAnalysis ? "error" : "warning", - visibility: { - cliSummaryTable: true, - statusPage: true, - telemetry: true, - }, - }, - ), + if (typeof version === "string") { + // If we got a string, we are on macOS but couldn't parse the version string. + action.logger.warning( + `Unable to determine version of macOS, got: ${version}`, ); + } else if (version.major >= SWIFT_TRACED_UNSUPPORTED_MACOS) { + handleUnsupportedVersion( + action.logger, + config, + skipUnsupportedTracedAnalysis, + "macOS", + version, + ); + } - // Throw an error to abort the analysis if the FF is enabled or log the message. - if (skipUnsupportedTracedAnalysis) { - // ConfigurationErrors are converted to the "aborted" status by the exception handler - // in `init-action.ts` that guards the call to `isSwiftCompatible`. - throw new ConfigurationError(baseMessage); - } else { - // This will also show up as a workflow annotation. - action.logger.warning(baseMessage); - } + // Determining whether the Xcode version is supported only makes sense on macOS, so we only do it + // after determining that we are running on macOS. + const xcodeVer = xcodeVersion(action.logger); + + if ( + xcodeVer !== undefined && + xcodeVer.major >= SWIFT_TRACED_UNSUPPORTED_XCODE + ) { + handleUnsupportedVersion( + action.logger, + config, + skipUnsupportedTracedAnalysis, + "Xcode", + xcodeVer, + ); } }