mirror of
https://github.com/SonarSource/sonarqube-scan-action.git
synced 2026-10-03 01:51:40 +00:00
SQSCANGHA-107 Migrate install-build-wrapper
This commit is contained in:
1 parent
a88c96d7e4
commit
ff001fd600
13 files changed
+27796
-27337
No files matched your search
Vendored
+27277
File diff suppressed because it is too large.
Load diff
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"exec-BTlTa8sL.js","sources":["../node_modules/@actions/core/lib/utils.js","../node_modules/@actions/core/lib/command.js","../node_modules/@actions/core/lib/file-command.js","../node_modules/@actions/http-client/lib/proxy.js","../node_modules/tunnel/lib/tunnel.js","../node_modules/tunnel/index.js","../node_modules/undici/lib/core/symbols.js","../node_modules/undici/lib/core/errors.js","../node_modules/undici/lib/core/constants.js","../node_modules/undici/lib/core/util.js","../node_modules/undici/lib/timers.js","../node_modules/@fastify/busboy/deps/streamsearch/sbmh.js","../node_modules/@fastify/busboy/deps/dicer/lib/PartStream.js","../node_modules/@fastify/busboy/lib/utils/getLimit.js","../node_modules/@fastify/busboy/deps/dicer/lib/HeaderParser.js","../node_modules/@fastify/busboy/deps/dicer/lib/Dicer.js","../node_modules/@fastify/busboy/lib/utils/decodeText.js","../node_modules/@fastify/busboy/lib/utils/parseParams.js","../node_modules/@fastify/busboy/lib/utils/basename.js","../node_modules/@fastify/busboy/lib/types/multipart.js","../node_modules/@fastify/busboy/lib/utils/Decoder.js","../node_modules/@fastify/busboy/lib/types/urlencoded.js","../node_modules/@fastify/busboy/lib/main.js","../node_modules/undici/lib/fetch/constants.js","../node_modules/undici/lib/fetch/global.js","../node_modules/undici/lib/fetch/util.js","../node_modules/undici/lib/fetch/symbols.js","../node_modules/undici/lib/fetch/webidl.js","../node_modules/undici/lib/fetch/dataURL.js","../node_modules/undici/lib/fetch/file.js","../node_modules/undici/lib/fetch/formdata.js","../node_modules/undici/lib/fetch/body.js","../node_modules/undici/lib/core/request.js","../node_modules/undici/lib/dispatcher.js","../node_modules/undici/lib/dispatcher-base.js","../node_modules/undici/lib/core/connect.js","../node_modules/undici/lib/llhttp/utils.js","../node_modules/undici/lib/llhttp/constants.js","../node_modules/undici/lib/handler/RedirectHandler.js","../node_modules/undici/lib/interceptor/redirectInterceptor.js","../node_modules/undici/lib/llhttp/llhttp-wasm.js","../node_modules/undici/lib/llhttp/llhttp_simd-wasm.js","../node_modules/undici/lib/client.js","../node_modules/undici/lib/node/fixed-queue.js","../node_modules/undici/lib/pool-stats.js","../node_modules/undici/lib/pool-base.js","../node_modules/undici/lib/pool.js","../node_modules/undici/lib/balanced-pool.js","../node_modules/undici/lib/compat/dispatcher-weakref.js","../node_modules/undici/lib/agent.js","../node_modules/undici/lib/api/readable.js","../node_modules/undici/lib/api/util.js","../node_modules/undici/lib/api/abort-signal.js","../node_modules/undici/lib/api/api-request.js","../node_modules/undici/lib/api/api-stream.js","../node_modules/undici/lib/api/api-pipeline.js","../node_modules/undici/lib/api/api-upgrade.js","../node_modules/undici/lib/api/api-connect.js","../node_modules/undici/lib/api/index.js","../node_modules/undici/lib/mock/mock-errors.js","../node_modules/undici/lib/mock/mock-symbols.js","../node_modules/undici/lib/mock/mock-utils.js","../node_modules/undici/lib/mock/mock-interceptor.js","../node_modules/undici/lib/mock/mock-client.js","../node_modules/undici/lib/mock/mock-pool.js","../node_modules/undici/lib/mock/pluralizer.js","../node_modules/undici/lib/mock/pending-interceptors-formatter.js","../node_modules/undici/lib/mock/mock-agent.js","../node_modules/undici/lib/proxy-agent.js","../node_modules/undici/lib/handler/RetryHandler.js","../node_modules/undici/lib/global.js","../node_modules/undici/lib/handler/DecoratorHandler.js","../node_modules/undici/lib/fetch/headers.js","../node_modules/undici/lib/fetch/response.js","../node_modules/undici/lib/fetch/request.js","../node_modules/undici/lib/fetch/index.js","../node_modules/undici/lib/fileapi/symbols.js","../node_modules/undici/lib/fileapi/progressevent.js","../node_modules/undici/lib/fileapi/encoding.js","../node_modules/undici/lib/fileapi/util.js","../node_modules/undici/lib/fileapi/filereader.js","../node_modules/undici/lib/cache/symbols.js","../node_modules/undici/lib/cache/util.js","../node_modules/undici/lib/cache/cache.js","../node_modules/undici/lib/cache/cachestorage.js","../node_modules/undici/lib/cookies/constants.js","../node_modules/undici/lib/cookies/util.js","../node_modules/undici/lib/cookies/parse.js","../node_modules/undici/lib/cookies/index.js","../node_modules/undici/lib/websocket/constants.js","../node_modules/undici/lib/websocket/symbols.js","../node_modules/undici/lib/websocket/events.js","../node_modules/undici/lib/websocket/util.js","../node_modules/undici/lib/websocket/connection.js","../node_modules/undici/lib/websocket/frame.js","../node_modules/undici/lib/websocket/receiver.js","../node_modules/undici/lib/websocket/websocket.js","../node_modules/undici/index.js","../node_modules/@actions/http-client/lib/index.js","../node_modules/@actions/http-client/lib/auth.js","../node_modules/@actions/core/lib/oidc-utils.js","../node_modules/@actions/core/lib/summary.js","../Line truncated
|
||||||
Vendored
+35
-27279
File diff suppressed because it is too large.
Load diff
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"index.js","sources":["../node_modules/@actions/core/lib/utils.js","../node_modules/@actions/core/lib/command.js","../node_modules/@actions/core/lib/file-command.js","../node_modules/@actions/http-client/lib/proxy.js","../node_modules/tunnel/lib/tunnel.js","../node_modules/tunnel/index.js","../node_modules/undici/lib/core/symbols.js","../node_modules/undici/lib/core/errors.js","../node_modules/undici/lib/core/constants.js","../node_modules/undici/lib/core/util.js","../node_modules/undici/lib/timers.js","../node_modules/@fastify/busboy/deps/streamsearch/sbmh.js","../node_modules/@fastify/busboy/deps/dicer/lib/PartStream.js","../node_modules/@fastify/busboy/lib/utils/getLimit.js","../node_modules/@fastify/busboy/deps/dicer/lib/HeaderParser.js","../node_modules/@fastify/busboy/deps/dicer/lib/Dicer.js","../node_modules/@fastify/busboy/lib/utils/decodeText.js","../node_modules/@fastify/busboy/lib/utils/parseParams.js","../node_modules/@fastify/busboy/lib/utils/basename.js","../node_modules/@fastify/busboy/lib/types/multipart.js","../node_modules/@fastify/busboy/lib/utils/Decoder.js","../node_modules/@fastify/busboy/lib/types/urlencoded.js","../node_modules/@fastify/busboy/lib/main.js","../node_modules/undici/lib/fetch/constants.js","../node_modules/undici/lib/fetch/global.js","../node_modules/undici/lib/fetch/util.js","../node_modules/undici/lib/fetch/symbols.js","../node_modules/undici/lib/fetch/webidl.js","../node_modules/undici/lib/fetch/dataURL.js","../node_modules/undici/lib/fetch/file.js","../node_modules/undici/lib/fetch/formdata.js","../node_modules/undici/lib/fetch/body.js","../node_modules/undici/lib/core/request.js","../node_modules/undici/lib/dispatcher.js","../node_modules/undici/lib/dispatcher-base.js","../node_modules/undici/lib/core/connect.js","../node_modules/undici/lib/llhttp/utils.js","../node_modules/undici/lib/llhttp/constants.js","../node_modules/undici/lib/handler/RedirectHandler.js","../node_modules/undici/lib/interceptor/redirectInterceptor.js","../node_modules/undici/lib/llhttp/llhttp-wasm.js","../node_modules/undici/lib/llhttp/llhttp_simd-wasm.js","../node_modules/undici/lib/client.js","../node_modules/undici/lib/node/fixed-queue.js","../node_modules/undici/lib/pool-stats.js","../node_modules/undici/lib/pool-base.js","../node_modules/undici/lib/pool.js","../node_modules/undici/lib/balanced-pool.js","../node_modules/undici/lib/compat/dispatcher-weakref.js","../node_modules/undici/lib/agent.js","../node_modules/undici/lib/api/readable.js","../node_modules/undici/lib/api/util.js","../node_modules/undici/lib/api/abort-signal.js","../node_modules/undici/lib/api/api-request.js","../node_modules/undici/lib/api/api-stream.js","../node_modules/undici/lib/api/api-pipeline.js","../node_modules/undici/lib/api/api-upgrade.js","../node_modules/undici/lib/api/api-connect.js","../node_modules/undici/lib/api/index.js","../node_modules/undici/lib/mock/mock-errors.js","../node_modules/undici/lib/mock/mock-symbols.js","../node_modules/undici/lib/mock/mock-utils.js","../node_modules/undici/lib/mock/mock-interceptor.js","../node_modules/undici/lib/mock/mock-client.js","../node_modules/undici/lib/mock/mock-pool.js","../node_modules/undici/lib/mock/pluralizer.js","../node_modules/undici/lib/mock/pending-interceptors-formatter.js","../node_modules/undici/lib/mock/mock-agent.js","../node_modules/undici/lib/proxy-agent.js","../node_modules/undici/lib/handler/RetryHandler.js","../node_modules/undici/lib/global.js","../node_modules/undici/lib/handler/DecoratorHandler.js","../node_modules/undici/lib/fetch/headers.js","../node_modules/undici/lib/fetch/response.js","../node_modules/undici/lib/fetch/request.js","../node_modules/undici/lib/fetch/index.js","../node_modules/undici/lib/fileapi/symbols.js","../node_modules/undici/lib/fileapi/progressevent.js","../node_modules/undici/lib/fileapi/encoding.js","../node_modules/undici/lib/fileapi/util.js","../node_modules/undici/lib/fileapi/filereader.js","../node_modules/undici/lib/cache/symbols.js","../node_modules/undici/lib/cache/util.js","../node_modules/undici/lib/cache/cache.js","../node_modules/undici/lib/cache/cachestorage.js","../node_modules/undici/lib/cookies/constants.js","../node_modules/undici/lib/cookies/util.js","../node_modules/undici/lib/cookies/parse.js","../node_modules/undici/lib/cookies/index.js","../node_modules/undici/lib/websocket/constants.js","../node_modules/undici/lib/websocket/symbols.js","../node_modules/undici/lib/websocket/events.js","../node_modules/undici/lib/websocket/util.js","../node_modules/undici/lib/websocket/connection.js","../node_modules/undici/lib/websocket/frame.js","../node_modules/undici/lib/websocket/receiver.js","../node_modules/undici/lib/websocket/websocket.js","../node_modules/undici/index.js","../node_modules/@actions/http-client/lib/index.js","../node_modules/@actions/http-client/lib/auth.js","../node_modules/@actions/core/lib/oidc-utils.js","../node_modules/@actions/core/lib/summary.js","../node_modLine truncated
|
{"version":3,"file":"index.js","sources":["../node_modules/semver/semver.js","../node_modules/@actions/tool-cache/lib/manifest.js","../node_modules/@actions/tool-cache/lib/retry-helper.js","../node_modules/@actions/tool-cache/lib/tool-cache.js","../src/main/utils.js","../src/main/install-sonar-scanner.js","../node_modules/string-argv/index.js","../src/main/run-sonar-scanner.js","../src/main/sanity-checks.js","../src/main/index.js"],"sourcesContent":["exports = module.exports = SemVer\n\nvar debug\n/* istanbul ignore next */\nif (typeof process === 'object' &&\n process.env &&\n process.env.NODE_DEBUG &&\n /\\bsemver\\b/i.test(process.env.NODE_DEBUG)) {\n debug = function () {\n var args = Array.prototype.slice.call(arguments, 0)\n args.unshift('SEMVER')\n console.log.apply(console, args)\n }\n} else {\n debug = function () {}\n}\n\n// Note: this is the semver.org version of the spec that it implements\n// Not necessarily the package version of this code.\nexports.SEMVER_SPEC_VERSION = '2.0.0'\n\nvar MAX_LENGTH = 256\nvar MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||\n /* istanbul ignore next */ 9007199254740991\n\n// Max safe segment length for coercion.\nvar MAX_SAFE_COMPONENT_LENGTH = 16\n\nvar MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6\n\n// The actual regexps go on exports.re\nvar re = exports.re = []\nvar safeRe = exports.safeRe = []\nvar src = exports.src = []\nvar t = exports.tokens = {}\nvar R = 0\n\nfunction tok (n) {\n t[n] = R++\n}\n\nvar LETTERDASHNUMBER = '[a-zA-Z0-9-]'\n\n// Replace some greedy regex tokens to prevent regex dos issues. These regex are\n// used internally via the safeRe object since all inputs in this library get\n// normalized first to trim and collapse all extra whitespace. The original\n// regexes are exported for userland consumption and lower level usage. A\n// future breaking change could export the safer regex only with a note that\n// all input should have extra whitespace removed.\nvar safeRegexReplacements = [\n ['\\\\s', 1],\n ['\\\\d', MAX_LENGTH],\n [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],\n]\n\nfunction makeSafeRe (value) {\n for (var i = 0; i < safeRegexReplacements.length; i++) {\n var token = safeRegexReplacements[i][0]\n var max = safeRegexReplacements[i][1]\n value = value\n .split(token + '*').join(token + '{0,' + max + '}')\n .split(token + '+').join(token + '{1,' + max + '}')\n }\n return value\n}\n\n// The following Regular Expressions can be used for tokenizing,\n// validating, and parsing SemVer version strings.\n\n// ## Numeric Identifier\n// A single `0`, or a non-zero digit followed by zero or more digits.\n\ntok('NUMERICIDENTIFIER')\nsrc[t.NUMERICIDENTIFIER] = '0|[1-9]\\\\d*'\ntok('NUMERICIDENTIFIERLOOSE')\nsrc[t.NUMERICIDENTIFIERLOOSE] = '\\\\d+'\n\n// ## Non-numeric Identifier\n// Zero or more digits, followed by a letter or hyphen, and then zero or\n// more letters, digits, or hyphens.\n\ntok('NONNUMERICIDENTIFIER')\nsrc[t.NONNUMERICIDENTIFIER] = '\\\\d*[a-zA-Z-]' + LETTERDASHNUMBER + '*'\n\n// ## Main Version\n// Three dot-separated numeric identifiers.\n\ntok('MAINVERSION')\nsrc[t.MAINVERSION] = '(' + src[t.NUMERICIDENTIFIER] + ')\\\\.' +\n '(' + src[t.NUMERICIDENTIFIER] + ')\\\\.' +\n '(' + src[t.NUMERICIDENTIFIER] + ')'\n\ntok('MAINVERSIONLOOSE')\nsrc[t.MAINVERSIONLOOSE] = '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\\\.' +\n '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\\\.' +\n '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')'\n\n// ## Pre-release Version Identifier\n// A numeric identifier, or a non-numeric identifier.\n\ntok('PRERELEASEIDENTIFIER')\nsrc[t.PRERELEASEIDENTIFIER] = '(?:' + src[t.NUMERICIDENTIFIER] +\n '|' + src[t.NONNUMERICIDENTIFIER] + ')'\n\ntok('PRERELEASEIDENTIFIERLOOSE')\nsrc[t.PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[t.NUMERICIDENTIFIERLOOSE] +\n '|' + src[t.NONNUMERICIDENTIFIER] + ')'\n\n// ## Pre-release Version\n// Hyphen, followed by one or more dot-separated pre-release version\n// identifiers.\n\ntok('PRERELEASE')\nsrc[t.PRERELEASE] = '(?:-(' + src[t.PRERELEASEIDENTIFIER] +\n '(?:\\\\.' + src[t.PRERELEASEIDENTIFIER] + ')*))'\n\ntok('PRERELEASELOOSE')\nsrc[t.PRERELEASELOOSE] = '(?:-?(' + src[t.PRERELEASEIDENTIFIERLOOSE] +\n '(?:\\\\.' + src[t.PRERELEASEIDENTIFIERLOOSE] + ')*))'\n\n// ## Build Metadata Identifier\n// Any combination of digits, letters, or hyphens.\n\ntok('BUILDIDENTIFIER')\nsrc[t.BUILDIDENTIFIER] = LETTERDASHNUMBER + '+'\n\n// ## Build Metadata\n// Plus sign, followed by one or more period-separated build metadata\n// identifiers.\n\ntok('BUILD')\nsrc[t.BUILD] = '(?:\\\\+(' + src[t.BUILDIDENTIFIER] +\n '(?:\\\\.' + src[t.BUILDIDENTIFIER] + ')*))'\n\n// ## Full Version String\n// A main version, followed optionally by a pre-release version and\n// build metadata.\n\n// Note that Line truncated
|
||||||
Vendored
+207
@@ -0,0 +1,207 @@
|
|||||||
|
import { f as execExports, e as coreExports } from './exec-BTlTa8sL.js';
|
||||||
|
import * as fs from 'fs';
|
||||||
|
import * as path from 'path';
|
||||||
|
import 'os';
|
||||||
|
import 'crypto';
|
||||||
|
import 'http';
|
||||||
|
import 'https';
|
||||||
|
import 'net';
|
||||||
|
import 'tls';
|
||||||
|
import 'events';
|
||||||
|
import 'assert';
|
||||||
|
import 'util';
|
||||||
|
import 'stream';
|
||||||
|
import 'buffer';
|
||||||
|
import 'querystring';
|
||||||
|
import 'stream/web';
|
||||||
|
import 'node:stream';
|
||||||
|
import 'node:util';
|
||||||
|
import 'node:events';
|
||||||
|
import 'worker_threads';
|
||||||
|
import 'perf_hooks';
|
||||||
|
import 'util/types';
|
||||||
|
import 'async_hooks';
|
||||||
|
import 'console';
|
||||||
|
import 'url';
|
||||||
|
import 'zlib';
|
||||||
|
import 'string_decoder';
|
||||||
|
import 'diagnostics_channel';
|
||||||
|
import 'child_process';
|
||||||
|
import 'timers';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compute all names and paths related to the build wrapper
|
||||||
|
* based on the runner environment
|
||||||
|
*/
|
||||||
|
function getBuildWrapperInfo({
|
||||||
|
runnerOS,
|
||||||
|
runnerArch,
|
||||||
|
runnerTemp,
|
||||||
|
sonarHostUrl,
|
||||||
|
}) {
|
||||||
|
const { buildWrapperSuffix, buildWrapperName } = getSuffixAndName(
|
||||||
|
runnerOS,
|
||||||
|
runnerArch
|
||||||
|
);
|
||||||
|
|
||||||
|
const buildWrapperDir = `${runnerTemp}/build-wrapper-${buildWrapperSuffix}`;
|
||||||
|
const buildWrapperUrl = `${sonarHostUrl}/static/cpp/build-wrapper-${buildWrapperSuffix}.zip`;
|
||||||
|
const buildWrapperBin = `${buildWrapperDir}/${buildWrapperName}`;
|
||||||
|
|
||||||
|
return {
|
||||||
|
buildWrapperUrl,
|
||||||
|
buildWrapperDir,
|
||||||
|
buildWrapperBin,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function getSuffixAndName(runnerOS, runnerArch) {
|
||||||
|
if (
|
||||||
|
runnerArch !== "X64" &&
|
||||||
|
!(runnerArch === "ARM64" && (runnerOS === "macOS" || runnerOS === "Linux"))
|
||||||
|
) {
|
||||||
|
throw new Error(
|
||||||
|
`Architecture '${runnerArch}' is unsupported by build-wrapper`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (runnerOS) {
|
||||||
|
case "Windows":
|
||||||
|
return {
|
||||||
|
buildWrapperSuffix: "win-x86",
|
||||||
|
buildWrapperName: "build-wrapper-win-x86-64.exe",
|
||||||
|
};
|
||||||
|
|
||||||
|
case "Linux":
|
||||||
|
switch (runnerArch) {
|
||||||
|
case "X64":
|
||||||
|
return {
|
||||||
|
buildWrapperSuffix: "linux-x86",
|
||||||
|
buildWrapperName: "build-wrapper-linux-x86-64",
|
||||||
|
};
|
||||||
|
|
||||||
|
case "ARM64":
|
||||||
|
return {
|
||||||
|
buildWrapperSuffix: "linux-aarch64",
|
||||||
|
buildWrapperName: "build-wrapper-linux-aarch64",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
break; // handled before the switch
|
||||||
|
|
||||||
|
case "macOS":
|
||||||
|
return {
|
||||||
|
buildWrapperSuffix: "macosx-x86",
|
||||||
|
buildWrapperName: "build-wrapper-macosx-x86",
|
||||||
|
};
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new Error(`Unsupported runner OS '${runnerOS}'`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getRealPath(filePath, runnerOS) {
|
||||||
|
switch (runnerOS) {
|
||||||
|
case "Windows": {
|
||||||
|
const windowsResult = await execExports.getExecOutput("cygpath", [
|
||||||
|
"--absolute",
|
||||||
|
"--windows",
|
||||||
|
filePath,
|
||||||
|
]);
|
||||||
|
return windowsResult.stdout.trim();
|
||||||
|
}
|
||||||
|
case "Linux": {
|
||||||
|
const linuxResult = await execExports.getExecOutput("readlink", [
|
||||||
|
"-f",
|
||||||
|
filePath,
|
||||||
|
]);
|
||||||
|
return linuxResult.stdout.trim();
|
||||||
|
}
|
||||||
|
case "macOS": {
|
||||||
|
const macResult = await execExports.getExecOutput("greadlink", ["-f", filePath]);
|
||||||
|
return macResult.stdout.trim();
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return path.resolve(filePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function installMacOSPackages() {
|
||||||
|
if (process.platform === "darwin") {
|
||||||
|
coreExports.info("Installing required packages for macOS");
|
||||||
|
await execExports.exec("brew", ["install", "coreutils"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* These RUNNER_XX env variables come from GitHub by default.
|
||||||
|
* See https://docs.github.com/en/actions/reference/workflows-and-actions/variables#default-environment-variables
|
||||||
|
*
|
||||||
|
* If SONAR_HOST_URL is omitted, we assume sonarcloud.io
|
||||||
|
*/
|
||||||
|
function getEnvVariables() {
|
||||||
|
const sonarHostUrl = process.env.SONAR_HOST_URL
|
||||||
|
? process.env.SONAR_HOST_URL.replace(/\/$/, "")
|
||||||
|
: "https://sonarcloud.io";
|
||||||
|
|
||||||
|
return {
|
||||||
|
runnerOS: process.env.RUNNER_OS,
|
||||||
|
runnerArch: process.env.RUNNER_ARCH,
|
||||||
|
runnerTemp: process.env.RUNNER_TEMP,
|
||||||
|
sonarHostUrl,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
async function downloadAndInstallBuildWrapper(downloadUrl, runnerEnv) {
|
||||||
|
const { runnerArch, runnerOS, runnerTemp } = runnerEnv;
|
||||||
|
const tmpZipPath = path.join(
|
||||||
|
runnerTemp,
|
||||||
|
`build-wrapper-${runnerOS}-${runnerArch}.zip`
|
||||||
|
);
|
||||||
|
|
||||||
|
coreExports.startGroup(`Download ${downloadUrl}`);
|
||||||
|
|
||||||
|
coreExports.info(`Downloading '${downloadUrl}'`);
|
||||||
|
|
||||||
|
if (!fs.existsSync(runnerTemp)) {
|
||||||
|
fs.mkdirSync(runnerTemp, { recursive: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
await execExports.exec("curl", ["-sSLo", tmpZipPath, downloadUrl]);
|
||||||
|
|
||||||
|
coreExports.info("Decompressing");
|
||||||
|
await execExports.exec("unzip", ["-o", "-d", runnerTemp, tmpZipPath]);
|
||||||
|
|
||||||
|
coreExports.endGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function run() {
|
||||||
|
try {
|
||||||
|
await installMacOSPackages();
|
||||||
|
|
||||||
|
const envVariables = getEnvVariables();
|
||||||
|
|
||||||
|
const { buildWrapperBin, buildWrapperDir, buildWrapperUrl } =
|
||||||
|
getBuildWrapperInfo(envVariables);
|
||||||
|
|
||||||
|
await downloadAndInstallBuildWrapper(buildWrapperUrl, envVariables);
|
||||||
|
|
||||||
|
const buildWrapperBinDir = await getRealPath(
|
||||||
|
buildWrapperDir,
|
||||||
|
envVariables.runnerOS
|
||||||
|
);
|
||||||
|
coreExports.addPath(buildWrapperBinDir);
|
||||||
|
coreExports.info(`'${buildWrapperBinDir}' added to the path`);
|
||||||
|
|
||||||
|
const buildWrapperBinPath = await getRealPath(
|
||||||
|
buildWrapperBin,
|
||||||
|
envVariables.runnerOS
|
||||||
|
);
|
||||||
|
coreExports.setOutput("build-wrapper-binary", buildWrapperBinPath);
|
||||||
|
coreExports.info(`'build-wrapper-binary' output set to '${buildWrapperBinPath}'`);
|
||||||
|
} catch (error) {
|
||||||
|
coreExports.setFailed(error.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
run();
|
||||||
|
//# sourceMappingURL=install-build-wrapper.js.map
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"install-build-wrapper.js","sources":["../src/install-build-wrapper/utils.js","../src/install-build-wrapper/install-build-wrapper.js"],"sourcesContent":["import * as exec from \"@actions/exec\";\nimport * as path from \"path\";\n\n/**\n * Compute all names and paths related to the build wrapper\n * based on the runner environment\n */\nexport function getBuildWrapperInfo({\n runnerOS,\n runnerArch,\n runnerTemp,\n sonarHostUrl,\n}) {\n const { buildWrapperSuffix, buildWrapperName } = getSuffixAndName(\n runnerOS,\n runnerArch\n );\n\n const buildWrapperDir = `${runnerTemp}/build-wrapper-${buildWrapperSuffix}`;\n const buildWrapperUrl = `${sonarHostUrl}/static/cpp/build-wrapper-${buildWrapperSuffix}.zip`;\n const buildWrapperBin = `${buildWrapperDir}/${buildWrapperName}`;\n\n return {\n buildWrapperUrl,\n buildWrapperDir,\n buildWrapperBin,\n };\n}\n\nfunction getSuffixAndName(runnerOS, runnerArch) {\n if (\n runnerArch !== \"X64\" &&\n !(runnerArch === \"ARM64\" && (runnerOS === \"macOS\" || runnerOS === \"Linux\"))\n ) {\n throw new Error(\n `Architecture '${runnerArch}' is unsupported by build-wrapper`\n );\n }\n\n switch (runnerOS) {\n case \"Windows\":\n return {\n buildWrapperSuffix: \"win-x86\",\n buildWrapperName: \"build-wrapper-win-x86-64.exe\",\n };\n\n case \"Linux\":\n switch (runnerArch) {\n case \"X64\":\n return {\n buildWrapperSuffix: \"linux-x86\",\n buildWrapperName: \"build-wrapper-linux-x86-64\",\n };\n\n case \"ARM64\":\n return {\n buildWrapperSuffix: \"linux-aarch64\",\n buildWrapperName: \"build-wrapper-linux-aarch64\",\n };\n }\n break; // handled before the switch\n\n case \"macOS\":\n return {\n buildWrapperSuffix: \"macosx-x86\",\n buildWrapperName: \"build-wrapper-macosx-x86\",\n };\n\n default:\n throw new Error(`Unsupported runner OS '${runnerOS}'`);\n }\n}\n\nexport async function getRealPath(filePath, runnerOS) {\n switch (runnerOS) {\n case \"Windows\": {\n const windowsResult = await exec.getExecOutput(\"cygpath\", [\n \"--absolute\",\n \"--windows\",\n filePath,\n ]);\n return windowsResult.stdout.trim();\n }\n case \"Linux\": {\n const linuxResult = await exec.getExecOutput(\"readlink\", [\n \"-f\",\n filePath,\n ]);\n return linuxResult.stdout.trim();\n }\n case \"macOS\": {\n const macResult = await exec.getExecOutput(\"greadlink\", [\"-f\", filePath]);\n return macResult.stdout.trim();\n }\n default:\n return path.resolve(filePath);\n }\n}\n","import * as core from \"@actions/core\";\nimport * as exec from \"@actions/exec\";\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nimport { getBuildWrapperInfo, getRealPath } from \"./utils\";\n\nasync function installMacOSPackages() {\n if (process.platform === \"darwin\") {\n core.info(\"Installing required packages for macOS\");\n await exec.exec(\"brew\", [\"install\", \"coreutils\"]);\n }\n}\n\n/**\n * These RUNNER_XX env variables come from GitHub by default.\n * See https://docs.github.com/en/actions/reference/workflows-and-actions/variables#default-environment-variables\n *\n * If SONAR_HOST_URL is omitted, we assume sonarcloud.io\n */\nfunction getEnvVariables() {\n const sonarHostUrl = process.env.SONAR_HOST_URL\n ? process.env.SONAR_HOST_URL.replace(/\\/$/, \"\")\n : \"https://sonarcloud.io\";\n\n return {\n runnerOS: process.env.RUNNER_OS,\n runnerArch: process.env.RUNNER_ARCH,\n runnerTemp: process.env.RUNNER_TEMP,\n sonarHostUrl,\n };\n}\n\nasync function downloadAndInstallBuildWrapper(downloadUrl, runnerEnv) {\n const { runnerArch, runnerOS, runnerTemp } = runnerEnv;\n const tmpZipPath = path.join(\n runnerTemp,\n `build-wrapper-${runnerOS}-${runnerArch}.zip`\n );\n\n core.startGroup(`Download ${downloadUrl}`);\n\n core.info(`Downloading '${downloadUrl}'`);\n\n if (!fs.existsSync(runnerTemp)) {\n fs.mkdirSync(runnerTemp, { recursive: true });\n }\n\n await exec.exec(\"curl\", [\"-sSLo\", tmpZipPath, downloadUrl]);\n\n core.info(\"Decompressing\");\n await exec.exec(\"unzip\", [\"-o\", \"-d\", runnerTemp, tmpZipPath]);\n\n core.endGroup();\n}\n\nasync function run() {\n try {\n await installMacOSPackages();\n\n const envVariables = getEnvVariables();\n\n const { buildWrapperBin, buildWrapperDir, buildWrapperUrl } =\n getBuildWrapperInfo(envVariables);\n\n await downloadAndInstallBuildWrapper(buildWrapperUrl, envVariables);\n\n const buildWrapperBinDir = await getRealPath(\n buildWrapperDir,\n envVariables.runnerOS\n );\n core.addPath(buildWrapperBinDir);\n core.info(`'${buildWrapperBinDir}' added to the path`);\n\n const buildWrapperBinPath = await getRealPath(\n buLine truncated
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
name: 'Install Build Wrapper for C and C++'
|
name: "Install Build Wrapper for C and C++"
|
||||||
description: >
|
description: >
|
||||||
Download and install the Build Wrapper for C, C++, and Objective-C
|
Download and install the Build Wrapper for C, C++, and Objective-C
|
||||||
projects analyzed with manual config.
|
projects analyzed with manual config.
|
||||||
@@ -8,55 +8,6 @@ branding:
|
|||||||
outputs:
|
outputs:
|
||||||
build-wrapper-binary:
|
build-wrapper-binary:
|
||||||
description: "Absolute path to Build Wrapper binary."
|
description: "Absolute path to Build Wrapper binary."
|
||||||
value: ${{ steps.setup-outputs.outputs.build-wrapper-binary }}
|
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: node20
|
||||||
|
main: ../dist/install-build-wrapper.js
|
||||||
steps:
|
|
||||||
# install packaged required for greadlink and sha256sum command on macOS
|
|
||||||
- name: Install required packages for macOS
|
|
||||||
if: runner.os == 'macOS'
|
|
||||||
shell: bash
|
|
||||||
run: brew install coreutils
|
|
||||||
|
|
||||||
- name: Set SONAR_HOST_URL to 'https://sonarcloud.io'
|
|
||||||
if: env.SONAR_HOST_URL == ''
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
echo "Setting SONAR_HOST_URL to 'https://sonarcloud.io'"
|
|
||||||
echo "SONAR_HOST_URL=https://sonarcloud.io" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Configure paths
|
|
||||||
id: configure_paths
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
OS: ${{ runner.os }}
|
|
||||||
ARCH: ${{ runner.arch }}
|
|
||||||
INSTALL_PATH: ${{ runner.temp }} # TODO: or .sonar, if RUNNER_TEMP creates problem with caching and self-hosted runners
|
|
||||||
run: ${GITHUB_ACTION_PATH}/../scripts/configure_paths.sh >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Download and install Build Wrapper
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
DOWNLOAD_URL: ${{ steps.configure_paths.outputs.build-wrapper-url }}
|
|
||||||
TMP_ZIP_PATH: ${{ runner.temp }}/build-wrapper-${{ inputs.configure_paths.sonar-scanner-version }}-${{ runner.os }}-${{ runner.arch }}.zip
|
|
||||||
INSTALL_PATH: ${{ runner.temp }} # TODO: or .sonar, if RUNNER_TEMP creates problem with caching and self-hosted runners
|
|
||||||
run: ${GITHUB_ACTION_PATH}/../scripts/download.sh
|
|
||||||
|
|
||||||
- name: Setup action outputs
|
|
||||||
id: setup-outputs
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
BUILD_WRAPPER_DIR: ${{ steps.configure_paths.outputs.build-wrapper-dir }}
|
|
||||||
BUILD_WRAPPER_BIN: ${{ steps.configure_paths.outputs.build-wrapper-bin }}
|
|
||||||
run: |
|
|
||||||
source ${GITHUB_ACTION_PATH}/../scripts/utils.sh
|
|
||||||
|
|
||||||
BUILD_WRAPPER_BIN_DIR=$(realpath "${BUILD_WRAPPER_DIR}")
|
|
||||||
echo "${BUILD_WRAPPER_BIN_DIR}" >> $GITHUB_PATH
|
|
||||||
echo "'${BUILD_WRAPPER_BIN_DIR}' added to the path"
|
|
||||||
|
|
||||||
BUILD_WRAPPER_BIN=$(realpath "${BUILD_WRAPPER_BIN}")
|
|
||||||
echo "build-wrapper-binary=${BUILD_WRAPPER_BIN}" >> $GITHUB_OUTPUT
|
|
||||||
echo "'build-wrapper-binary' output set to '${BUILD_WRAPPER_BIN}'"
|
|
||||||
echo "::endgroup::"
|
|
||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
"version": "6.0.0",
|
"version": "6.0.0",
|
||||||
"description": "This SonarSource project, available as a GitHub Action, scans your projects with SonarQube [Server](https://www.sonarsource.com/products/sonarqube/) or [Cloud](https://www.sonarsource.com/products/sonarcloud/).",
|
"description": "This SonarSource project, available as a GitHub Action, scans your projects with SonarQube [Server](https://www.sonarsource.com/products/sonarqube/) or [Cloud](https://www.sonarsource.com/products/sonarcloud/).",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "src/index.js",
|
"main": "src/main/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "rollup --config rollup.config.js",
|
"build": "rollup --config rollup.config.js",
|
||||||
"test": "node --test"
|
"test": "node --test"
|
||||||
|
|||||||
+4
-1
@@ -2,7 +2,10 @@ import commonjs from "@rollup/plugin-commonjs";
|
|||||||
import { nodeResolve } from "@rollup/plugin-node-resolve";
|
import { nodeResolve } from "@rollup/plugin-node-resolve";
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
input: "src/index.js",
|
input: [
|
||||||
|
"src/main/index.js",
|
||||||
|
"src/install-build-wrapper/install-build-wrapper.js",
|
||||||
|
],
|
||||||
output: {
|
output: {
|
||||||
esModule: true,
|
esModule: true,
|
||||||
dir: "dist",
|
dir: "dist",
|
||||||
|
|||||||
@@ -0,0 +1,80 @@
|
|||||||
|
import assert from "node:assert/strict";
|
||||||
|
import { describe, it } from "node:test";
|
||||||
|
import { getBuildWrapperInfo } from "../utils.js";
|
||||||
|
|
||||||
|
describe("getBuildWrapperInfo", () => {
|
||||||
|
const supportedPlatforms = [
|
||||||
|
{
|
||||||
|
platform: "Linux",
|
||||||
|
arch: "X64",
|
||||||
|
expectedSuffix: "linux-x86",
|
||||||
|
expectedName: "build-wrapper-linux-x86-64",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
platform: "Linux",
|
||||||
|
arch: "ARM64",
|
||||||
|
expectedSuffix: "linux-aarch64",
|
||||||
|
expectedName: "build-wrapper-linux-aarch64",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
platform: "Windows",
|
||||||
|
arch: "X64",
|
||||||
|
expectedSuffix: "win-x86",
|
||||||
|
expectedName: "build-wrapper-win-x86-64.exe",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
platform: "macOS",
|
||||||
|
arch: "X64",
|
||||||
|
expectedSuffix: "macosx-x86",
|
||||||
|
expectedName: "build-wrapper-macosx-x86",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
platform: "macOS",
|
||||||
|
arch: "ARM64",
|
||||||
|
expectedSuffix: "macosx-x86",
|
||||||
|
expectedName: "build-wrapper-macosx-x86",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const unsupportedPlatforms = [
|
||||||
|
{ platform: "linux", arch: "arm" },
|
||||||
|
{ platform: "openbsd", arch: "X64" },
|
||||||
|
{ platform: undefined, arch: "X64" },
|
||||||
|
{ platform: "Linux", arch: undefined },
|
||||||
|
{ platform: null, arch: "X64" },
|
||||||
|
{ platform: "Linux", arch: null },
|
||||||
|
];
|
||||||
|
|
||||||
|
supportedPlatforms.forEach(
|
||||||
|
({ platform, arch, expectedSuffix, expectedName }) => {
|
||||||
|
it(`returns ${expectedName} for ${platform} ${arch}`, () => {
|
||||||
|
const result = getBuildWrapperInfo({
|
||||||
|
runnerOS: platform,
|
||||||
|
runnerArch: arch,
|
||||||
|
runnerTemp: "/tmp",
|
||||||
|
sonarHostUrl: "https://sonarcloud.io"
|
||||||
|
});
|
||||||
|
assert.equal(result.buildWrapperUrl, `https://sonarcloud.io/static/cpp/build-wrapper-${expectedSuffix}.zip`);
|
||||||
|
assert.equal(result.buildWrapperDir, `/tmp/build-wrapper-${expectedSuffix}`);
|
||||||
|
assert.equal(result.buildWrapperBin, `/tmp/build-wrapper-${expectedSuffix}/${expectedName}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
unsupportedPlatforms.forEach(({ platform, arch }) => {
|
||||||
|
it(`throws for unsupported platform ${platform} ${arch}`, () => {
|
||||||
|
assert.throws(
|
||||||
|
() => getBuildWrapperInfo({
|
||||||
|
runnerOS: platform,
|
||||||
|
runnerArch: arch,
|
||||||
|
runnerTemp: "/tmp",
|
||||||
|
sonarHostUrl: "https://sonarcloud.io"
|
||||||
|
}),
|
||||||
|
(error) => {
|
||||||
|
return error.message.includes('unsupported') || error.message.includes('Unsupported');
|
||||||
|
},
|
||||||
|
`should have thrown for ${platform} ${arch}`
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
import * as core from "@actions/core";
|
||||||
|
import * as exec from "@actions/exec";
|
||||||
|
import * as fs from "fs";
|
||||||
|
import * as path from "path";
|
||||||
|
import { getBuildWrapperInfo, getRealPath } from "./utils";
|
||||||
|
|
||||||
|
async function installMacOSPackages() {
|
||||||
|
if (process.platform === "darwin") {
|
||||||
|
core.info("Installing required packages for macOS");
|
||||||
|
await exec.exec("brew", ["install", "coreutils"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* These RUNNER_XX env variables come from GitHub by default.
|
||||||
|
* See https://docs.github.com/en/actions/reference/workflows-and-actions/variables#default-environment-variables
|
||||||
|
*
|
||||||
|
* If SONAR_HOST_URL is omitted, we assume sonarcloud.io
|
||||||
|
*/
|
||||||
|
function getEnvVariables() {
|
||||||
|
const sonarHostUrl = process.env.SONAR_HOST_URL
|
||||||
|
? process.env.SONAR_HOST_URL.replace(/\/$/, "")
|
||||||
|
: "https://sonarcloud.io";
|
||||||
|
|
||||||
|
return {
|
||||||
|
runnerOS: process.env.RUNNER_OS,
|
||||||
|
runnerArch: process.env.RUNNER_ARCH,
|
||||||
|
runnerTemp: process.env.RUNNER_TEMP,
|
||||||
|
sonarHostUrl,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
async function downloadAndInstallBuildWrapper(downloadUrl, runnerEnv) {
|
||||||
|
const { runnerArch, runnerOS, runnerTemp } = runnerEnv;
|
||||||
|
const tmpZipPath = path.join(
|
||||||
|
runnerTemp,
|
||||||
|
`build-wrapper-${runnerOS}-${runnerArch}.zip`
|
||||||
|
);
|
||||||
|
|
||||||
|
core.startGroup(`Download ${downloadUrl}`);
|
||||||
|
|
||||||
|
core.info(`Downloading '${downloadUrl}'`);
|
||||||
|
|
||||||
|
if (!fs.existsSync(runnerTemp)) {
|
||||||
|
fs.mkdirSync(runnerTemp, { recursive: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
await exec.exec("curl", ["-sSLo", tmpZipPath, downloadUrl]);
|
||||||
|
|
||||||
|
core.info("Decompressing");
|
||||||
|
await exec.exec("unzip", ["-o", "-d", runnerTemp, tmpZipPath]);
|
||||||
|
|
||||||
|
core.endGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function run() {
|
||||||
|
try {
|
||||||
|
await installMacOSPackages();
|
||||||
|
|
||||||
|
const envVariables = getEnvVariables();
|
||||||
|
|
||||||
|
const { buildWrapperBin, buildWrapperDir, buildWrapperUrl } =
|
||||||
|
getBuildWrapperInfo(envVariables);
|
||||||
|
|
||||||
|
await downloadAndInstallBuildWrapper(buildWrapperUrl, envVariables);
|
||||||
|
|
||||||
|
const buildWrapperBinDir = await getRealPath(
|
||||||
|
buildWrapperDir,
|
||||||
|
envVariables.runnerOS
|
||||||
|
);
|
||||||
|
core.addPath(buildWrapperBinDir);
|
||||||
|
core.info(`'${buildWrapperBinDir}' added to the path`);
|
||||||
|
|
||||||
|
const buildWrapperBinPath = await getRealPath(
|
||||||
|
buildWrapperBin,
|
||||||
|
envVariables.runnerOS
|
||||||
|
);
|
||||||
|
core.setOutput("build-wrapper-binary", buildWrapperBinPath);
|
||||||
|
core.info(`'build-wrapper-binary' output set to '${buildWrapperBinPath}'`);
|
||||||
|
} catch (error) {
|
||||||
|
core.setFailed(error.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
run();
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
import * as exec from "@actions/exec";
|
||||||
|
import * as path from "path";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compute all names and paths related to the build wrapper
|
||||||
|
* based on the runner environment
|
||||||
|
*/
|
||||||
|
export function getBuildWrapperInfo({
|
||||||
|
runnerOS,
|
||||||
|
runnerArch,
|
||||||
|
runnerTemp,
|
||||||
|
sonarHostUrl,
|
||||||
|
}) {
|
||||||
|
const { buildWrapperSuffix, buildWrapperName } = getSuffixAndName(
|
||||||
|
runnerOS,
|
||||||
|
runnerArch
|
||||||
|
);
|
||||||
|
|
||||||
|
const buildWrapperDir = `${runnerTemp}/build-wrapper-${buildWrapperSuffix}`;
|
||||||
|
const buildWrapperUrl = `${sonarHostUrl}/static/cpp/build-wrapper-${buildWrapperSuffix}.zip`;
|
||||||
|
const buildWrapperBin = `${buildWrapperDir}/${buildWrapperName}`;
|
||||||
|
|
||||||
|
return {
|
||||||
|
buildWrapperUrl,
|
||||||
|
buildWrapperDir,
|
||||||
|
buildWrapperBin,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function getSuffixAndName(runnerOS, runnerArch) {
|
||||||
|
if (
|
||||||
|
runnerArch !== "X64" &&
|
||||||
|
!(runnerArch === "ARM64" && (runnerOS === "macOS" || runnerOS === "Linux"))
|
||||||
|
) {
|
||||||
|
throw new Error(
|
||||||
|
`Architecture '${runnerArch}' is unsupported by build-wrapper`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (runnerOS) {
|
||||||
|
case "Windows":
|
||||||
|
return {
|
||||||
|
buildWrapperSuffix: "win-x86",
|
||||||
|
buildWrapperName: "build-wrapper-win-x86-64.exe",
|
||||||
|
};
|
||||||
|
|
||||||
|
case "Linux":
|
||||||
|
switch (runnerArch) {
|
||||||
|
case "X64":
|
||||||
|
return {
|
||||||
|
buildWrapperSuffix: "linux-x86",
|
||||||
|
buildWrapperName: "build-wrapper-linux-x86-64",
|
||||||
|
};
|
||||||
|
|
||||||
|
case "ARM64":
|
||||||
|
return {
|
||||||
|
buildWrapperSuffix: "linux-aarch64",
|
||||||
|
buildWrapperName: "build-wrapper-linux-aarch64",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
break; // handled before the switch
|
||||||
|
|
||||||
|
case "macOS":
|
||||||
|
return {
|
||||||
|
buildWrapperSuffix: "macosx-x86",
|
||||||
|
buildWrapperName: "build-wrapper-macosx-x86",
|
||||||
|
};
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new Error(`Unsupported runner OS '${runnerOS}'`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getRealPath(filePath, runnerOS) {
|
||||||
|
switch (runnerOS) {
|
||||||
|
case "Windows": {
|
||||||
|
const windowsResult = await exec.getExecOutput("cygpath", [
|
||||||
|
"--absolute",
|
||||||
|
"--windows",
|
||||||
|
filePath,
|
||||||
|
]);
|
||||||
|
return windowsResult.stdout.trim();
|
||||||
|
}
|
||||||
|
case "Linux": {
|
||||||
|
const linuxResult = await exec.getExecOutput("readlink", [
|
||||||
|
"-f",
|
||||||
|
filePath,
|
||||||
|
]);
|
||||||
|
return linuxResult.stdout.trim();
|
||||||
|
}
|
||||||
|
case "macOS": {
|
||||||
|
const macResult = await exec.getExecOutput("greadlink", ["-f", filePath]);
|
||||||
|
return macResult.stdout.trim();
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return path.resolve(filePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
import * as core from "@actions/core";
|
import * as core from "@actions/core";
|
||||||
import { installSonarScanner } from "./main/install-sonar-scanner";
|
import { installSonarScanner } from "./install-sonar-scanner";
|
||||||
import { runSonarScanner } from "./main/run-sonar-scanner";
|
import { runSonarScanner } from "./run-sonar-scanner";
|
||||||
import {
|
import {
|
||||||
checkGradleProject,
|
checkGradleProject,
|
||||||
checkMavenProject,
|
checkMavenProject,
|
||||||
checkSonarToken,
|
checkSonarToken,
|
||||||
validateScannerVersion,
|
validateScannerVersion,
|
||||||
} from "./main/sanity-checks";
|
} from "./sanity-checks";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inputs are defined in action.yml
|
* Inputs are defined in action.yml
|
||||||
Reference in new issue
Block a user