snyk-gradle-plugin
Advanced tools
Comparing version 3.24.4 to 3.24.5
@@ -40,3 +40,2 @@ import { DepGraph } from '@snyk/dep-graph'; | ||
declare function toCamelCase(input: string): string; | ||
export declare function formatArgWithWhiteSpace(arg: string): string; | ||
declare function buildArgs(root: string, targetFile: string | null, initGradlePath: string, options: Options): string[]; | ||
@@ -43,0 +42,0 @@ export declare const exportsForTests: { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.exportsForTests = exports.formatArgWithWhiteSpace = exports.processProjectsInExtractedJSON = exports.inspect = exports.debugLog = void 0; | ||
exports.exportsForTests = exports.processProjectsInExtractedJSON = exports.inspect = exports.debugLog = void 0; | ||
const os = require("os"); | ||
@@ -31,4 +31,2 @@ const fs = require("fs"); | ||
exports.debugLog = debugLog; | ||
const isWin = /^win/.test(os.platform()); | ||
const quot = isWin ? '"' : "'"; | ||
const cannotResolveVariantMarkers = [ | ||
@@ -54,2 +52,3 @@ 'Cannot choose between the following', | ||
subProject = subProject.trim(); | ||
options.subProject = subProject; | ||
} | ||
@@ -441,9 +440,2 @@ const plugin = { | ||
} | ||
function formatArgWithWhiteSpace(arg) { | ||
if (/\s/.test(arg)) { | ||
return quot + arg + quot; | ||
} | ||
return arg; | ||
} | ||
exports.formatArgWithWhiteSpace = formatArgWithWhiteSpace; | ||
function buildArgs(root, targetFile, initGradlePath, options) { | ||
@@ -456,18 +448,18 @@ const args = []; | ||
if (targetFile) { | ||
if (!fs.existsSync(path.resolve(root, targetFile))) { | ||
throw new Error('File not found: "' + targetFile + '"'); | ||
const resolvedTargetFilePath = path.resolve(root, targetFile); | ||
if (!fs.existsSync(resolvedTargetFilePath)) { | ||
throw new Error('File not found: "' + resolvedTargetFilePath + '"'); | ||
} | ||
args.push('--build-file'); | ||
const formattedTargetFile = formatArgWithWhiteSpace(targetFile); | ||
args.push(formattedTargetFile); | ||
args.push(resolvedTargetFilePath); | ||
} | ||
// Arguments to init script are supplied as properties: https://stackoverflow.com/a/48370451 | ||
if (options['configuration-matching']) { | ||
args.push(`-Pconfiguration=${quot}${options['configuration-matching']}${quot}`); | ||
args.push(`-Pconfiguration=${options['configuration-matching']}`); | ||
} | ||
if (options['configuration-attributes']) { | ||
args.push(`-PconfAttr=${quot}${options['configuration-attributes']}${quot}`); | ||
args.push(`-PconfAttr=${options['configuration-attributes']}`); | ||
} | ||
if (options.initScript) { | ||
const formattedInitScript = formatArgWithWhiteSpace(path.resolve(options.initScript)); | ||
const formattedInitScript = path.resolve(options.initScript); | ||
args.push('--init-script', formattedInitScript); | ||
@@ -489,3 +481,3 @@ } | ||
} | ||
args.push('-I ' + initGradlePath); | ||
args.push('-I', initGradlePath); | ||
if (options.args) { | ||
@@ -499,10 +491,10 @@ args.push(...options.args); | ||
// Transform --configuration=foo | ||
args[i] = a.replace(/^--configuration[= ]([a-zA-Z_]+)/, `-Pconfiguration=${quot}^$1$$${quot}`); | ||
args[i] = a.replace(/^--configuration[= ]([a-zA-Z_]+)/, `-Pconfiguration=^$1$$`); | ||
// Transform --configuration foo | ||
if (a === '--configuration') { | ||
args[i] = `-Pconfiguration=${quot}^${args[i + 1]}$${quot}`; | ||
args[i] = `-Pconfiguration=^${args[i + 1]}$`; | ||
args[i + 1] = ''; | ||
} | ||
}); | ||
return args; | ||
return args.filter(Boolean); | ||
} | ||
@@ -509,0 +501,0 @@ exports.exportsForTests = { |
@@ -6,2 +6,3 @@ "use strict"; | ||
const debugModule = require("debug"); | ||
const shescape_1 = require("shescape"); | ||
const debugLogging = debugModule('snyk-gradle-plugin'); | ||
@@ -14,2 +15,3 @@ // Executes a subprocess. Resolves successfully with stdout contents if the exit code is 0. | ||
} | ||
args = (0, shescape_1.quoteAll)(args, spawnOptions); | ||
return new Promise((resolve, reject) => { | ||
@@ -16,0 +18,0 @@ let stdout = ''; |
@@ -54,2 +54,3 @@ { | ||
"packageurl-js": "^1.0.0", | ||
"shescape": "1.6.1", | ||
"tmp": "0.2.1", | ||
@@ -61,3 +62,3 @@ "tslib": "^2.0.0" | ||
}, | ||
"version": "3.24.4" | ||
"version": "3.24.5" | ||
} |
Sorry, the diff of this file is not supported yet
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
84396
10
831
+ Addedshescape@1.6.1
+ Addedisexe@2.0.0(transitive)
+ Addedshescape@1.6.1(transitive)
+ Addedwhich@2.0.2(transitive)