@@ -92,22 +92,11 @@ android {
9292 {% endif %}
9393
9494 // Gradle 6.5 fixed the syntax for UnitTestOptions' DSL
95- {% if atLeastGradle("6.5") %}
96- unitTests.all { test ->
97- test.testLogging {
98- events(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED)
99- }
95+ unitTests.all { test ->
96+ test.testLogging {
97+ events(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED)
10098 }
101- {% else %}
102- // Lower versions of Gradle require more ceremony for UnitTestOptions
103- unitTests.all(KotlinClosure1<Any, Test>({
104- (this as Test).also {
105- testLogging {
106- events(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED)
107- }
108- }
109- }, unitTests))
110- {% endif %}
99+ }
111100 }
112101}
113102
@@ -118,28 +107,11 @@ android {
118107{% endif %}
119108
120109{% for type in DISABLE_TESTS_FOR_BUILD_TYPES %}
121- {% if atLeastAgp("7.0.0-beta01") %}
122- // New Variant API for AGP 7.0 and above (unit test stuff is accessed through ordinary variants now)
123- androidComponents {
124- beforeVariants(selector().withBuildType("{{ type }}")) { variant ->
125- variant.enableUnitTest = false
126- }
127- }
128- {% elseif atLeastAgp("4.2.0-beta01") %}
129- // New Variant API for AGP 4.2 and above
130- androidComponents {
131- beforeUnitTests(selector().withBuildType("{{ type }}")) { test ->
132- test.enabled = false
133- }
110+ androidComponents {
111+ beforeVariants(selector().withBuildType("{{ type }}")) { variant ->
112+ variant.enableUnitTest = false
134113 }
135- {% elseif atLeastAgp("4.1") %}
136- // Variant API for AGP 4.1
137- android.onVariants.withBuildType("{{ type }}") {
138- unitTest {
139- enabled = false
140- }
141- }
142- {% endif %}
114+ }
143115{% end %}
144116
145117dependencies {
0 commit comments