Skip to content

Commit

Permalink
Handle case where a misformed globalLock is in place
Browse files Browse the repository at this point in the history
  • Loading branch information
rspieldenner committed Jan 12, 2018
1 parent 83f43be commit b3fa4a7
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 20 deletions.
19 changes: 2 additions & 17 deletions README.md
Expand Up @@ -29,28 +29,13 @@ Tested with Oracle JDK8

| Gradle Version | Works |
| :------------: | :---: |
| 2.2.1 | yes |
| 2.3 | yes |
| 2.4 | yes |
| 2.5 | yes |
| 2.6 | yes |
| 2.7 | yes |
| 2.8 | yes |
| 2.9 | yes |
| 2.10 | yes |
| 2.11 | yes |
| 2.12 | yes |
| 2.13 | yes |
| 2.14.1 | yes |
| 3.0 | yes |
| 3.1 | yes |
| 3.4.1 | yes |
| 4.4 | yes |
| 4.4.1 | yes |

LICENSE
=======

Copyright 2014-2017 Netflix, Inc.
Copyright 2014-2018 Netflix, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Expand Up @@ -33,7 +33,7 @@ class DependencyLockReader {
[(configurationName): deps.findAll { coord, info ->
def notUpdate = !updates.contains(coord)
def isFirstLevel = info.transitive == null && info.requested != null
def isFirstLevelTransitive = info.transitive.any { deps[it].project }
def isFirstLevelTransitive = info.transitive.any { deps[it]?.project }
notUpdate && (isFirstLevel || isFirstLevelTransitive)
}]
}
Expand Down
@@ -1,6 +1,33 @@
package nebula.plugin.dependencylock

import spock.lang.Specification
import nebula.test.ProjectSpec

class DependencyLockReaderSpec extends Specification {
class DependencyLockReaderSpec extends ProjectSpec {
def 'read global lock with an extraneous transitive that is not in the lock due to manual editing'() {
project.plugins.apply('java')
DependencyLockReader reader = new DependencyLockReader(project)
File globalLock = new File(projectDir, 'myglobal.lock')
globalLock.text = '''\
{
"_global_": {
"mytest:foo": {
"locked": "1.6.5",
"transitive": [
"notinlock:bar"
]
},
"mytest:foobar": {
"locked": "1.6.5",
"requested": "1.+"
}
}
}
'''.stripIndent()

when:
def map = reader.readLocks(project.configurations.compile, globalLock, ['test:baz'])

then:
noExceptionThrown()
}
}

0 comments on commit b3fa4a7

Please sign in to comment.