Skip to content

Commit ef9c0fc

Browse files
committed
Revert automatic integration of JUnit 5 RunnerBuilder
This will break clients that don't want the android-instrumentation-test library yet, because the TestInstrumentationRunner will fail on the missing class' lookup at runtime. The users will have to specify that manually.
1 parent ec37eef commit ef9c0fc

File tree

10 files changed

+11
-38
lines changed

10 files changed

+11
-38
lines changed

android-junit5-tests/common.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ configurations {
1818
processTestResources {
1919
def tokens = [COMPILE_SDK_VERSION: COMPILE_SDK_VERSION,
2020
BUILD_TOOLS_VERSION: BUILD_TOOLS_VERSION,
21-
MIN_SDK_VERSION : MIN_SDK_VERSION,
21+
MIN_SDK_VERSION : SAMPLE_MIN_SDK_VERSION,
2222
TARGET_SDK_VERSION : TARGET_SDK_VERSION]
2323

2424
inputs.properties(tokens)

android-junit5-tests/testCommon/src/test/groovy/de/mannodermaus/gradle/plugins/junit5/BasePluginSpec.groovy

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -440,17 +440,4 @@ abstract class BasePluginSpec extends Specification {
440440
project.tasks.findByName("jacocoTestReportDebug") == null
441441
project.tasks.findByName("jacocoTestReportRelease") == null
442442
}
443-
444-
def "Attaches the JUnit 5 Runner Builder to the Android Default Config"() {
445-
when:
446-
Project project = factory.newProject(rootProject())
447-
.asAndroidApplication()
448-
.applyJunit5Plugin()
449-
.buildAndEvaluate()
450-
451-
then:
452-
def args = project.android.defaultConfig.testInstrumentationRunnerArguments
453-
assert args.containsKey("runnerBuilder")
454-
assert args["runnerBuilder"] == "de.mannodermaus.junit5.AndroidJUnit5Builder"
455-
}
456443
}

android-junit5-tests/testCommon/src/test/groovy/de/mannodermaus/gradle/plugins/junit5/BaseSomething.groovy

Lines changed: 0 additions & 8 deletions
This file was deleted.

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,3 @@ const val JUNIT_PLATFORM_VERSION_PROP = "junitPlatformVersion"
1818
const val JUNIT_JUPITER_VERSION_PROP = "junitJupiterVersion"
1919
const val JUNIT_VINTAGE_VERSION_PROP = "junitVintageVersion"
2020
const val JUNIT4_VERSION_PROP = "junit4Version"
21-
22-
// Android defaultConfig
23-
const val RUNNER_BUILDER_ARG = "runnerBuilder"
24-
const val JUNIT5_RUNNER_BUILDER_CLASS_NAME = "de.mannodermaus.junit5.AndroidJUnit5Builder"

android-junit5/src/main/kotlin/de/mannodermaus/gradle/plugins/junit5/Functions.kt renamed to android-junit5/src/main/kotlin/de/mannodermaus/gradle/plugins/junit5/Extensions.kt

File renamed without changes.

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

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ class AndroidJUnitPlatformPlugin : Plugin<Project> {
3434
project.configureDependencies()
3535
project.afterEvaluate {
3636
it.configureTasks()
37-
it.configureAndroid()
3837
}
3938
}
4039

@@ -128,12 +127,4 @@ class AndroidJUnitPlatformPlugin : Plugin<Project> {
128127

129128
return providers
130129
}
131-
132-
private fun Project.configureAndroid() {
133-
// Include the JUnit 5-based instrumentation Runner
134-
// in the default configuration.
135-
// This is the gateway for automatic instrumented tests support
136-
val defaultConfig = this.android.safeDefaultConfig
137-
defaultConfig.testInstrumentationRunnerArguments[RUNNER_BUILDER_ARG] = JUNIT5_RUNNER_BUILDER_CLASS_NAME
138-
}
139130
}

gradle.properties

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ INSTRUMENTATION_GROUP_ID = de.mannodermaus.junit5
2424
INSTRUMENTATION_ARTIFACT_ID = android-instrumentation-test
2525
INSTRUMENTATION_DESCRIPTION = Extensions for instrumented Android tests with JUnit 5.
2626
INSTRUMENTATION_VERSION_NAME = 0.1.1-SNAPSHOT
27+
INSTRUMENTATION_MIN_SDK_VERSION = 26
2728

2829
# Dependency versions (plugins)
2930
ANDROID_PLUGIN_2X_VERSION = 2.3.3
@@ -38,12 +39,14 @@ DCENDENTS_MAVEN_PLUGIN_VERSION = 2.0
3839
GROOVY_VERSION = 3.0.0-alpha-1
3940
KOTLIN_VERSION = 1.2.0
4041

41-
# Android Environment
42+
# Android Environment (common)
4243
COMPILE_SDK_VERSION = android-27
4344
BUILD_TOOLS_VERSION = 27.0.1
44-
MIN_SDK_VERSION = 26
4545
TARGET_SDK_VERSION = 27
4646

47+
# Android Environment (sample)
48+
SAMPLE_MIN_SDK_VERSION = 14
49+
4750
# Dependency versions
4851
JUNIT_PLATFORM_VERSION = 1.0.2
4952
JUNIT_JUPITER_VERSION = 5.0.2

instrumentation/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ android {
77
compileSdkVersion COMPILE_SDK_VERSION
88

99
defaultConfig {
10-
minSdkVersion MIN_SDK_VERSION
10+
minSdkVersion INSTRUMENTATION_MIN_SDK_VERSION
1111
targetSdkVersion TARGET_SDK_VERSION
1212
versionCode 1
1313
versionName "1.0"

sample/src/test/java/ExampleJavaTest.java renamed to sample/src/test/java/de/mannodermaus/junit5/sample/ExampleJavaTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
package de.mannodermaus.junit5.sample;
2+
13
import java.util.ArrayList;
24
import java.util.Collection;
35
import java.util.List;

sample/src/test/kotlin/ExampleKotlinTest.kt renamed to sample/src/test/kotlin/de/mannodermaus/junit5/sample/ExampleKotlinTest.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
package de.mannodermaus.junit5.sample
2+
13
import org.junit.jupiter.api.AfterAll
24
import org.junit.jupiter.api.AfterEach
35
import org.junit.jupiter.api.Assertions.assertAll

0 commit comments

Comments
 (0)