Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add support for gradle's kotlin-dsl #277

Merged
merged 3 commits into from
Mar 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/lib/detect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const DETECTABLE_FILES = [
'Gemfile.lock',
'pom.xml',
'build.gradle',
'build.gradle.kts',
'build.sbt',
'Pipfile',
'requirements.txt',
Expand All @@ -33,6 +34,7 @@ const DETECTABLE_PACKAGE_MANAGERS = {
'package-lock.json': 'npm',
'pom.xml': 'maven',
'build.gradle': 'gradle',
'build.gradle.kts': 'gradle',
'build.sbt': 'sbt',
'yarn.lock': 'yarn',
'package.json': 'npm',
Expand Down
27 changes: 27 additions & 0 deletions test/acceptance/cli.acceptance.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,32 @@ test('`test gradle-app` returns correct meta', function (t) {
});
});

test('`test gradle-kotlin-dsl-app` returns correct meta', function (t) {
chdirWorkspaces();
var plugin = {
inspect: function () {
return Promise.resolve({package: {}});
},
};
sinon.spy(plugin, 'inspect');
sinon.stub(plugins, 'loadPlugin');
t.teardown(plugins.loadPlugin.restore);
plugins.loadPlugin.withArgs('gradle').returns(plugin);

return cli.test('gradle-kotlin-dsl-app')
.then(function (res) {
var meta = res.slice(res.indexOf('Organisation:')).split('\n');
t.match(meta[0], /Organisation:\s+test-org/, 'organisation displayed');
t.match(meta[1], /Package manager:\s+gradle/,
'package manager displayed');
t.match(meta[2], /Target file:\s+build.gradle.kts/, 'target file displayed');
t.match(meta[3], /Open source:\s+no/, 'open source displayed');
t.match(meta[4], /Project path:\s+gradle-kotlin-dsl-app/, 'path displayed');
t.notMatch(meta[5], /Local Snyk policy:\s+found/,
'local policy not displayed');
});
});

test('`test` returns correct meta when target file specified', function (t) {
chdirWorkspaces();
return cli.test('ruby-app', {file: 'Gemfile.lock'})
Expand Down Expand Up @@ -2280,6 +2306,7 @@ test('`protect` for unsupported package managers', function (t) {
{ file: 'pip-app/requirements.txt', type: 'Python' },
{ file: 'sbt-app/build.sbt', type: 'SBT' },
{ file: 'gradle-app/build.gradle', type: 'Gradle' },
{ file: 'gradle-kotlin-dsl-app/build.gradle.kts', type: 'Gradle' },
{ file: 'golang-app/Gopkg.lock', type: 'Golang/Dep' },
{ file: 'golang-app/vendor/vendor.json', type: 'Govendor' },
{ file: 'composer-app/composer.lock', type: 'Composer' },
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// not a real Gradle build file