From 4526c5d1d4626cebcfea873c16f2b3a32cc5dd49 Mon Sep 17 00:00:00 2001 From: Tom Tresansky Date: Tue, 7 May 2024 08:22:56 -0400 Subject: [PATCH 1/3] Support blocks instead of flags for kotlin serialization in Android --- core/data/build.gradle.dcl | 6 +++++- gradle/libs.versions.toml | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/core/data/build.gradle.dcl b/core/data/build.gradle.dcl index c48650d44..59ef04f64 100644 --- a/core/data/build.gradle.dcl +++ b/core/data/build.gradle.dcl @@ -1,7 +1,6 @@ androidLibrary { namespace = "com.google.samples.apps.nowinandroid.core.data" - includeKotlinSerialization = true configureJacoco = true dependencies { @@ -19,6 +18,11 @@ androidLibrary { testImplementation(project(":core:network")) } + kotlinSerialization { + version = "1.6.3" + json() + } + testOptions { includeAndroidResources = true returnDefaultValues = true diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7b52b98e9..038f50f16 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -162,7 +162,7 @@ firebase-perf = { id = "com.google.firebase.firebase-perf", version.ref = "fireb gms = { id = "com.google.gms.google-services", version.ref = "gmsPlugin" } hilt = { id = "com.google.dagger.hilt.android" } kotlin-jvm = { id = "org.jetbrains.kotlin.jvm" } -kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } +kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization" } ksp = { id = "com.google.devtools.ksp" } module-graph = { id = "com.jraska.module.graph.assertion", version.ref = "moduleGraph" } protobuf = { id = "com.google.protobuf", version.ref = "protobufPlugin" } From d734dbc118af781ba1b70e6a04320ef4132a13f5 Mon Sep 17 00:00:00 2001 From: Tom Tresansky Date: Tue, 7 May 2024 08:57:02 -0400 Subject: [PATCH 2/3] Support blocks instead of flags for jacoco in Android --- core/data/build.gradle.dcl | 6 ++++-- core/domain/build.gradle.dcl | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/core/data/build.gradle.dcl b/core/data/build.gradle.dcl index 59ef04f64..be36b9632 100644 --- a/core/data/build.gradle.dcl +++ b/core/data/build.gradle.dcl @@ -1,8 +1,6 @@ androidLibrary { namespace = "com.google.samples.apps.nowinandroid.core.data" - configureJacoco = true - dependencies { api(project(":core:common")) api(project(":core:database")) @@ -23,6 +21,10 @@ androidLibrary { json() } + jacoco { + version = "0.8.7" + } + testOptions { includeAndroidResources = true returnDefaultValues = true diff --git a/core/domain/build.gradle.dcl b/core/domain/build.gradle.dcl index 4f3b430ad..7ef7e257f 100644 --- a/core/domain/build.gradle.dcl +++ b/core/domain/build.gradle.dcl @@ -1,8 +1,6 @@ androidLibrary { namespace = "com.google.samples.apps.nowinandroid.core.domain" - configureJacoco = true - dependencies { implementation("javax.inject:javax.inject:1") @@ -12,6 +10,10 @@ androidLibrary { testImplementation(project(":core:testing")) } + jacoco { + version = "0.8.7" + } + buildTypes { // Need the empty closure to avoid "dangling pure expression" error debug {} From e124115cb5725b6bc58ec3e2ad3d008023f5324f Mon Sep 17 00:00:00 2001 From: Tom Tresansky Date: Tue, 7 May 2024 10:18:28 -0400 Subject: [PATCH 3/3] Consolidate testing functionality in a testing block --- core/data/build.gradle.dcl | 20 +++++++++++--------- core/domain/build.gradle.dcl | 10 ++++++---- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/core/data/build.gradle.dcl b/core/data/build.gradle.dcl index be36b9632..3815ebff4 100644 --- a/core/data/build.gradle.dcl +++ b/core/data/build.gradle.dcl @@ -21,18 +21,20 @@ androidLibrary { json() } - jacoco { - version = "0.8.7" - } - - testOptions { - includeAndroidResources = true - returnDefaultValues = true - } - buildTypes { // Need the empty closure to avoid "dangling pure expression" error debug {} release {} } + + testing { + jacoco { + version = "0.8.7" + } + + testOptions { + includeAndroidResources = true + returnDefaultValues = true + } + } } diff --git a/core/domain/build.gradle.dcl b/core/domain/build.gradle.dcl index 7ef7e257f..785207dad 100644 --- a/core/domain/build.gradle.dcl +++ b/core/domain/build.gradle.dcl @@ -10,13 +10,15 @@ androidLibrary { testImplementation(project(":core:testing")) } - jacoco { - version = "0.8.7" - } - buildTypes { // Need the empty closure to avoid "dangling pure expression" error debug {} release {} } + + testing { + jacoco { + version = "0.8.7" + } + } }