-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for resolution with dependency locking
- Loading branch information
Showing
1 changed file
with
63 additions
and
0 deletions.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
.../groovy/org/gradle/github/dependencygraph/DependencyLockingDependencyExtractorTest.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package org.gradle.github.dependencygraph | ||
|
||
import org.gradle.test.fixtures.PluginPublisher | ||
import org.gradle.test.fixtures.maven.MavenModule | ||
import spock.lang.IgnoreIf | ||
|
||
class DependencyLockingDependencyExtractorTest extends BaseExtractorTest { | ||
private MavenModule foo | ||
private MavenModule bar | ||
private MavenModule baz | ||
private File settingsFile | ||
private File buildFile | ||
|
||
def setup() { | ||
establishEnvironmentVariables() | ||
|
||
foo = mavenRepo.module("org.test", "foo", "1.0").publish() | ||
|
||
settingsFile = file("settings.gradle") << """ | ||
rootProject.name = 'a' | ||
""" | ||
|
||
buildFile = file("build.gradle") << """ | ||
apply plugin: 'java' | ||
repositories { | ||
maven { url "${mavenRepo.uri}" } | ||
} | ||
""" | ||
} | ||
|
||
def "extracts dependencies when dependency locking is enabled"() { | ||
given: | ||
buildFile << """ | ||
dependencies { | ||
implementation "org.test:foo:+" | ||
} | ||
dependencyLocking { | ||
lockAllConfigurations() | ||
lockMode = LockMode.STRICT | ||
} | ||
""" | ||
|
||
// Write dependency lock file | ||
run("dependencies", "--write-locks") | ||
mavenRepo.module("org.test", "foo", "1.1").publish() | ||
|
||
when: | ||
applyDependencyGraphPlugin() | ||
run() | ||
|
||
then: | ||
def manifest = gitHubManifest() | ||
manifest.sourceFile == "settings.gradle" | ||
|
||
manifest.assertResolved([ | ||
"org.test:foo:1.0": [ | ||
package_url: purlFor(foo) | ||
] | ||
]) | ||
} | ||
} |