Socket
Socket
Sign inDemoInstall

snyk-gradle-plugin

Package Overview
Dependencies
Maintainers
1
Versions
141
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

snyk-gradle-plugin - npm Package Compare versions

Comparing version 3.1.0 to 3.2.0

6

dist/index.d.ts

@@ -8,2 +8,3 @@ import { legacyCommon, legacyPlugin as api } from '@snyk/cli-interface';

declare type Options = api.InspectOptions & GradleInspectOptions;
declare type VersionBuildInfo = api.VersionBuildInfo;
export declare function inspect(root: string, targetFile: string, options?: api.SingleSubprojectInspectOptions & GradleInspectOptions): Promise<api.SinglePackageResult>;

@@ -15,2 +16,3 @@ export declare function inspect(root: string, targetFile: string, options: api.MultiSubprojectInspectOptions & GradleInspectOptions): Promise<api.MultiProjectResult>;

allSubProjectNames: string[];
versionBuildInfo: VersionBuildInfo;
}

@@ -27,2 +29,4 @@ interface ProjectsDict {

declare function extractJsonFromScriptOutput(stdoutText: string): JsonDepsScriptResult;
declare function getVersionBuildInfo(gradleVersionOutput: string): VersionBuildInfo | undefined;
declare function toCamelCase(input: string): string;
declare function buildArgs(root: string, targetFile: string | null, initGradlePath: string, options: Options): string[];

@@ -32,3 +36,5 @@ export declare const exportsForTests: {

extractJsonFromScriptOutput: typeof extractJsonFromScriptOutput;
getVersionBuildInfo: typeof getVersionBuildInfo;
toCamelCase: typeof toCamelCase;
};
export {};

55

dist/index.js

@@ -71,2 +71,3 @@ "use strict";

gradleProjectName: depTreeAndDepRootNames.gradleProjectName,
versionBuildInfo: depTreeAndDepRootNames.versionBuildInfo,
},

@@ -113,2 +114,3 @@ };

gradleProjectName: meta.gradleProjectName,
versionBuildInfo: allProjectDeps.versionBuildInfo,
};

@@ -129,2 +131,3 @@ }

gradleProjectName: defaultProject,
versionBuildInfo: allProjectDeps.versionBuildInfo,
};

@@ -167,2 +170,3 @@ });

gradleProjectName,
versionBuildInfo: allProjectDeps.versionBuildInfo,
},

@@ -223,2 +227,38 @@ depTree: {

}
// when running a project is making use of gradle wrapper, the first time we run `gradlew -v`, the download
// process happens, cluttering the parsing of the gradle output.
// will extract the needed data using a regex
function cleanupVersionOutput(gradleVersionOutput) {
const matchedData = gradleVersionOutput.match(/(--[\s\S]*?$)/g);
if (matchedData) {
return matchedData[0];
}
debugLog('cannot parse gradle version output:' + gradleVersionOutput);
return '';
}
function getVersionBuildInfo(gradleVersionOutput) {
try {
const cleanedVersionOutput = cleanupVersionOutput(gradleVersionOutput);
if (cleanedVersionOutput !== '') {
const gradleOutputArray = cleanedVersionOutput.split(/\r\n|\r|\n/);
// from first 3 new lines, we get the gradle version
const gradleVersion = gradleOutputArray[1].split(' ')[1].trim();
const versionMetaInformation = gradleOutputArray.slice(4, gradleOutputArray.length);
// from line 4 until the end we get multiple meta information such as Java, Groovy, Kotlin, etc.
const metaBuildVersion = {};
// we want to remove all the new lines before processing each line from gradle -v output
versionMetaInformation.map((value) => value.replace(/[\s\S](\r\n|\n|\r)/g, ''))
.filter((value) => value && value.length > 0 && value.includes(': '))
.map((value) => value.split(/(.*): (.*)/))
.forEach((splitValue) => metaBuildVersion[toCamelCase(splitValue[1].trim())] = splitValue[2].trim());
return {
gradleVersion,
metaBuildVersion,
};
}
}
catch (error) {
debugLog('version build info not present, skipping ahead: ' + error);
}
}
function getAllDeps(root, targetFile, options) {

@@ -246,3 +286,8 @@ return tslib_1.__awaiter(this, void 0, void 0, function* () {

}
return extractJsonFromScriptOutput(stdoutText);
const extractedJson = extractJsonFromScriptOutput(stdoutText);
const versionBuildInfo = getVersionBuildInfo(gradleVersionOutput);
if (versionBuildInfo) {
extractedJson.versionBuildInfo = versionBuildInfo;
}
return extractedJson;
}

@@ -316,2 +361,8 @@ catch (error0) {

}
function toCamelCase(input) {
input = input.toLowerCase().replace(/(?:(^.)|([-_\s]+.))/g, (match) => {
return match.charAt(match.length - 1).toUpperCase();
});
return input.charAt(0).toLowerCase() + input.substring(1);
}
function getCommand(root, targetFile) {

@@ -385,3 +436,5 @@ const isWinLocal = /^win/.test(os.platform()); // local check, can be stubbed in tests

extractJsonFromScriptOutput,
getVersionBuildInfo,
toCamelCase,
};
//# sourceMappingURL=index.js.map

4

package.json

@@ -43,3 +43,3 @@ {

"dependencies": {
"@snyk/cli-interface": "^2.1.0",
"@snyk/cli-interface": "2.2.0",
"@types/debug": "^4.1.4",

@@ -52,3 +52,3 @@ "chalk": "^2.4.2",

},
"version": "3.1.0"
"version": "3.2.0"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc