From d29eddb39b7c33171bb0250114b1c9e3ff8fe2bc Mon Sep 17 00:00:00 2001 From: Nick Rolfe Date: Tue, 16 Dec 2025 15:51:38 +0000 Subject: [PATCH] Extract version number to constant --- lib/init-action.js | 13 +++++++++++-- src/init-action.ts | 9 ++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/lib/init-action.js b/lib/init-action.js index 50888a86f..285bb4477 100644 --- a/lib/init-action.js +++ b/lib/init-action.js @@ -81567,6 +81567,11 @@ var require_follow_redirects = __commonJS({ }); // src/init-action.ts +var init_action_exports = {}; +__export(init_action_exports, { + CODEQL_VERSION_JAR_MINIMIZATION: () => CODEQL_VERSION_JAR_MINIMIZATION +}); +module.exports = __toCommonJS(init_action_exports); var fs14 = __toESM(require("fs")); var path15 = __toESM(require("path")); var core13 = __toESM(require_core()); @@ -89876,6 +89881,7 @@ var internal2 = { }; // src/init-action.ts +var CODEQL_VERSION_JAR_MINIMIZATION = "2.23.0"; async function sendStartingStatusReport(startedAt, config, logger) { const statusReportBase = await createStatusReportBase( "init" /* Init */, @@ -90266,8 +90272,7 @@ exec ${goBinaryPath} "$@"` logger.debug( `${"CODEQL_EXTRACTOR_JAVA_OPTION_MINIMIZE_DEPENDENCY_JARS" /* JAVA_EXTRACTOR_MINIMIZE_DEPENDENCY_JARS */} is already set to '${process.env["CODEQL_EXTRACTOR_JAVA_OPTION_MINIMIZE_DEPENDENCY_JARS" /* JAVA_EXTRACTOR_MINIMIZE_DEPENDENCY_JARS */]}', so the Action will not override it.` ); - } else if (await codeQlVersionAtLeast(codeql, "2.23.0") && // First version of the extractor to safely support this option - config.dependencyCachingEnabled && config.buildMode === "none" /* None */ && config.languages.includes("java" /* java */)) { + } else if (await codeQlVersionAtLeast(codeql, CODEQL_VERSION_JAR_MINIMIZATION) && config.dependencyCachingEnabled && config.buildMode === "none" /* None */ && config.languages.includes("java" /* java */)) { core13.exportVariable( "CODEQL_EXTRACTOR_JAVA_OPTION_MINIMIZE_DEPENDENCY_JARS" /* JAVA_EXTRACTOR_MINIMIZE_DEPENDENCY_JARS */, "true" @@ -90388,6 +90393,10 @@ async function runWrapper() { await checkForTimeout(); } void runWrapper(); +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + CODEQL_VERSION_JAR_MINIMIZATION +}); /*! Bundled license information: undici/lib/fetch/body.js: diff --git a/src/init-action.ts b/src/init-action.ts index 1585c8f0f..7ea406f44 100644 --- a/src/init-action.ts +++ b/src/init-action.ts @@ -88,6 +88,13 @@ import { } from "./util"; import { checkWorkflow } from "./workflow"; +/** + * First version of CodeQL where the Java extractor safely supports the option to minimize + * dependency jars. Note: some earlier versions of the extractor will respond to the corresponding + * option, but may rewrite jars in ways that lead to extraction errors. + */ +export const CODEQL_VERSION_JAR_MINIMIZATION = "2.23.0"; + /** * Sends a status report indicating that the `init` Action is starting. * @@ -651,7 +658,7 @@ async function run() { `${EnvVar.JAVA_EXTRACTOR_MINIMIZE_DEPENDENCY_JARS} is already set to '${process.env[EnvVar.JAVA_EXTRACTOR_MINIMIZE_DEPENDENCY_JARS]}', so the Action will not override it.`, ); } else if ( - (await codeQlVersionAtLeast(codeql, "2.23.0")) && // First version of the extractor to safely support this option + (await codeQlVersionAtLeast(codeql, CODEQL_VERSION_JAR_MINIMIZATION)) && config.dependencyCachingEnabled && config.buildMode === BuildMode.None && config.languages.includes(KnownLanguage.java)