Skip to content

Commit a3654e2

Browse files
committed
Update sample & tests to use the new dependency handlers
1 parent e5bdb13 commit a3654e2

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

android-junit5/src/main/groovy/de/mannodermaus/gradle/plugins/android_junit5/AndroidJUnitPlatformPlugin.groovy

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ class AndroidJUnitPlatformPlugin implements Plugin<Project> {
3131
'}'
3232
}
3333

34-
private static final String JUNITJUPITER_DEPENDENCY_WARNING = dependencyDeprecationWarning("junitJupiter", "junitPlatform")
35-
private static final String JUNITPARAMS_DEPENDENCY_WARNING = dependencyDeprecationWarning("junitParams", "junitJupiterParams")
34+
private static final String JUNITJUPITER_DEPENDENCY_WARNING = dependencyDeprecationWarning("junitJupiter", "junit5")
35+
private static final String JUNITPARAMS_DEPENDENCY_WARNING = dependencyDeprecationWarning("junitParams", "junit5Params")
3636

3737
/**
3838
* This method doesn't call through to super.apply().
@@ -79,7 +79,7 @@ class AndroidJUnitPlatformPlugin implements Plugin<Project> {
7979
}
8080

8181
// Configure dependency handlers
82-
project.dependencies.ext.junitPlatform = {
82+
project.dependencies.ext.junit5 = {
8383
def jupiterVersion = junitExtension.jupiterVersion
8484
def platformVersion = junitExtension.platformVersion
8585
def vintageVersion = junitExtension.vintageVersion
@@ -98,7 +98,7 @@ class AndroidJUnitPlatformPlugin implements Plugin<Project> {
9898
]
9999
}
100100

101-
project.dependencies.ext.junitJupiterParams = {
101+
project.dependencies.ext.junit5Params = {
102102
def jupiterVersion = junitExtension.jupiterVersion
103103

104104
return project.dependencies.create("org.junit.jupiter:junit-jupiter-params:${jupiterVersion}")
@@ -107,12 +107,12 @@ class AndroidJUnitPlatformPlugin implements Plugin<Project> {
107107
// Add deprecated dependency handlers
108108
project.dependencies.ext.junitJupiter = {
109109
project.logger.warn(JUNITJUPITER_DEPENDENCY_WARNING)
110-
return project.dependencies.ext.junitPlatform()
110+
return project.dependencies.ext.junit5()
111111
}
112112

113113
project.dependencies.ext.junitParams = {
114114
project.logger.warn(JUNITPARAMS_DEPENDENCY_WARNING)
115-
return project.dependencies.ext.junitJupiterParams()
115+
return project.dependencies.ext.junit5Params()
116116
}
117117

118118
project.afterEvaluate {

android-junit5/src/test/groovy/de/mannodermaus/gradle/plugins/android_junit5/AndroidJUnitPlatformSpec.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ abstract class AndroidJUnitPlatformSpec extends Specification {
295295
}
296296
p.dependencies {
297297
// "testCompile" or "testApi"
298-
invokeMethod(testCompileDependencyName(), junitJupiter())
298+
invokeMethod(testCompileDependencyName(), junit5())
299299
}
300300

301301
then:

sample/build.gradle

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,16 @@ buildscript {
99

1010
dependencies {
1111
//noinspection GradleDynamicVersion
12-
classpath "de.mannodermaus.gradle.plugins:android-junit5:+"
12+
classpath ("de.mannodermaus.gradle.plugins:android-junit5:1.0.0-RC3-rev1-SNAPSHOT") {
13+
changing = true
14+
}
1315
classpath "com.android.tools.build:gradle:$ANDROID_PLUGIN_3X_VERSION"
1416
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
1517
}
18+
19+
configurations.classpath {
20+
resolutionStrategy.cacheChangingModulesFor 5, "minutes"
21+
}
1622
}
1723

1824
apply plugin: "com.android.application"
@@ -51,8 +57,8 @@ android {
5157
dependencies {
5258
api "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
5359

54-
testImplementation junitJupiter()
55-
testImplementation junitParams()
60+
testImplementation junit5()
61+
testImplementation junit5Params()
5662
}
5763

5864
// IJ doesn't recognize Kotlin test classes properly,

0 commit comments

Comments
 (0)