Update Android Gradle Plugin to 7.0.0
This commit is contained in:
parent
ca2821ac28
commit
09787c71f5
|
@ -1,7 +1,7 @@
|
||||||
image: jangrewe/gitlab-ci-android
|
image: jangrewe/gitlab-ci-android
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
JACOCO_CSV_LOCATION: '$CI_PROJECT_DIR/app/build/reports/jacoco/testDebugUnitTestCoverage/testDebugUnitTestCoverage.csv'
|
JACOCO_CSV_LOCATION: '$CI_PROJECT_DIR/app/build/reports/jacoco/debug/jacoco.csv'
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- test
|
- test
|
||||||
|
@ -33,20 +33,20 @@ test:
|
||||||
extends: .gradle-default
|
extends: .gradle-default
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- ./gradlew test testDebugUnitTestCoverage
|
- ./gradlew test jacocoTestReportDebug
|
||||||
- awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, " instructions covered"; print 100*covered/instructions, "% covered" }' $JACOCO_CSV_LOCATION
|
- awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, " instructions covered"; print 100*covered/instructions, "% covered" }' $JACOCO_CSV_LOCATION
|
||||||
artifacts:
|
artifacts:
|
||||||
reports:
|
reports:
|
||||||
junit: app/build/test-results/test**/TEST-*.xml
|
junit: app/build/test-results/test**/TEST-*.xml
|
||||||
paths:
|
paths:
|
||||||
- app/build/reports/jacoco/testDebugUnitTestCoverage/testDebugUnitTestCoverage.xml
|
- app/build/reports/jacoco/debug/jacoco.xml
|
||||||
|
|
||||||
coverage:
|
coverage:
|
||||||
stage: visualize
|
stage: visualize
|
||||||
image: gjrtimmer/jacoco2cobertura:1.0.8
|
image: gjrtimmer/jacoco2cobertura:1.0.8
|
||||||
script:
|
script:
|
||||||
# convert report from jacoco to cobertura, use relative project path
|
# convert report from jacoco to cobertura, use relative project path
|
||||||
- 'python /opt/cover2cover.py app/build/reports/jacoco/testDebugUnitTestCoverage/testDebugUnitTestCoverage.xml $CI_PROJECT_DIR/app/src/main/java > app/build/reports/cobertura.xml'
|
- 'python /opt/cover2cover.py app/build/reports/jacoco/debug/jacoco.xml $CI_PROJECT_DIR/app/src/main/java > app/build/reports/cobertura.xml'
|
||||||
needs: [ "test" ]
|
needs: [ "test" ]
|
||||||
dependencies:
|
dependencies:
|
||||||
- test
|
- test
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
# Enable auto-env through the sdkman_auto_env config
|
# Enable auto-env through the sdkman_auto_env config
|
||||||
# Add key=value pairs of SDKs to use below
|
# Add key=value pairs of SDKs to use below
|
||||||
java=8.0.292.hs-adpt
|
java=11.0.11.hs-adpt
|
||||||
|
|
|
@ -11,6 +11,11 @@ plugins {
|
||||||
id("com.github.triplet.play") version "2.4.2"
|
id("com.github.triplet.play") version "2.4.2"
|
||||||
id("de.mobilej.unmock")
|
id("de.mobilej.unmock")
|
||||||
jacoco
|
jacoco
|
||||||
|
id("com.vanniktech.android.junit.jacoco")
|
||||||
|
}
|
||||||
|
|
||||||
|
junitJacoco {
|
||||||
|
jacocoVersion = Versions.jacoco
|
||||||
}
|
}
|
||||||
|
|
||||||
val props = Properties().apply {
|
val props = Properties().apply {
|
||||||
|
@ -22,12 +27,6 @@ val props = Properties().apply {
|
||||||
|
|
||||||
unMock {
|
unMock {
|
||||||
keep = listOf("android.net.Uri")
|
keep = listOf("android.net.Uri")
|
||||||
//keepStartingWith("org.")
|
|
||||||
//keepStartingWith("libcore.")
|
|
||||||
}
|
|
||||||
|
|
||||||
jacoco {
|
|
||||||
toolVersion = "0.8.7"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
androidGitVersion {
|
androidGitVersion {
|
||||||
|
@ -88,7 +87,12 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
testOptions {
|
testOptions {
|
||||||
unitTests.isReturnDefaultValues = true
|
execution = "ANDROID_TEST_ORCHESTRATOR"
|
||||||
|
animationsDisabled = true
|
||||||
|
unitTests {
|
||||||
|
isReturnDefaultValues = true
|
||||||
|
isIncludeAndroidResources = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
@ -100,8 +104,6 @@ android {
|
||||||
signingConfig = signingConfigs.getByName("debug")
|
signingConfig = signingConfigs.getByName("debug")
|
||||||
}
|
}
|
||||||
|
|
||||||
isTestCoverageEnabled = true
|
|
||||||
|
|
||||||
resValue("string", "debug.hostname", props.getProperty("debug.hostname", ""))
|
resValue("string", "debug.hostname", props.getProperty("debug.hostname", ""))
|
||||||
resValue("string", "debug.username", props.getProperty("debug.username", ""))
|
resValue("string", "debug.username", props.getProperty("debug.username", ""))
|
||||||
resValue("string", "debug.password", props.getProperty("debug.password", ""))
|
resValue("string", "debug.password", props.getProperty("debug.password", ""))
|
||||||
|
@ -146,11 +148,11 @@ play {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar", "*.aar"))))
|
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar", "*.aar"))))
|
||||||
|
|
||||||
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.5.21")
|
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:${Versions.kotlin}")
|
||||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1")
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1")
|
||||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.1")
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.1")
|
||||||
|
|
||||||
implementation("androidx.appcompat:appcompat:1.3.0")
|
implementation("androidx.appcompat:appcompat:1.3.1")
|
||||||
implementation("androidx.core:core-ktx:1.6.0")
|
implementation("androidx.core:core-ktx:1.6.0")
|
||||||
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.4.0-alpha02")
|
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.4.0-alpha02")
|
||||||
implementation("androidx.coordinatorlayout:coordinatorlayout:1.1.0")
|
implementation("androidx.coordinatorlayout:coordinatorlayout:1.1.0")
|
||||||
|
@ -160,78 +162,39 @@ dependencies {
|
||||||
implementation("com.google.android.material:material:1.4.0")
|
implementation("com.google.android.material:material:1.4.0")
|
||||||
implementation("com.android.support.constraint:constraint-layout:2.0.4")
|
implementation("com.android.support.constraint:constraint-layout:2.0.4")
|
||||||
|
|
||||||
implementation("com.google.android.exoplayer:exoplayer-core:2.11.8")
|
implementation("com.google.android.exoplayer:exoplayer-core:${Versions.exoPlayer}")
|
||||||
implementation("com.google.android.exoplayer:exoplayer-ui:2.11.8")
|
implementation("com.google.android.exoplayer:exoplayer-ui:${Versions.exoPlayer}")
|
||||||
implementation("com.google.android.exoplayer:extension-mediasession:2.11.8")
|
implementation("com.google.android.exoplayer:extension-mediasession:${Versions.exoPlayer}")
|
||||||
implementation("com.github.PaulWoitaschek.ExoPlayer-Extensions:extension-opus:2.11.4") {
|
implementation("com.github.PaulWoitaschek.ExoPlayer-Extensions:extension-opus:${Versions.exoPlayerExtensions}") {
|
||||||
isTransitive = false
|
isTransitive = false
|
||||||
}
|
}
|
||||||
implementation("com.github.PaulWoitaschek.ExoPlayer-Extensions:extension-flac:2.11.4") {
|
implementation("com.github.PaulWoitaschek.ExoPlayer-Extensions:extension-flac:${Versions.exoPlayerExtensions}") {
|
||||||
isTransitive = false
|
isTransitive = false
|
||||||
}
|
}
|
||||||
|
|
||||||
implementation("com.aliassadi:power-preference-lib:2.0.0")
|
implementation("com.aliassadi:power-preference-lib:${Versions.powerPreference}")
|
||||||
implementation("com.github.kittinunf.fuel:fuel:2.3.1")
|
implementation("com.github.kittinunf.fuel:fuel:${Versions.fuel}")
|
||||||
implementation("com.github.kittinunf.fuel:fuel-coroutines:2.3.1")
|
implementation("com.github.kittinunf.fuel:fuel-coroutines:${Versions.fuel}")
|
||||||
implementation("com.github.kittinunf.fuel:fuel-android:2.3.1")
|
implementation("com.github.kittinunf.fuel:fuel-android:${Versions.fuel}")
|
||||||
implementation("com.github.kittinunf.fuel:fuel-gson:2.3.1")
|
implementation("com.github.kittinunf.fuel:fuel-gson:${Versions.fuel}")
|
||||||
implementation("com.google.code.gson:gson:2.8.7")
|
implementation("com.google.code.gson:gson:${Versions.gson}")
|
||||||
implementation("com.squareup.picasso:picasso:2.71828")
|
implementation("com.squareup.picasso:picasso:2.71828")
|
||||||
implementation("jp.wasabeef:picasso-transformations:2.4.0")
|
implementation("jp.wasabeef:picasso-transformations:2.4.0")
|
||||||
implementation("net.openid:appauth:0.9.1")
|
implementation("net.openid:appauth:${Versions.openIdAppAuth}")
|
||||||
testImplementation("junit:junit:4.13.2")
|
testImplementation("junit:junit:4.13.2")
|
||||||
testImplementation("io.mockk:mockk:1.12.0")
|
testImplementation("io.mockk:mockk:1.12.0")
|
||||||
androidTestImplementation("io.mockk:mockk-android:1.12.0")
|
androidTestImplementation("io.mockk:mockk-android:${Versions.mockk}")
|
||||||
testImplementation("androidx.test:core:1.4.0")
|
testImplementation("androidx.test:core:1.4.0")
|
||||||
testImplementation("io.strikt:strikt-core:0.31.0")
|
testImplementation("io.strikt:strikt-core:${Versions.strikt}")
|
||||||
}
|
}
|
||||||
|
|
||||||
project.afterEvaluate {
|
project.afterEvaluate {
|
||||||
android.applicationVariants.forEach { variant ->
|
|
||||||
val testTaskName = "test${variant.name.capitalize()}UnitTest"
|
|
||||||
tasks.create<JacocoReport>(name = "${testTaskName}Coverage") {
|
|
||||||
|
|
||||||
dependsOn(testTaskName)
|
tasks.withType<JacocoReport> {
|
||||||
|
reports {
|
||||||
group = "Reporting"
|
xml.required.set(true)
|
||||||
description = "Generate Jacoco coverage reports after running tests."
|
csv.required.set(true)
|
||||||
|
html.required.set(true)
|
||||||
reports {
|
|
||||||
xml.required.set(true)
|
|
||||||
csv.required.set(true)
|
|
||||||
html.required.set(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
val excludes = listOf(
|
|
||||||
"**/R.class",
|
|
||||||
"**/R$*.class",
|
|
||||||
"**/BuildConfig.*",
|
|
||||||
"**/Manifest*.*",
|
|
||||||
"**/*Test*.*",
|
|
||||||
"android/**/*.*"
|
|
||||||
)
|
|
||||||
|
|
||||||
val javaClasses =
|
|
||||||
fileTree(baseDir = variant.javaCompileProvider.get().destinationDirectory).matching {
|
|
||||||
setExcludes(excludes)
|
|
||||||
}
|
|
||||||
val kotlinClasses =
|
|
||||||
fileTree(baseDir = "$buildDir/tmp/kotlin-classes/${variant.name}").matching {
|
|
||||||
setExcludes(excludes)
|
|
||||||
}
|
|
||||||
classDirectories.setFrom(files(listOf(javaClasses, kotlinClasses)))
|
|
||||||
|
|
||||||
val sourceDirectories = files(
|
|
||||||
listOf(
|
|
||||||
"$project.projectDir/src/main/java",
|
|
||||||
"$project.projectDir/src/${variant.name}/java",
|
|
||||||
"$project.projectDir/src/main/kotlin",
|
|
||||||
"$project.projectDir/src/${variant.name}/kotlin"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
sourceDirectories.setFrom(files(sourceDirectories))
|
|
||||||
executionData.setFrom(files("${project.buildDir}/jacoco/$testTaskName.exec"))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -252,5 +252,3 @@ class DefaultOAuth(private val authorizationServiceFactory: AuthorizationService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ class OAuthDatasourceTest {
|
||||||
private var dataSpec: DataSpec = DataSpec(Uri.EMPTY)
|
private var dataSpec: DataSpec = DataSpec(Uri.EMPTY)
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setup(){
|
fun setup() {
|
||||||
MockKAnnotations.init(this, relaxUnitFun = true)
|
MockKAnnotations.init(this, relaxUnitFun = true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,6 @@ import strikt.assertions.isNotNull
|
||||||
import strikt.assertions.isNull
|
import strikt.assertions.isNull
|
||||||
import strikt.assertions.isTrue
|
import strikt.assertions.isTrue
|
||||||
|
|
||||||
|
|
||||||
class DefaultOAuthTest {
|
class DefaultOAuthTest {
|
||||||
|
|
||||||
@InjectMockKs
|
@InjectMockKs
|
||||||
|
@ -293,6 +292,4 @@ class DefaultOAuthTest {
|
||||||
object : TypeToken<T>() {}.type
|
object : TypeToken<T>() {}.type
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
buildscript {
|
buildscript {
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
@ -6,13 +7,15 @@ buildscript {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath("com.android.tools.build:gradle:4.2.2")
|
classpath("com.android.tools.build:gradle:${Versions.androidGradlePlugin}")
|
||||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21")
|
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}")
|
||||||
classpath("com.github.bjoernq:unmockplugin:0.7.8")
|
classpath("com.github.bjoernq:unmockplugin:${Versions.unmock}")
|
||||||
|
classpath("com.vanniktech:gradle-android-junit-jacoco-plugin:${Versions.gradleAndroidJUnitJacocoPlugin}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
maven(url = "https://jitpack.io")
|
maven(url = "https://jitpack.io")
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
build/
|
|
@ -0,0 +1,7 @@
|
||||||
|
plugins {
|
||||||
|
`kotlin-dsl`
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
object Versions {
|
||||||
|
const val kotlin = "1.5.21"
|
||||||
|
const val jacoco = "0.8.7"
|
||||||
|
const val unmock = "0.7.8"
|
||||||
|
const val androidGradlePlugin = "7.0.0"
|
||||||
|
const val gradleAndroidJUnitJacocoPlugin = "0.16.0"
|
||||||
|
|
||||||
|
const val exoPlayer = "2.11.8"
|
||||||
|
const val exoPlayerExtensions = "2.11.4"
|
||||||
|
const val fuel = "2.3.1"
|
||||||
|
const val gson = "2.8.7"
|
||||||
|
const val powerPreference = "2.0.0"
|
||||||
|
const val openIdAppAuth = "0.9.1"
|
||||||
|
|
||||||
|
const val mockk = "1.12.0"
|
||||||
|
const val strikt = "0.31.0"
|
||||||
|
}
|
Loading…
Reference in New Issue