diff --git a/lib/entry-points.js b/lib/entry-points.js index f90431684..d7de1c833 100644 --- a/lib/entry-points.js +++ b/lib/entry-points.js @@ -193928,7 +193928,7 @@ function handleUnsupportedVersion(logger2, config, tracedLanguages, skipUnsuppor const baseMessage = [ `Traced analysis is not supported on ${product} ${UNSUPPORTED_DARWIN_FOR_TRACED} or above.`, `Configure your analysis to run on macOS ${UNSUPPORTED_DARWIN_FOR_TRACED - 1} or below`, - `and XCode ${UNSUPPORTED_XCODE_FOR_TRACED - 1} or below.` + `and Xcode ${UNSUPPORTED_XCODE_FOR_TRACED - 1} or below.` ].join(" "); const attributeName = product === "macOS" ? "darwinVersion" : "xcodeVersion"; for (const language of tracedLanguages) { @@ -194015,7 +194015,7 @@ async function checkRunnerSupportsTracedAnalysis(action, config, codeql) { ); if (typeof version === "string") { action.logger.warning( - `Unable to determine version of macOS, got: ${version}` + `Unable to parse Darwin kernel version, got: ${version}. Skipping macOS compatibility check.` ); } else if (version.major >= UNSUPPORTED_DARWIN_FOR_TRACED) { handleUnsupportedVersion( @@ -194040,7 +194040,7 @@ async function checkRunnerSupportsTracedAnalysis(action, config, codeql) { ); } else if (xcodeVer === void 0) { action.logger.info( - "Unable to determine Xcode version. Assuming it is not installed." + "Unable to determine Xcode version. Skipping Xcode compatibility check." ); } } diff --git a/src/languages/swift.test.ts b/src/languages/swift.test.ts index 465f782c1..c3d18c476 100644 --- a/src/languages/swift.test.ts +++ b/src/languages/swift.test.ts @@ -30,7 +30,7 @@ test("checkSwiftCompatibility doesn't throw for non-Swift languages", async (t) checkSwiftCompatibility( createTestConfig({ languages: [language] }), codeql, - // A value of `undefined` should make `isSwiftCompatible` throw for Swift by default + // A value of `undefined` should make `checkSwiftCompatibility` throw for Swift by default // since it means we are on a platform other than macOS undefined, ), @@ -54,7 +54,7 @@ test("checkSwiftCompatibility doesn't throw for Swift if CLI supports swiftSuppo checkSwiftCompatibility( createTestConfig({ languages: [BuiltInLanguage.swift] }), codeql, - // A value of `undefined` should make `isSwiftCompatible` throw for Swift by default + // A value of `undefined` should make `checkSwiftCompatibility` throw for Swift by default // since it means we are on a platform other than macOS undefined, ), diff --git a/src/languages/traced.test.ts b/src/languages/traced.test.ts index 1e78127e9..d37a742f6 100644 --- a/src/languages/traced.test.ts +++ b/src/languages/traced.test.ts @@ -166,7 +166,7 @@ test("checkRunnerSupportsTracedAnalysis doesn't perform checks if FF is not enab ); checkUnexpectedLogMessages(t, logger.messages, [ - "Unable to determine version of macOS, got: unexpected", + "Unable to parse Darwin kernel version, got: unexpected", ]); })); @@ -198,7 +198,7 @@ test("checkRunnerSupportsTracedAnalysis doesn't perform checks on self-hosted ru ); checkUnexpectedLogMessages(t, logger.messages, [ - "Unable to determine version of macOS, got: unexpected", + "Unable to parse Darwin kernel version, got: unexpected", ]); })); @@ -229,7 +229,7 @@ test("checkRunnerSupportsTracedAnalysis warns if version string is not a semver" ); checkExpectedLogMessages(t, logger.messages, [ - "Unable to determine version of macOS, got: unexpected", + "Unable to parse Darwin kernel version, got: unexpected", ]); })); diff --git a/src/languages/traced.ts b/src/languages/traced.ts index 202252fb1..816ff2f80 100644 --- a/src/languages/traced.ts +++ b/src/languages/traced.ts @@ -19,7 +19,7 @@ export const UNSUPPORTED_DARWIN_FOR_TRACED = 27; export const UNSUPPORTED_XCODE_FOR_TRACED = 27; /** - * Creates a diagnostic indicating that `version` of `product` is unsupported for traced analysis. + * Creates a diagnostic indicating that `version` of `product` is unsupported for traced analysis. * Depending on `skipUnsupportedTracedAnalysis`, this function then either throws a {@link ConfigurationError} * or logs the problem as a warning. * @@ -41,7 +41,7 @@ function handleUnsupportedVersion( const baseMessage = [ `Traced analysis is not supported on ${product} ${UNSUPPORTED_DARWIN_FOR_TRACED} or above.`, `Configure your analysis to run on macOS ${UNSUPPORTED_DARWIN_FOR_TRACED - 1} or below`, - `and XCode ${UNSUPPORTED_XCODE_FOR_TRACED - 1} or below.`, + `and Xcode ${UNSUPPORTED_XCODE_FOR_TRACED - 1} or below.`, ].join(" "); const attributeName = product === "macOS" ? "darwinVersion" : "xcodeVersion"; @@ -82,8 +82,6 @@ function handleUnsupportedVersion( // 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 `checkRunnerSupportsTracedAnalysis`. throw new ConfigurationError(logMessage); } else { // This will also show up as a workflow annotation. @@ -136,7 +134,8 @@ export async function checkRunnerSupportsTracedAnalysis( return; } - // Skip if we are on a self-hosted runner. + // Skip if we are on a self-hosted runner since the current Xcode version detection + // is only validated on hosted runners. if (isSelfHostedRunner(action.env)) { action.logger.debug( "Skipping traced analysis compatibility checks because we are on a self-hosted runner.", @@ -175,7 +174,7 @@ export async function checkRunnerSupportsTracedAnalysis( 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}`, + `Unable to parse Darwin kernel version, got: ${version}. Skipping macOS compatibility check.`, ); } else if (version.major >= UNSUPPORTED_DARWIN_FOR_TRACED) { handleUnsupportedVersion( @@ -210,7 +209,7 @@ export async function checkRunnerSupportsTracedAnalysis( ); } else if (xcodeVer === undefined) { action.logger.info( - "Unable to determine Xcode version. Assuming it is not installed.", + "Unable to determine Xcode version. Skipping Xcode compatibility check.", ); } } diff --git a/src/platform.ts b/src/platform.ts index cb7df698a..070f30a8f 100644 --- a/src/platform.ts +++ b/src/platform.ts @@ -33,8 +33,9 @@ export function getBundlePlatform( } /** - * Tries to determine the version of the kernel on macOS. We approximate this based on the - * Darwin kernel version so that we don't have to launch an external process. + * Tries to determine the version of the Darwin kernel. We use this to approximate the macOS version based + * on the Darwin kernel version so that we don't have to launch an external process. Note that the Darwin + * kernel major version does not correspond perfectly to the macOS major version. * * @returns * The version as either a semantic version object, the raw version string