-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add functional tests for dependencyResolutionManagement
Signed-off-by: Daniel Lacasse <daniel@lacasse.io>
- Loading branch information
Showing
1 changed file
with
67 additions
and
0 deletions.
There are no files selected for viewing
67 changes: 67 additions & 0 deletions
67
...roovy/dev/gradleplugins/GradlePluginDevelopmentRepositoriesExtensionFunctionalTest.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,67 @@ | ||
package dev.gradleplugins | ||
|
||
import dev.gradleplugins.integtests.fixtures.AbstractGradleSpecification | ||
import org.gradle.util.GradleVersion | ||
import org.junit.Assume | ||
|
||
class GradlePluginDevelopmentRepositoriesExtensionFunctionalTest extends AbstractGradleSpecification { | ||
def setup() { | ||
buildFile << ''' | ||
def configuration = configurations.create('toResolve') { | ||
canBeConsumed = false | ||
canBeResolved = true | ||
attributes { | ||
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, 'java-runtime')) | ||
} | ||
} | ||
dependencies { | ||
toResolve 'dev.gradleplugins:gradle-api:6.8.2' | ||
} | ||
tasks.register('verify') { | ||
doLast { | ||
assert configuration.incoming.artifactView { lenient(true) }.artifacts*.id*.displayName == ['gradle-api-6.8.2.jar (dev.gradleplugins:gradle-api:6.8.2)'] | ||
} | ||
} | ||
''' | ||
} | ||
|
||
def "can declare Gradle plugin development repository inside project repositories"() { | ||
given: | ||
settingsFile << configurePluginClasspathAsBuildScriptDependencies() | ||
settingsFile << ''' | ||
apply plugin: 'dev.gradleplugins.gradle-plugin-development' | ||
''' | ||
buildFile << ''' | ||
repositories { | ||
gradlePluginDevelopment() | ||
} | ||
''' | ||
|
||
expect: | ||
succeeds('verify') | ||
} | ||
|
||
def "can declare Gradle plugin development repository inside dependency resolution management"() { | ||
Assume.assumeTrue(GradleVersion.version(gradleDistributionUnderTest) >= GradleVersion.version("6.7")) | ||
|
||
given: | ||
settingsFile << configurePluginClasspathAsBuildScriptDependencies() | ||
settingsFile << ''' | ||
apply plugin: 'dev.gradleplugins.gradle-plugin-development' | ||
dependencyResolutionManagement { | ||
repositories { | ||
gradlePluginDevelopment() | ||
} | ||
repositoriesMode = RepositoriesMode.FAIL_ON_PROJECT_REPOS | ||
} | ||
assert dependencyResolutionManagement.repositories*.name == ['Gradle Plugin Development'] | ||
''' | ||
|
||
expect: | ||
succeeds('verify') | ||
} | ||
} |