Skip to content

Commit

Permalink
Gradle 6 & raise minimum AGP to 3.5.0 (#206)
Browse files Browse the repository at this point in the history
* Official Gradle Wrapper Validation Action

See: https://github.com/gradle/wrapper-validation-action

*
  • Loading branch information
mannodermaus authored Feb 27, 2020
1 parent e078b5b commit 8570df2
Show file tree
Hide file tree
Showing 36 changed files with 53 additions and 364 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/gradle-wrapper-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: "Validate Gradle Wrapper"
on: [push, pull_request]

jobs:
validation:
name: "Validation"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

![Logo](.images/logo.png)

A Gradle plugin that allows for the execution of [JUnit 5][junit5gh] tests in Android environments using **Android Gradle Plugin 3.2.0 or later.**
A Gradle plugin that allows for the execution of [JUnit 5][junit5gh] tests in Android environments using **Android Gradle Plugin 3.5.0 or later.**

## How?

Expand Down Expand Up @@ -56,15 +56,15 @@ Snapshots of the development version are available through [Sonatype's `snapshot
dependencies {
// (Required) Writing and executing Unit Tests on the JUnit Platform
testImplementation "org.junit.jupiter:junit-jupiter-api:5.5.2"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.5.2"
testImplementation "org.junit.jupiter:junit-jupiter-api:5.6.0"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.6.0"
// (Optional) If you need "Parameterized Tests"
testImplementation "org.junit.jupiter:junit-jupiter-params:5.5.2"
testImplementation "org.junit.jupiter:junit-jupiter-params:5.6.0"
// (Optional) If you also have JUnit 4-based tests
testImplementation "junit:junit:4.12"
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:5.5.2"
testImplementation "junit:junit:4.13"
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:5.6.0"
}
```
</details>
Expand All @@ -79,15 +79,15 @@ Snapshots of the development version are available through [Sonatype's `snapshot

dependencies {
// (Required) Writing and executing Unit Tests on the JUnit Platform
testImplementation("org.junit.jupiter:junit-jupiter-api:5.5.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.5.2")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.6.0")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.6.0")

// (Optional) If you need "Parameterized Tests"
testImplementation("org.junit.jupiter:junit-jupiter-params:5.5.2")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.6.0")

// (Optional) If you also have JUnit 4-based tests
testImplementation("junit:junit:4.12")
testRuntimeOnly("org.junit.vintage:junit-vintage-engine:5.5.2")
testImplementation("junit:junit:4.13")
testRuntimeOnly("org.junit.vintage:junit-vintage-engine:5.6.0")
}
```
</details>
Expand All @@ -99,8 +99,8 @@ More information on Getting Started can be found [on the wiki][wiki-gettingstart
## Requirements

The latest version of this plugin requires:
* Android Gradle Plugin `3.2.0` or above
* Gradle `4.7` or above
* Android Gradle Plugin `3.5.0` or above
* Gradle `6.1.1` or above

## Instrumentation Test Support

Expand Down Expand Up @@ -135,7 +135,7 @@ To start writing instrumentation tests with JUnit Jupiter, make the following ch
dependencies {
// 5) Jupiter API & Test Runner, if you don't have it already
androidTestImplementation "androidx.test:runner:1.2.0"
androidTestImplementation "org.junit.jupiter:junit-jupiter-api:5.5.2"
androidTestImplementation "org.junit.jupiter:junit-jupiter-api:5.6.0"
// 6) The instrumentation test companion libraries
androidTestImplementation "de.mannodermaus.junit5:android-test-core:1.2.0"
Expand Down Expand Up @@ -170,7 +170,7 @@ To start writing instrumentation tests with JUnit Jupiter, make the following ch
dependencies {
// 5) Jupiter API & Test Runner, if you don't have it already
androidTestImplementation("androidx.test:runner:1.2.0")
androidTestImplementation("org.junit.jupiter:junit-jupiter-api:5.5.2")
androidTestImplementation("org.junit.jupiter:junit-jupiter-api:5.6.0")
// 6) The instrumentation test companion libraries
androidTestImplementation("de.mannodermaus.junit5:android-test-core:1.2.0")
Expand Down Expand Up @@ -199,7 +199,7 @@ This repository contains multiple modules, divided into two sub-projects. The re
## License

```
Copyright 2017-2019 Marcel Schnelle
Copyright 2017-2020 Marcel Schnelle
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
6 changes: 3 additions & 3 deletions README.md.template
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

![Logo](.images/logo.png)

A Gradle plugin that allows for the execution of [JUnit 5][junit5gh] tests in Android environments using **Android Gradle Plugin 3.2.0 or later.**
A Gradle plugin that allows for the execution of [JUnit 5][junit5gh] tests in Android environments using **Android Gradle Plugin 3.5.0 or later.**

## How?

Expand Down Expand Up @@ -94,8 +94,8 @@ More information on Getting Started can be found [on the wiki][wiki-gettingstart
## Requirements

The latest version of this plugin requires:
* Android Gradle Plugin `3.2.0` or above
* Gradle `4.7` or above
* Android Gradle Plugin `3.5.0` or above
* Gradle `6.1.1` or above

## Instrumentation Test Support

Expand Down
6 changes: 0 additions & 6 deletions buildSrc/src/main/kotlin/Libs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ object Libs {
* https://developer.android.com/studio */
const val com_android_tools_build_gradle: String = "com.android.tools.build:gradle:" +
Versions.com_android_tools_build_gradle
const val com_android_tools_build_gradle_32x: String = "com.android.tools.build:gradle:" +
Versions.com_android_tools_build_gradle_32x
const val com_android_tools_build_gradle_33x: String = "com.android.tools.build:gradle:" +
Versions.com_android_tools_build_gradle_33x
const val com_android_tools_build_gradle_34x: String = "com.android.tools.build:gradle:" +
Versions.com_android_tools_build_gradle_34x
const val com_android_tools_build_gradle_35x: String = "com.android.tools.build:gradle:" +
Versions.com_android_tools_build_gradle_35x
const val com_android_tools_build_gradle_36x: String = "com.android.tools.build:gradle:" +
Expand Down
27 changes: 7 additions & 20 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,14 @@ object Versions {
const val androidx_test_monitor: String = "1.2.0"
const val androidx_test_runner: String = "1.2.0"

const val aapt2: String = "3.2.1-4818971"
const val aapt2: String = "3.5.0-5435860"

const val com_android_tools_build_gradle_32x: String = "3.2.1"
const val com_android_tools_build_gradle_33x: String = "3.3.2"
const val com_android_tools_build_gradle_34x: String = "3.4.2"
const val com_android_tools_build_gradle_35x: String = "3.5.1"
const val com_android_tools_build_gradle_36x: String = "3.6.0-beta01"
const val com_android_tools_build_gradle_40x: String = "4.0.0-alpha01"
const val com_android_tools_build_gradle: String = "3.4.2"
const val com_android_tools_build_gradle_35x: String = "3.5.0"
const val com_android_tools_build_gradle_36x: String = "3.6.0"
const val com_android_tools_build_gradle_40x: String = "4.0.0-beta01"
const val com_android_tools_build_gradle: String = com_android_tools_build_gradle_35x

const val lint_gradle: String = "26.2.1"
const val lint_gradle: String = "26.5.0"

const val stream: String = "1.2.1"

Expand Down Expand Up @@ -57,7 +54,7 @@ object Versions {

const val assertj_core: String = "3.11.1"

const val org_jetbrains_kotlin: String = "1.3.21"
const val org_jetbrains_kotlin: String = "1.3.61"

const val org_jetbrains_spek: String = "1.2.1"

Expand All @@ -75,14 +72,4 @@ object Versions {
const val mockito_core: String = "2.19.0"

const val mockito_kotlin: String = "2.1.0"

object Gradle {
const val runningVersion: String = "5.0"

const val currentVersion: String = "5.0"

const val nightlyVersion: String = "5.2-20181230000028+0000"

const val releaseCandidate: String = "5.1-rc-3"
}
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
3 changes: 2 additions & 1 deletion plugin/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ Change Log
## Unreleased

#### Added
- JUnit 5.6.0
- Compatibility with Android Gradle Plugin 4.x versions
- Compatibility with Gradle 6
- Compatibility with Gradle 6; also raised minimum supported version to Gradle 6.1.1
#### Changed
#### Fixed
#### Removed
Expand Down
7 changes: 1 addition & 6 deletions plugin/android-junit5/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,12 @@ tasks.named("processTestResources", Copy::class.java).configure {
"MIN_SDK_VERSION" to Android.sampleMinSdkVersion.toString(),
"TARGET_SDK_VERSION" to Android.targetSdkVersion.toString(),

"AGP_32X" to Versions.com_android_tools_build_gradle_32x,
"AGP_33X" to Versions.com_android_tools_build_gradle_33x,
"AGP_34X" to Versions.com_android_tools_build_gradle_34x,
"AGP_35X" to Versions.com_android_tools_build_gradle_35x,
"AGP_36X" to Versions.com_android_tools_build_gradle_36x,
"AGP_40X" to Versions.com_android_tools_build_gradle_40x,
"KOTLIN" to Versions.org_jetbrains_kotlin,

"KOTLIN_STD_LIB" to Libs.kotlin_stdlib,
"JUPITER_API" to Libs.junit_jupiter_api,
"JUPITER_ENGINE" to Libs.junit_jupiter_engine
)
Expand Down Expand Up @@ -112,9 +110,6 @@ data class AgpConfiguration(val version: String, val dependency: String) {
}

private val agpConfigurations = listOf(
AgpConfiguration("3.2", Libs.com_android_tools_build_gradle_32x),
AgpConfiguration("3.3", Libs.com_android_tools_build_gradle_33x),
AgpConfiguration("3.4", Libs.com_android_tools_build_gradle_34x),
AgpConfiguration("3.5", Libs.com_android_tools_build_gradle_35x),
AgpConfiguration("3.6", Libs.com_android_tools_build_gradle_36x),
AgpConfiguration("4.0", Libs.com_android_tools_build_gradle_40x)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package de.mannodermaus.gradle.plugins.junit5

const val MIN_REQUIRED_GRADLE_VERSION = "4.7"
const val MIN_REQUIRED_AGP_VERSION = "3.2.0"
const val MIN_REQUIRED_GRADLE_VERSION = "6.1.1"
const val MIN_REQUIRED_AGP_VERSION = "3.5.0"

const val EXTENSION_NAME = "junitPlatform"
const val FILTERS_EXTENSION_NAME = "filters"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,33 +44,6 @@ class FunctionalTests {
with(result) {
@Suppress("UNUSED_VARIABLE")
val u: Any = when (agpVersion) {
// ------------------------------------------------------------------------------------------------
// AGP 3.2
// - Build Types
// ------------------------------------------------------------------------------------------------
AgpVersion.AGP_32X -> {
assertAgpTests(buildType = "debug", tests = listOf("JavaTest"))
assertAgpTests(buildType = "release", tests = listOf("JavaTest", "KotlinReleaseTest"))
}
// ------------------------------------------------------------------------------------------------
// AGP 3.3
// - Simple
// ------------------------------------------------------------------------------------------------
AgpVersion.AGP_33X -> {
assertAgpTests(buildType = "debug", tests = listOf("JavaTest"))
assertAgpTests(buildType = "release", tests = listOf("JavaTest"))
}
// ------------------------------------------------------------------------------------------------
// AGP 3.4
// - Product Flavors
// - Build Types
// ------------------------------------------------------------------------------------------------
AgpVersion.AGP_34X -> {
assertAgpTests(buildType = "debug", productFlavor = "free", tests = listOf("JavaTest"))
assertAgpTests(buildType = "debug", productFlavor = "paid", tests = listOf("JavaTest", "KotlinPaidDebugTest"))
assertAgpTests(buildType = "release", productFlavor = "free", tests = listOf("JavaTest", "KotlinReleaseTest", "JavaFreeReleaseTest"))
assertAgpTests(buildType = "release", productFlavor = "paid", tests = listOf("JavaTest", "KotlinReleaseTest"))
}
// ------------------------------------------------------------------------------------------------
// AGP 3.5
// - Product Flavors
Expand Down Expand Up @@ -166,7 +139,7 @@ class FunctionalTests {
// Perform assertions
assertThat(this).output().ofTask(taskName).apply {
tests.forEach { expectedClass ->
contains("de.mannodermaus.app.$expectedClass > test() PASSED")
contains("$expectedClass > test() PASSED")
}
executedTestCount().isEqualTo(tests.size)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ class VersionCheckerSpec : Spek({
"3.2.0-alpha01" to false,
"3.2.0-alpha14" to false,
MIN_REQUIRED_AGP_VERSION to true,
"3.3.0" to true,
"3.4.0" to true,
"3.5.0-alpha13" to true,
"3.3.0" to true,
"3.3.0" to false,
"3.4.0" to false,
"3.5.0-alpha13" to false,
"3.3.0" to false,
"4.0.0-alpha01" to true
).forEach { (actual, expected) ->
on("checking against AGP $actual") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ package de.mannodermaus.gradle.plugins.junit5.util
enum class AgpVersion(val fileKey: String,
val requiresGradle: String? = null) {

AGP_32X("agp32x"),
AGP_33X("agp33x"),
AGP_34X("agp34x"),
AGP_35X("agp35x"),
AGP_36X("agp36x"),
AGP_40X("agp40x");
Expand All @@ -18,6 +15,6 @@ enum class AgpVersion(val fileKey: String,
.let { v -> "${v[0]}.${v[1]}" }

companion object {
fun latest() = AGP_34X
fun latest() = AGP_36X
}
}
36 changes: 0 additions & 36 deletions plugin/android-junit5/src/test/projects/agp32x/build.gradle

This file was deleted.

15 changes: 0 additions & 15 deletions plugin/android-junit5/src/test/projects/agp32x/settings.gradle

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 8570df2

Please sign in to comment.