snyk-gradle-plugin
Advanced tools
Comparing version 2.12.2 to 2.12.3
@@ -58,3 +58,3 @@ export interface BaseInspectOptions { | ||
declare function extractJsonFromScriptOutput(stdoutText: string): JsonDepsScriptResult; | ||
declare function buildArgs(root: any, targetFile: any, configurationMatching: string | undefined, configurationAttributes: string | undefined, gradleArgs?: string[]): string[]; | ||
declare function buildArgs(root: string, targetFile: string | null, initGradlePath: string, options: SingleRootInspectOptions | MultiRootsInspectOptions): string[]; | ||
export declare const exportsForTests: { | ||
@@ -61,0 +61,0 @@ buildArgs: typeof buildArgs; |
@@ -167,5 +167,2 @@ "use strict"; | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
const args = buildArgs(root, targetFile, options['configuration-matching'], options['configuration-attributes'], options.args); | ||
let tmpInitGradle = null; | ||
// TODO: move to buildArgs, adjust tests | ||
let initGradlePath = null; | ||
@@ -183,5 +180,7 @@ if (/index.js$/.test(__filename)) { | ||
} | ||
const args = buildArgs(root, targetFile, initGradlePath, options); | ||
// We could be running from a bundled CLI generated by `pkg`. | ||
// The Node filesystem in that case is not real: https://github.com/zeit/pkg#snapshot-filesystem | ||
// Copying the injectable script into a temp file. | ||
let tmpInitGradle = null; | ||
try { | ||
@@ -197,18 +196,2 @@ tmpInitGradle = tmp.fileSync({ postfix: '-init.gradle' }); | ||
} | ||
if (!isMultiSubProject(options)) { | ||
args.push('-PonlySubProject=' + (options['gradle-sub-project'] || '.')); | ||
} | ||
args.push('-I ' + initGradlePath); | ||
// There might be a legacy --configuration option in 'args'. | ||
// It has been superseded by --configuration-matching option for Snyk CLI (see buildArgs), | ||
// but we are handling it to support the legacy setups. | ||
args.forEach((a, i) => { | ||
// Transform --configuration=foo | ||
args[i] = a.replace(/^--configuration[= ]([a-zA-Z_]+)/, `-Pconfiguration=${quot}^$1$$${quot}`); | ||
// Transform --configuration foo | ||
if (a === '--configuration') { | ||
args[i] = `-Pconfiguration=${quot}^${args[i + 1]}$${quot}`; | ||
args[i + 1] = ''; | ||
} | ||
}); | ||
const command = getCommand(root, targetFile); | ||
@@ -318,3 +301,3 @@ const fullCommandText = 'gradle command: ' + command + ' ' + args.join(' '); | ||
} | ||
function buildArgs(root, targetFile, configurationMatching, configurationAttributes, gradleArgs) { | ||
function buildArgs(root, targetFile, initGradlePath, options) { | ||
const args = []; | ||
@@ -334,7 +317,7 @@ args.push('snykResolvedDepsJson', '-q'); | ||
// Arguments to init script are supplied as properties: https://stackoverflow.com/a/48370451 | ||
if (configurationMatching) { | ||
args.push(`-Pconfiguration=${quot}${configurationMatching}${quot}`); | ||
if (options['configuration-matching']) { | ||
args.push(`-Pconfiguration=${quot}${options['configuration-matching']}${quot}`); | ||
} | ||
if (configurationAttributes) { | ||
args.push(`-PconfAttr=${quot}${configurationAttributes}${quot}`); | ||
if (options['configuration-attributes']) { | ||
args.push(`-PconfAttr=${quot}${options['configuration-attributes']}${quot}`); | ||
} | ||
@@ -348,5 +331,21 @@ // For some reason, this is not required for Unix, but on Windows, without this flag, apparently, | ||
args.push('-Dorg.gradle.parallel='); | ||
if (gradleArgs) { | ||
args.push(...gradleArgs); | ||
if (!isMultiSubProject(options)) { | ||
args.push('-PonlySubProject=' + (options['gradle-sub-project'] || '.')); | ||
} | ||
args.push('-I ' + initGradlePath); | ||
if (options.args) { | ||
args.push(...options.args); | ||
} | ||
// There might be a legacy --configuration option in 'args'. | ||
// It has been superseded by --configuration-matching option for Snyk CLI (see buildArgs), | ||
// but we are handling it to support the legacy setups. | ||
args.forEach((a, i) => { | ||
// Transform --configuration=foo | ||
args[i] = a.replace(/^--configuration[= ]([a-zA-Z_]+)/, `-Pconfiguration=${quot}^$1$$${quot}`); | ||
// Transform --configuration foo | ||
if (a === '--configuration') { | ||
args[i] = `-Pconfiguration=${quot}^${args[i + 1]}$${quot}`; | ||
args[i + 1] = ''; | ||
} | ||
}); | ||
return args; | ||
@@ -353,0 +352,0 @@ } |
@@ -49,3 +49,3 @@ { | ||
}, | ||
"version": "2.12.2" | ||
"version": "2.12.3" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45508
472