Skip to content

Commit

Permalink
Merge pull request #569 from snyk/feat/improved-gradle-support
Browse files Browse the repository at this point in the history
feat: Gradle Android config selection, verified Gradle 2.x support
  • Loading branch information
Konstantin Yegupov committed Jun 11, 2019
2 parents 0babc68 + c8bad2d commit e078430
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 9 deletions.
9 changes: 9 additions & 0 deletions help/help.txt
Expand Up @@ -55,6 +55,15 @@ Gradle options:
test a specific sub-project.
--all-sub-projects For "multi project" configurations, test all
sub-projects.
--configuration-matching=<string>
Resolve dependencies using only configuration(s) that
match the provided Java regular expression, e.g.
'^releaseRuntimeClasspath$'.
--configuration-attributes=<string>
Select certain values of configuration attributes to
resolve the dependencies. E.g.:
'buildtype:release,usage:java-runtime'
More information: https://snyk.io/docs/cli-advanced-gradle-testing/

.Net (Nuget) options:
--assets-project-name
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -71,7 +71,7 @@
"snyk-config": "^2.2.1",
"snyk-docker-plugin": "1.25.1",
"snyk-go-plugin": "1.9.0",
"snyk-gradle-plugin": "2.11.2",
"snyk-gradle-plugin": "2.12.4",
"snyk-module": "1.9.1",
"snyk-mvn-plugin": "2.3.0",
"snyk-nodejs-lockfile-parser": "1.13.0",
Expand Down
6 changes: 3 additions & 3 deletions src/cli/commands/monitor.ts
Expand Up @@ -144,9 +144,9 @@ async function monitor(...args0: MethodArgs): Promise<any> {
} else {
if (!options['gradle-sub-project']
&& inspectResult.plugin.meta
&& inspectResult.plugin.meta.allDepRootNames
&& inspectResult.plugin.meta.allDepRootNames.length > 1) {
advertiseSubprojectsCount = inspectResult.plugin.meta.allDepRootNames.length;
&& inspectResult.plugin.meta.allSubProjectNames
&& inspectResult.plugin.meta.allSubProjectNames.length > 1) {
advertiseSubprojectsCount = inspectResult.plugin.meta.allSubProjectNames.length;
}
perDepRootResults = [inspectResult];
}
Expand Down
6 changes: 3 additions & 3 deletions src/lib/snyk-test/run-test.ts
Expand Up @@ -214,9 +214,9 @@ async function getDepsFromPlugin(root, options: TestOptions): Promise<MultiDepRo
// but don't want to send to Registry in the Payload.
// TODO(kyegupov): decouple inspect and payload so that we don't need this hack
if (inspectRes.plugin.meta
&& inspectRes.plugin.meta.allDepRootNames
&& inspectRes.plugin.meta.allDepRootNames.length > 1) {
options.advertiseSubprojectsCount = inspectRes.plugin.meta.allDepRootNames.length;
&& inspectRes.plugin.meta.allSubProjectNames
&& inspectRes.plugin.meta.allSubProjectNames.length > 1) {
options.advertiseSubprojectsCount = inspectRes.plugin.meta.allSubProjectNames.length;
}
return {
plugin: inspectRes.plugin,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/types.ts
Expand Up @@ -12,7 +12,7 @@ export interface PluginMetadata {
runtime?: any;
dockerImageId: any;
meta?: {
allDepRootNames: string[]; // To warn the user about subprojects not being scanned
allSubProjectNames: string[]; // To warn the user about subprojects not being scanned
};
}

Expand Down
2 changes: 1 addition & 1 deletion test/acceptance/cli.acceptance.test.ts
Expand Up @@ -2310,7 +2310,7 @@ test('`monitor gradle-app`', async (t) => {
name: 'testplugin',
runtime: 'testruntime',
meta: {
allDepRootNames: ['foo', 'bar'],
allSubProjectNames: ['foo', 'bar'],
},
},
package: {},
Expand Down

0 comments on commit e078430

Please sign in to comment.