Skip to content

Commit 22fadf7

Browse files
authored
Merge pull request #5852 from snyk/feat/snyk-gradle-plugin-bump
feat: snyk-gradle-plugin improvements
2 parents c9391eb + 7991133 commit 22fadf7

File tree

4 files changed

+50
-9
lines changed

4 files changed

+50
-9
lines changed

package-lock.json

Lines changed: 7 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
"snyk-cpp-plugin": "2.24.0",
120120
"snyk-docker-plugin": "6.18.2",
121121
"snyk-go-plugin": "1.23.0",
122-
"snyk-gradle-plugin": "4.9.2",
122+
"snyk-gradle-plugin": "5.0.0",
123123
"snyk-module": "3.1.0",
124124
"snyk-mvn-plugin": "3.8.0",
125125
"snyk-nodejs-lockfile-parser": "1.60.1",
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
plugins {
2+
id 'application'
3+
}
4+
5+
repositories {
6+
mavenCentral()
7+
}
8+
9+
dependencies {
10+
implementation 'net.sf.json-lib:json-lib:2.4:jdk13'
11+
}

test/jest/acceptance/snyk-test/basic-test-all-languages.spec.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,37 @@ describe('`snyk test` of basic projects for each language/ecosystem', () => {
186186
expect(code).toEqual(0);
187187
});
188188

189+
test('run `snyk test` on a gradle project and check top-level dependency node id', async () => {
190+
const project = await createProjectFromWorkspace('gradle-with-classifier');
191+
192+
const { code, stderr, stdout } = await runSnykCLI('test --print-graph', {
193+
cwd: project.path(),
194+
env,
195+
});
196+
197+
if (code != 0) {
198+
console.debug(stderr);
199+
console.debug('---------------------------');
200+
console.debug(stdout);
201+
}
202+
expect(code).toEqual(0);
203+
204+
const depGraphJsonStr = stdout
205+
.split('DepGraph data:')[1]
206+
.split('DepGraph target:')[0];
207+
const depGraphJson = JSON.parse(depGraphJsonStr);
208+
expect(depGraphJson.pkgManager.name).toEqual('gradle');
209+
expect(depGraphJson.pkgs).toContainEqual({
210+
id: 'net.sf.json-lib:[email protected]',
211+
info: { name: 'net.sf.json-lib:json-lib', version: '2.4' },
212+
});
213+
expect(depGraphJson.graph.nodes).toContainEqual({
214+
nodeId: 'net.sf.json-lib:json-lib:jar:[email protected]',
215+
pkgId: 'net.sf.json-lib:[email protected]',
216+
deps: expect.any(Array),
217+
});
218+
});
219+
189220
test('run `snyk test` on a cocoapods project', async () => {
190221
const project = await createProjectFromWorkspace('cocoapods-app');
191222

0 commit comments

Comments
 (0)