-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure Kotlin dependencies are properly handled when forced (#825)
- Loading branch information
Showing
2 changed files
with
104 additions
and
3 deletions.
There are no files selected for viewing
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
100 changes: 100 additions & 0 deletions
100
...ugin/src/test/groovy/com/github/benmanes/gradle/versions/PluginUpdateDetectionSpec.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,100 @@ | ||
package com.github.benmanes.gradle.versions | ||
|
||
import org.gradle.testkit.runner.GradleRunner | ||
import org.junit.Rule | ||
import org.junit.rules.TemporaryFolder | ||
import spock.lang.See | ||
import spock.lang.Specification | ||
|
||
import static org.gradle.testkit.runner.TaskOutcome.SUCCESS | ||
|
||
final class PluginUpdateDetectionSpec extends Specification { | ||
private static final KOTLIN_VERSION = '1.6.0' | ||
|
||
@Rule | ||
final TemporaryFolder testProjectDir = new TemporaryFolder() | ||
private String mavenRepoUrl | ||
|
||
def 'setup'() { | ||
mavenRepoUrl = getClass().getResource('/maven/').toURI() | ||
} | ||
|
||
@See("https://github.com/ben-manes/gradle-versions-plugin/discussions/823") | ||
def "kotlin plugin in the classpath configuration is properly handled (applying JVM plugin: #applyJvmPlugin)"() { | ||
given: | ||
testProjectDir.newFile('build.gradle') << | ||
""" | ||
buildscript { | ||
dependencies { | ||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:\$kotlin_version" | ||
} | ||
} | ||
|
||
plugins { | ||
id 'com.github.ben-manes.versions' version '0.50.0' | ||
id 'java-gradle-plugin' | ||
${applyJvmPlugin ? "id 'org.jetbrains.kotlin.jvm' version \"\$kotlin_version\"" : ''} | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation "org.jetbrains.kotlin:kotlin-gradle-plugin:\$kotlin_version" | ||
} | ||
""".stripIndent() | ||
testProjectDir.newFile('gradle.properties') << "kotlin_version = $KOTLIN_VERSION" | ||
when: | ||
def result = GradleRunner.create() | ||
.withProjectDir(testProjectDir.root) | ||
.withArguments('dependencyUpdates') | ||
.withPluginClasspath() | ||
.build() | ||
then: | ||
result.output.contains """The following dependencies have later milestone versions: | ||
- org.jetbrains.kotlin:kotlin-gradle-plugin [$KOTLIN_VERSION -> """ | ||
result.task(':dependencyUpdates').outcome == SUCCESS | ||
where: | ||
applyJvmPlugin << [true, false] | ||
} | ||
@See("https://github.com/ben-manes/gradle-versions-plugin/discussions/823") | ||
def "kotlin plugin in the implementation configuration is properly handled"() { | ||
given: | ||
testProjectDir.newFile('build.gradle') << | ||
""" | ||
plugins { | ||
id 'com.github.ben-manes.versions' version '0.46.0' | ||
id 'java-gradle-plugin' | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation "org.jetbrains.kotlin:kotlin-stdlib:\$kotlin_version" | ||
implementation "org.jetbrains.kotlin:kotlin-gradle-plugin:\$kotlin_version" | ||
} | ||
""".stripIndent() | ||
testProjectDir.newFile('gradle.properties') << "kotlin_version = $KOTLIN_VERSION" | ||
when: | ||
def result = GradleRunner.create() | ||
.withProjectDir(testProjectDir.root) | ||
.withArguments('dependencyUpdates') | ||
.withPluginClasspath() | ||
.build() | ||
then: | ||
result.output.contains """The following dependencies have later milestone versions: | ||
- org.jetbrains.kotlin:kotlin-gradle-plugin [$KOTLIN_VERSION -> """ | ||
result.task(':dependencyUpdates').outcome == SUCCESS | ||
} | ||
} |