Skip to content

Commit

Permalink
Do not consider testFixtures* a runtime variant
Browse files Browse the repository at this point in the history
The java-test-fixtures plugin creates configurations that meet criteria
for a runtime variant, but also include a dependency on the current
project. This results in the manifest declaring an optional dependency
on itself.

This fix will exclude any configuration that starts with testFixtures.
It seems like a reasonable compromise since testFixtures are intended
for testing and not for runtime dependencies.

Fixes #175
  • Loading branch information
sghill committed Dec 29, 2020
1 parent 3b0dc03 commit f6abf2c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,9 @@ class JpiPlugin implements Plugin<Project> {
}

private static boolean isRuntimeVariant(Configuration variant) {
if (variant.name.startsWith('testFixtures')) {
return false
}
(variant.canBeConsumed
&& variant.attributes.getAttribute(Usage.USAGE_ATTRIBUTE)?.
name == Usage.JAVA_RUNTIME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,28 @@ abstract class AbstractManifestIntegrationSpec extends IntegrationSpec {
secondRun.task(taskPath).outcome == TaskOutcome.UP_TO_DATE
}
def 'should not cause cyclical dependency with java-test-fixtures plugin'() {
given:
build.text = """\
plugins {
id 'java-test-fixtures'
id 'org.jenkins-ci.jpi'
}
jenkinsPlugin {
jenkinsVersion = '${TestSupport.RECENT_JENKINS_VERSION}'
}
dependencies {
implementation 'org.jenkins-ci.plugins:git:4.0.1'
}
""".stripIndent()
when:
def actual = generateManifestThroughGradle()
then:
actual['Plugin-Dependencies'] == 'git:4.0.1'
}
@CompileStatic
BuildResult runTask(String overrideVersion = projectVersion) {
List<String> args = ['-s', taskToRun()]
Expand Down

0 comments on commit f6abf2c

Please sign in to comment.