Skip to content

Commit

Permalink
Merge pull request #156 from snyk/feat/pass-gradle-util-to-call-graph…
Browse files Browse the repository at this point in the history
…-builder

feat: pass gradle util to java call graph builder
  • Loading branch information
Dar Malovani authored Dec 10, 2020
2 parents cc4489d + 61805d6 commit 546029e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,11 @@ export async function inspect(
let callGraph: CallGraph | undefined;
const targetPath = path.join(root, targetFile);
if (options.reachableVulns) {
const command = getCommand(root, targetFile);
debugLog(`getting call graph from path ${targetPath}`);
callGraph = await javaCallGraphBuilder.getCallGraphGradle(
path.dirname(targetPath),
command,
);
debugLog('got call graph successfully');
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"dependencies": {
"@snyk/cli-interface": "2.9.1",
"@snyk/dep-graph": "^1.19.4",
"@snyk/java-call-graph-builder": "1.16.2",
"@snyk/java-call-graph-builder": "1.18.0",
"@types/debug": "^4.1.4",
"chalk": "^3.0.0",
"debug": "^4.1.1",
Expand Down
5 changes: 4 additions & 1 deletion test/system/plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ test('run inspect() with reachableVulns', async (t) => {
);
t.ok(javaCallGraphBuilderStub.calledOnce, 'called to the call graph builder');
t.ok(
javaCallGraphBuilderStub.calledWith(path.join('.', rootNoWrapper)),
javaCallGraphBuilderStub.calledWith(
path.join('.', rootNoWrapper),
'gradle',
),
'call graph builder was called with the correct path',
);
t.same(gradleCallGraph, result.callGraph, 'returns expected callgraph');
Expand Down

0 comments on commit 546029e

Please sign in to comment.