Skip to content

Commit

Permalink
Add functional tests for dependencyResolutionManagement
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Lacasse <daniel@lacasse.io>
  • Loading branch information
lacasseio committed Jul 9, 2024
1 parent f53adf3 commit 3d47bd5
Showing 1 changed file with 67 additions and 0 deletions.
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')
}
}

0 comments on commit 3d47bd5

Please sign in to comment.