File tree Expand file tree Collapse file tree 5 files changed +17
-12
lines changed
android-junit5-tests/src/test/kotlin/de/mannodermaus/gradle/plugins/junit5
groovy/de/mannodermaus/gradle/plugins/junit5
kotlin/de/mannodermaus/gradle/plugins/junit5 Expand file tree Collapse file tree 5 files changed +17
-12
lines changed Original file line number Diff line number Diff line change @@ -224,7 +224,6 @@ class PluginSpec : Spek({
224224 vintageVersion = " 1.2.3"
225225
226226 instrumentationTests {
227- enabled(true)
228227 version = " 4.8.15"
229228 }
230229 }
Original file line number Diff line number Diff line change @@ -164,7 +164,7 @@ class AndroidJUnitPlatformExtension extends JUnitPlatformExtension {
164164 static class InstrumentationTestOptions {
165165
166166 /* * Whether or not to enable support for JUnit 5 instrumentation tests. */
167- private boolean enabled = false
167+ private boolean enabled = true
168168
169169 /* * The version of the instrumentation companion library to use. */
170170 @Nullable String version
Original file line number Diff line number Diff line change @@ -85,9 +85,9 @@ class JUnit5DependencyHandler(
8585 if (! project.junit5.instrumentationTests.enabled) {
8686 @Suppress(" NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS" )
8787 throw ProjectConfigurationException ("""
88- The JUnit 5 Instrumentation Test library can only be used
89- if support for them is explicitly enabled as well .
90- Please add the following to your build.gradle:
88+ The JUnit 5 Instrumentation Test library can't be used
89+ if it is disabled via the plugin .
90+ Please revise the following in your build.gradle:
9191 android.testOptions {
9292 junitPlatform {
9393 instrumentationTests.enabled true
@@ -96,7 +96,9 @@ class JUnit5DependencyHandler(
9696 """ .trimIndent(), null )
9797 }
9898
99- return listOf (versions.others.instrumentationTest)
99+ return listOf (
100+ versions.others.instrumentationTest
101+ )
100102 }
101103
102104 /* Internal */
@@ -172,6 +174,7 @@ class Platform(
172174 val launcher = dependency(" junit-platform-launcher" )
173175 val console = dependency(" junit-platform-console" )
174176 val engine = dependency(" junit-platform-engine" )
177+ val runner = dependency(" junit-platform-runner" )
175178}
176179
177180/* *
Original file line number Diff line number Diff line change @@ -138,11 +138,14 @@ class AndroidJUnitPlatformPlugin : Plugin<Project> {
138138 " Change your declaration to '$actualRunnerBuilder ,$JUNIT5_RUNNER_BUILDER_CLASS_NAME '." )
139139 }
140140
141- // Attach runtime-only dependency on JUnit 5 instrumentation test facade
142- val defaults = loadProperties(VERSIONS_RESOURCE_NAME )
143- val rtOnly = configurations.findConfiguration(kind = ANDROID_TEST , scope = RUNTIME_ONLY )
144- withLoadedVersions(defaults) {
145- rtOnly.dependencies.add(it.others.instrumentationRunner)
141+ // Attach runtime-only dependency on JUnit 5 instrumentation test facade, unless disabled
142+ if (junit5.instrumentationTests.enabled) {
143+ val defaults = loadProperties(VERSIONS_RESOURCE_NAME )
144+ val rtOnly = configurations.findConfiguration(kind = ANDROID_TEST , scope = RUNTIME_ONLY )
145+ withLoadedVersions(defaults) {
146+ rtOnly.dependencies.add(it.others.instrumentationRunner)
147+ rtOnly.dependencies.add(it.platform.runner)
148+ }
146149 }
147150 }
148151
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ LICENSE_NAME = Apache-2.0
1212PLUGIN_GROUP_ID = de.mannodermaus.gradle.plugins
1313PLUGIN_ARTIFACT_ID = android-junit5
1414PLUGIN_DESCRIPTION = Unit Testing with JUnit 5 for Android.
15- PLUGIN_RUNTIME_VERSION_NAME = 1.0.31
15+ PLUGIN_RUNTIME_VERSION_NAME = 1.0.31-SNAPSHOT
1616PLUGIN_RUNTIME_VERSION_NAME_LATEST_STABLE = 1.0.30
1717
1818# Artifact configuration (embedded-runtime)
You can’t perform that action at this time.
0 commit comments