Skip to content

Commit 600ef50

Browse files
committedNov 21, 2024··
feat: support verbose gradle graphs for sbom generation
1 parent 15fd184 commit 600ef50

File tree

5 files changed

+60
-10
lines changed

5 files changed

+60
-10
lines changed
 

‎package-lock.json

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
"snyk-cpp-plugin": "2.24.0",
119119
"snyk-docker-plugin": "6.13.15",
120120
"snyk-go-plugin": "1.23.0",
121-
"snyk-gradle-plugin": "4.6.0",
121+
"snyk-gradle-plugin": "4.7.0",
122122
"snyk-module": "3.1.0",
123123
"snyk-mvn-plugin": "3.6.0",
124124
"snyk-nodejs-lockfile-parser": "1.58.10",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
plugins {
2+
id 'java'
3+
}
4+
5+
repositories {
6+
mavenCentral()
7+
}
8+
9+
dependencies {
10+
implementation 'org.apache.ignite:ignite-spring:2.13.0'
11+
implementation 'org.apache.ignite:ignite-indexing:2.13.0'
12+
implementation 'org.apache.ignite:ignite-core:2.13.0'
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
plugins {
2+
id 'java-library'
3+
}
4+
5+
group = 'com.example'
6+
version = '1.0'
7+
8+
repositories {
9+
mavenCentral()
10+
}
11+
12+
dependencies {
13+
implementation 'org.apache.ignite:ignite-spring:2.13.0'
14+
implementation 'org.apache.ignite:ignite-indexing:2.13.0'
15+
implementation 'org.apache.ignite:ignite-core:2.13.0'
16+
}

‎test/jest/acceptance/snyk-test/print-graph.spec.ts

+23-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import { createProjectFromWorkspace } from '../../util/createProject';
1+
import {
2+
createProjectFromFixture,
3+
createProjectFromWorkspace,
4+
} from '../../util/createProject';
25
import { runSnykCLI } from '../../util/runSnykCLI';
36

47
jest.setTimeout(1000 * 60);
@@ -16,7 +19,7 @@ describe('print graph', () => {
1619
expect(stdout).toMatch('DepGraph target:\npackage-lock.json');
1720
});
1821

19-
test('`snyk test --print-graph` should not prune dependencies', async () => {
22+
test('`snyk test --print-graph` should not prune maven dependencies', async () => {
2023
const project = await createProjectFromWorkspace('maven-many-paths');
2124

2225
const { code, stdout } = await runSnykCLI('test --print-graph', {
@@ -34,6 +37,24 @@ describe('print graph', () => {
3437
expect(numEdges).toEqual(7);
3538
});
3639

40+
test('`snyk test --print-graph` should not prune gradle dependencies', async () => {
41+
const project = await createProjectFromFixture('gradle-with-repeated-deps');
42+
43+
const { code, stdout } = await runSnykCLI('test --print-graph', {
44+
cwd: project.path(),
45+
});
46+
47+
expect(code).toEqual(0);
48+
const depGraph = JSON.parse(
49+
stdout.split('DepGraph data:')[1]?.split('DepGraph target:')[0],
50+
);
51+
let numEdges = 0;
52+
for (const node of depGraph.graph.nodes) {
53+
numEdges += node.deps.length;
54+
}
55+
expect(numEdges).toEqual(28);
56+
});
57+
3758
test('`snyk test --print-graph --all-projects` should not prune dependencies', async () => {
3859
const project = await createProjectFromWorkspace('maven-many-paths');
3960

0 commit comments

Comments
 (0)
Please sign in to comment.