Skip to content

Commit 983fccf

Browse files
author
Marcel Schnelle
authored
Deprecate embedded-runtime artifact & separate its version from the plugin, so they can start to diverge (#86)
1 parent 2471181 commit 983fccf

File tree

8 files changed

+40
-23
lines changed

8 files changed

+40
-23
lines changed

android-junit5-embedded-runtime/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ dependencies {
2828
shadowJar {
2929
// Remove '-all' suffix from the generated JAR
3030
classifier = null
31-
version = PLUGIN_RUNTIME_VERSION_NAME
31+
version = RUNTIME_VERSION_NAME
3232
}
3333

3434
// Replace the default JAR task with the "shadow version",
@@ -46,7 +46,7 @@ jar.dependsOn shadowJar
4646
project.ext.deployConfig = [platform : "java",
4747
groupId : RUNTIME_GROUP_ID,
4848
artifactId : RUNTIME_ARTIFACT_ID,
49-
version : PLUGIN_RUNTIME_VERSION_NAME,
49+
version : RUNTIME_VERSION_NAME,
5050
license : LICENSE_NAME,
5151
description : RUNTIME_DESCRIPTION,
5252
doBeforePublish: {

android-junit5/build.gradle

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,13 @@ gradlePlugin {
4848
import org.apache.tools.ant.filters.ReplaceTokens
4949

5050
processResources {
51-
def tokens = [ANDROID_JUNIT5_VERSION : PLUGIN_RUNTIME_VERSION_NAME,
52-
JUNIT4_VERSION : JUNIT4_VERSION,
53-
INSTRUMENTATION_TEST_VERSION: INSTRUMENTATION_VERSION_NAME_LATEST_STABLE,
54-
JUNIT_PLATFORM_VERSION : JUNIT_PLATFORM_VERSION,
55-
JUNIT_JUPITER_VERSION : JUNIT_JUPITER_VERSION,
56-
JUNIT_VINTAGE_VERSION : JUNIT_VINTAGE_VERSION]
51+
def tokens = [ANDROID_JUNIT5_VERSION : PLUGIN_VERSION_NAME,
52+
ANDROID_JUNIT5_RUNTIME_VERSION: RUNTIME_VERSION_NAME,
53+
JUNIT4_VERSION : JUNIT4_VERSION,
54+
INSTRUMENTATION_TEST_VERSION : INSTRUMENTATION_VERSION_NAME_LATEST_STABLE,
55+
JUNIT_PLATFORM_VERSION : JUNIT_PLATFORM_VERSION,
56+
JUNIT_JUPITER_VERSION : JUNIT_JUPITER_VERSION,
57+
JUNIT_VINTAGE_VERSION : JUNIT_VINTAGE_VERSION]
5758

5859
inputs.properties(tokens)
5960

@@ -100,7 +101,7 @@ dependencies {
100101
project.ext.deployConfig = [platform : "java",
101102
groupId : PLUGIN_GROUP_ID,
102103
artifactId : PLUGIN_ARTIFACT_ID,
103-
version : PLUGIN_RUNTIME_VERSION_NAME,
104+
version : PLUGIN_VERSION_NAME,
104105
license : LICENSE_NAME,
105106
description: PLUGIN_DESCRIPTION]
106107
apply from: "$rootDir/gradle/deployment.gradle"

android-junit5/src/main/kotlin/de/mannodermaus/gradle/plugins/junit5/Constants.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const val ENGINES_EXTENSION_NAME = "engines"
1313

1414
// Mirrored from "versions.properties" resource file
1515
const val ANDROID_JUNIT5_VERSION_PROP = "androidJunit5Version"
16+
const val ANDROID_JUNIT5_RUNTIME_VERSION_PROP = "androidJunit5RuntimeVersion"
1617
const val JUNIT_PLATFORM_VERSION_PROP = "junitPlatformVersion"
1718
const val JUNIT_JUPITER_VERSION_PROP = "junitJupiterVersion"
1819
const val JUNIT_VINTAGE_VERSION_PROP = "junitVintageVersion"

android-junit5/src/main/kotlin/de/mannodermaus/gradle/plugins/junit5/Dependencies.kt

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package de.mannodermaus.gradle.plugins.junit5
22

3+
import de.mannodermaus.gradle.plugins.junit5.internal.agpLog
34
import de.mannodermaus.gradle.plugins.junit5.internal.android
45
import de.mannodermaus.gradle.plugins.junit5.internal.ext
56
import org.gradle.api.Project
67
import org.gradle.api.ProjectConfigurationException
78
import org.gradle.api.artifacts.Dependency
9+
import org.gradle.api.logging.LogLevel.WARN
810
import java.util.Properties
911

1012
/*
@@ -60,10 +62,21 @@ class JUnit5DependencyHandler(
6062
/**
6163
* Retrieves the list of dependencies related to
6264
* executing Unit Tests in Android Studio 3 properly.
65+
*
66+
* Deprecated in 1.0.32
6367
*/
64-
fun unitTestsRuntime() = listOf(
65-
versions.others.embeddedRuntime
66-
)
68+
@Deprecated(message = "The unitTestsRuntime() dependency has been deprecated " +
69+
"with the stable release of Android Studio 3.1, and will be removed in a future release. " +
70+
"Please go ahead, update your IDE & remove this dependency!")
71+
fun unitTestsRuntime(): List<Dependency> {
72+
project.logger.agpLog(WARN, "The unitTestsRuntime() dependency has been deprecated " +
73+
"with the stable release of Android Studio 3.1, and will be removed in a future release. " +
74+
"Please go ahead, update your IDE & remove this dependency!")
75+
76+
return listOf(
77+
versions.others.embeddedRuntime
78+
)
79+
}
6780

6881
/**
6982
* Retrieves the list of dependencies related to
@@ -202,7 +215,7 @@ class Other(
202215
val embeddedRuntime = dependency(
203216
groupId = "de.mannodermaus.gradle.plugins",
204217
artifactId = "android-junit5-embedded-runtime",
205-
version = properties.getProperty(ANDROID_JUNIT5_VERSION_PROP))
218+
version = properties.getProperty(ANDROID_JUNIT5_RUNTIME_VERSION_PROP))
206219

207220
val junit4 = dependency(
208221
groupId = "junit",
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# suppress inspection "UnusedProperty" for whole file
22
# (Populated from a Gradle "process resources" task)
3-
androidJunit5Version = @ANDROID_JUNIT5_VERSION@
4-
junit4Version = @JUNIT4_VERSION@
5-
instrumentationTestVersion = @INSTRUMENTATION_TEST_VERSION@
3+
androidJunit5Version = @ANDROID_JUNIT5_VERSION@
4+
androidJunit5RuntimeVersion = @ANDROID_JUNIT5_RUNTIME_VERSION@
5+
junit4Version = @JUNIT4_VERSION@
6+
instrumentationTestVersion = @INSTRUMENTATION_TEST_VERSION@
67

7-
junitPlatformVersion = @JUNIT_PLATFORM_VERSION@
8-
junitJupiterVersion = @JUNIT_JUPITER_VERSION@
9-
junitVintageVersion = @JUNIT_VINTAGE_VERSION@
8+
junitPlatformVersion = @JUNIT_PLATFORM_VERSION@
9+
junitJupiterVersion = @JUNIT_JUPITER_VERSION@
10+
junitVintageVersion = @JUNIT_VINTAGE_VERSION@

gradle.properties

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ LICENSE_NAME = Apache-2.0
1212
PLUGIN_GROUP_ID = de.mannodermaus.gradle.plugins
1313
PLUGIN_ARTIFACT_ID = android-junit5
1414
PLUGIN_DESCRIPTION = Unit Testing with JUnit 5 for Android.
15-
PLUGIN_RUNTIME_VERSION_NAME = 1.0.32-SNAPSHOT
16-
PLUGIN_RUNTIME_VERSION_NAME_LATEST_STABLE = 1.0.31
15+
PLUGIN_VERSION_NAME = 1.0.32-SNAPSHOT
16+
PLUGIN_VERSION_NAME_LATEST_STABLE = 1.0.31
1717

1818
# Artifact configuration (embedded-runtime)
1919
RUNTIME_GROUP_ID = de.mannodermaus.gradle.plugins
2020
RUNTIME_ARTIFACT_ID = android-junit5-embedded-runtime
2121
RUNTIME_DESCRIPTION = Mirror of IntelliJ IDEA's embedded JUnit 5 Runtime.
22+
RUNTIME_VERSION_NAME = 1.0.32-SNAPSHOT
2223

2324
# Artifact configuration (instrumentation & runner)
2425
INSTRUMENTATION_GROUP_ID = de.mannodermaus.junit5

instrumentation-runner/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ buildscript {
99
}
1010

1111
dependencies {
12-
classpath "de.mannodermaus.gradle.plugins:android-junit5:$PLUGIN_RUNTIME_VERSION_NAME_LATEST_STABLE"
12+
classpath "de.mannodermaus.gradle.plugins:android-junit5:$PLUGIN_VERSION_NAME_LATEST_STABLE"
1313
}
1414
}
1515

sample/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
}
77

88
dependencies {
9-
classpath "de.mannodermaus.gradle.plugins:android-junit5:$PLUGIN_RUNTIME_VERSION_NAME_LATEST_STABLE"
9+
classpath "de.mannodermaus.gradle.plugins:android-junit5:$PLUGIN_VERSION_NAME_LATEST_STABLE"
1010
}
1111
}
1212

0 commit comments

Comments
 (0)