diff --git a/.cicdtemplate/.bitrise/bitrise.yml b/.cicdtemplate/.bitrise/bitrise.yml index abe2dee35..dcc6e06d4 100644 --- a/.cicdtemplate/.bitrise/bitrise.yml +++ b/.cicdtemplate/.bitrise/bitrise.yml @@ -49,7 +49,7 @@ workflows: # Execute UnitTest - android-unit-test@1: inputs: - - arguments: koverMergedHtmlReport + - arguments: koverHtmlReport - variant: "$VARIANT" - module: "$MODULE" - report_path_pattern: '*build/reports' @@ -61,7 +61,7 @@ workflows: # Upload Kover report to Apps & Artifacts for later downloading - deploy-to-bitrise-io@1: inputs: - - deploy_path: "$PROJECT_LOCATION/build/reports/kover/merged/html/index.html" + - deploy_path: "$PROJECT_LOCATION/app/build/reports/kover/html/index.html" - is_enable_public_page: 'false' - is_compress: 'true' - notify_user_groups: none diff --git a/.cicdtemplate/.codemagic/codemagic.yaml b/.cicdtemplate/.codemagic/codemagic.yaml index 97392cd19..1c26cbdb0 100644 --- a/.cicdtemplate/.codemagic/codemagic.yaml +++ b/.cicdtemplate/.codemagic/codemagic.yaml @@ -10,21 +10,14 @@ definitions: cache_paths: - $HOME/.gradle/caches scripts: - - &set_up_google_services_files_from_environment_variables - name: Set up google-services.json files - script: | - mkdir -p app/src/production - echo $GOOGLE_SERVICES_JSON > app/src/production/google-services.json - mkdir -p app/src/staging - echo $GOOGLE_SERVICES_JSON_STAGING > app/src/staging/google-services.json - &detekt name: Run detekt script: ./gradlew detekt - &unit_test name: Run unit tests - script: ./gradlew koverMergedReport + script: ./gradlew koverHtmlReport artifacts: - - &artifacts_test_report build/reports/kover/merged/ + - &artifacts_test_report app/build/reports/kover/ - &artifacts_staging_apk app/build/outputs/apk/staging/debug/app-staging-debug.apk - &artifacts_production_apk app/build/outputs/apk/production/debug/app-production-debug.apk workflows: @@ -47,7 +40,6 @@ workflows: include: false cancel_previous_builds: true scripts: - - *set_up_google_services_files_from_environment_variables - *detekt - *unit_test artifacts: @@ -62,7 +54,6 @@ workflows: branch_patterns: - pattern: develop scripts: - - *set_up_google_services_files_from_environment_variables - *detekt - *unit_test - name: Build APK for staging @@ -89,7 +80,6 @@ workflows: branch_patterns: - pattern: main scripts: - - *set_up_google_services_files_from_environment_variables - *detekt - *unit_test - name: Build APK for production diff --git a/.cicdtemplate/.github/workflows/deploy_staging_and_production_to_firebase_app_distribution.yml b/.cicdtemplate/.github/workflows/deploy_staging_and_production_to_firebase_app_distribution.yml index e9f176882..baaffefe9 100644 --- a/.cicdtemplate/.github/workflows/deploy_staging_and_production_to_firebase_app_distribution.yml +++ b/.cicdtemplate/.github/workflows/deploy_staging_and_production_to_firebase_app_distribution.yml @@ -38,16 +38,6 @@ jobs: restore-keys: | ${{ runner.os }}-gradle- - - name: Set up google-services.json files - env: - GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }} - GOOGLE_SERVICES_JSON_STAGING: ${{ secrets.GOOGLE_SERVICES_JSON_STAGING }} - run: | - mkdir -p app/src/production - echo $GOOGLE_SERVICES_JSON > app/src/production/google-services.json - mkdir -p app/src/staging - echo $GOOGLE_SERVICES_JSON_STAGING > app/src/staging/google-services.json - - name: Run Detekt run: ./gradlew detekt @@ -58,13 +48,13 @@ jobs: path: build/reports/detekt/ - name: Run unit tests with Kover - run: ./gradlew koverMergedHtmlReport + run: ./gradlew koverHtmlReport - name: Archive code coverage reports uses: actions/upload-artifact@v2 with: name: CodeCoverageReports - path: build/reports/kover/merged/ + path: app/build/reports/kover/ - name: Build staging APK run: ./gradlew assembleStagingDebug diff --git a/.cicdtemplate/.github/workflows/review_pull_request.yml b/.cicdtemplate/.github/workflows/review_pull_request.yml index b68386562..f55242a58 100644 --- a/.cicdtemplate/.github/workflows/review_pull_request.yml +++ b/.cicdtemplate/.github/workflows/review_pull_request.yml @@ -30,16 +30,6 @@ jobs: restore-keys: | ${{ runner.os }}-gradle- - - name: Set up google-services.json - env: - GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }} - GOOGLE_SERVICES_JSON_STAGING: ${{ secrets.GOOGLE_SERVICES_JSON_STAGING }} - run: | - mkdir -p app/src/production - echo $GOOGLE_SERVICES_JSON > app/src/production/google-services.json - mkdir -p app/src/staging - echo $GOOGLE_SERVICES_JSON_STAGING > app/src/staging/google-services.json - - name: Run Detekt run: ./gradlew detekt @@ -47,7 +37,7 @@ jobs: run: ./gradlew lint - name: Run unit tests with Kover - run: ./gradlew koverMergedXmlReport + run: ./gradlew koverXmlReport - name: Set up Ruby uses: ruby/setup-ruby@v1 diff --git a/.cicdtemplate/.github/workflows/run_detekt_and_unit_tests.yml b/.cicdtemplate/.github/workflows/run_detekt_and_unit_tests.yml index 2fabaf2d8..7ebf8ec9a 100644 --- a/.cicdtemplate/.github/workflows/run_detekt_and_unit_tests.yml +++ b/.cicdtemplate/.github/workflows/run_detekt_and_unit_tests.yml @@ -41,13 +41,6 @@ jobs: restore-keys: | ${{ runner.os }}-gradle- - - name: Set up google-services.json - env: - GOOGLE_SERVICES_JSON_STAGING: ${{ secrets.GOOGLE_SERVICES_JSON_STAGING }} - run: | - mkdir -p app/src/staging - echo $GOOGLE_SERVICES_JSON_STAGING > app/src/staging/google-services.json - - name: Run Detekt run: ./gradlew detekt @@ -58,11 +51,11 @@ jobs: path: build/reports/detekt/ - name: Run unit tests with Kover - run: ./gradlew koverMergedHtmlReport + run: ./gradlew koverHtmlReport - name: Archive code coverage reports uses: actions/upload-artifact@v2 if: always() with: name: CodeCoverageReports - path: build/reports/kover/merged/ + path: app/build/reports/kover/ diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index e97232787..393c6dcba 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,6 +1,6 @@ # Team # @ryan-conway is the Team Lead and the others are team members -* @AVI5HEK @chornerman @doannimble @hoangnguyen92dn @kaungkhantsoe @luongvo @lydiasama @manh-t @minhnimble @ryan-conway @sleepylee @thiennguyen0196 @Tuubz @Wadeewee +* @AVI5HEK @chornerman @doannimble @hoangnguyen92dn @kaungkhantsoe @luongvo @lydiasama @manh-t @minhnimble @ryan-conway @sleepylee @thiennguyen0196 @toby-thanathip @Wadeewee # Engineering Leads CODEOWNERS @nimblehq/engineering-leads diff --git a/.github/workflows/review_pull_request.yml b/.github/workflows/review_pull_request.yml index 1b5f61fe3..7e195f546 100644 --- a/.github/workflows/review_pull_request.yml +++ b/.github/workflows/review_pull_request.yml @@ -43,20 +43,10 @@ jobs: - name: Run unit tests with Kover on template-xml working-directory: ./template-xml - run: ./gradlew koverMergedXmlReport + run: ./gradlew koverXmlReport # template-compose - - name: Set up google-services.json on template-compose - env: - GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }} - GOOGLE_SERVICES_JSON_STAGING: ${{ secrets.GOOGLE_SERVICES_JSON_STAGING }} - run: | - mkdir -p template-compose/app/src/production - echo $GOOGLE_SERVICES_JSON > template-compose/app/src/production/google-services.json - mkdir -p template-compose/app/src/staging - echo $GOOGLE_SERVICES_JSON_STAGING > template-compose/app/src/staging/google-services.json - - name: Run Detekt on template-compose working-directory: ./template-compose run: ./gradlew detekt @@ -67,7 +57,7 @@ jobs: - name: Run unit tests with Kover on template-compose working-directory: ./template-compose - run: ./gradlew koverMergedXmlReport + run: ./gradlew koverXmlReport - name: Set up Ruby uses: ruby/setup-ruby@v1 diff --git a/.github/workflows/run_detekt_and_unit_tests.yml b/.github/workflows/run_detekt_and_unit_tests.yml index bc483489f..29be22547 100644 --- a/.github/workflows/run_detekt_and_unit_tests.yml +++ b/.github/workflows/run_detekt_and_unit_tests.yml @@ -7,7 +7,6 @@ jobs: name: Run Detekt and unit tests runs-on: ubuntu-latest timeout-minutes: 30 - environment: template-compose steps: - name: Set up JDK 11 uses: actions/setup-java@v2 @@ -43,23 +42,16 @@ jobs: - name: Run unit tests with Kover on template-xml working-directory: ./template-xml - run: ./gradlew koverMergedHtmlReport + run: ./gradlew koverHtmlReport - name: Archive code coverage reports on template-xml uses: actions/upload-artifact@v2 with: name: CodeCoverageReportsTemplateXML - path: template-xml/build/reports/kover/merged/ + path: template-xml/app/build/reports/kover/ # template-compose - - name: Set up google-services.json on template-compose - env: - GOOGLE_SERVICES_JSON_STAGING: ${{ secrets.GOOGLE_SERVICES_JSON_STAGING }} - run: | - mkdir -p template-compose/app/src/staging - echo $GOOGLE_SERVICES_JSON_STAGING > template-compose/app/src/staging/google-services.json - - name: Run Detekt on template-compose working-directory: ./template-compose run: ./gradlew detekt @@ -72,13 +64,13 @@ jobs: - name: Run unit tests with Kover on template-compose working-directory: ./template-compose - run: ./gradlew koverMergedHtmlReport + run: ./gradlew koverHtmlReport - name: Archive code coverage reports on template-compose uses: actions/upload-artifact@v2 with: name: CodeCoverageReportsTemplateCompose - path: template-compose/build/reports/kover/merged/ + path: template-compose/app/build/reports/kover/ # sample-xml @@ -94,13 +86,13 @@ jobs: - name: Run unit tests with Kover on sample-xml working-directory: ./sample-xml - run: ./gradlew koverMergedHtmlReport + run: ./gradlew koverHtmlReport - name: Archive code coverage reports on sample-xml uses: actions/upload-artifact@v2 with: name: CodeCoverageReportsTemplateXML - path: sample-xml/build/reports/kover/merged/ + path: sample-xml/app/build/reports/kover/ # sample-compose @@ -116,10 +108,10 @@ jobs: - name: Run unit tests with Kover on sample-compose working-directory: ./sample-compose - run: ./gradlew koverMergedHtmlReport + run: ./gradlew koverHtmlReport - name: Archive code coverage reports on sample-compose uses: actions/upload-artifact@v2 with: name: CodeCoverageReportsTemplateCompose - path: sample-compose/build/reports/kover/merged/ + path: sample-compose/app/build/reports/kover/ diff --git a/Dangerfile b/Dangerfile index 7155421e9..e6b53b1fb 100644 --- a/Dangerfile +++ b/Dangerfile @@ -31,11 +31,11 @@ end # Show Danger test coverage report from Kover for templates # Report coverage of modified files, warn if total project coverage is under 80% -# or if any modified file's coverage is under 90% -kover_file_template_xml = "template-xml/build/reports/kover/merged/xml/report.xml" +# or if any modified file's coverage is under 95% +kover_file_template_xml = "template-xml/app/build/reports/kover/report.xml" markdown "## Kover report for template-xml:" shroud.reportKover "Template - XML Unit Tests", kover_file_template_xml, 80, 95, false -kover_file_template_compose = "template-compose/build/reports/kover/merged/xml/report.xml" +kover_file_template_compose = "template-compose/app/build/reports/kover/report.xml" markdown "## Kover report for template-compose:" shroud.reportKover "Template - Compose Unit Tests", kover_file_template_compose, 80, 95, false diff --git a/codemagic.yaml b/codemagic.yaml index 845d9e33d..84330d0a7 100644 --- a/codemagic.yaml +++ b/codemagic.yaml @@ -10,13 +10,6 @@ definitions: cache_paths: - $HOME/.gradle/caches scripts: - - &set_up_google_services_files_from_environment_variables - name: Set up google-services.json on template-compose - script: | - mkdir -p template-compose/app/src/production - echo $GOOGLE_SERVICES_JSON > template-compose/app/src/production/google-services.json - mkdir -p template-compose/app/src/staging - echo $GOOGLE_SERVICES_JSON_STAGING > template-compose/app/src/staging/google-services.json - &detekt_on_template_compose name: Run detekt on template-compose working_directory: ./template-compose @@ -28,14 +21,14 @@ definitions: - &unit_test_on_template_compose name: Run unit tests on template-compose working_directory: ./template-compose - script: ./gradlew koverMergedReport + script: ./gradlew koverHtmlReport - &unit_test_on_template_xml name: Run unit tests on template-xml working_directory: ./template-xml - script: ./gradlew koverMergedReport + script: ./gradlew koverHtmlReport artifacts: - - &artifacts_template_compose template-compose/build/reports/kover/merged/ - - &artifacts_template_xml template-xml/build/reports/kover/merged/ + - &artifacts_template_compose template-compose/app/build/reports/kover/ + - &artifacts_template_xml template-xml/app/build/reports/kover/ - &artifacts_staging_apk template-compose/app/build/outputs/apk/staging/debug/app-staging-debug.apk - &artifacts_production_apk template-compose/app/build/outputs/apk/production/debug/app-production-debug.apk workflows: @@ -58,7 +51,6 @@ workflows: include: false cancel_previous_builds: true scripts: - - *set_up_google_services_files_from_environment_variables - *detekt_on_template_compose - *unit_test_on_template_compose artifacts: @@ -97,7 +89,6 @@ workflows: branch_patterns: - pattern: develop scripts: - - *set_up_google_services_files_from_environment_variables - *detekt_on_template_compose - *unit_test_on_template_compose - name: Build APK for staging @@ -125,7 +116,6 @@ workflows: branch_patterns: - pattern: main scripts: - - *set_up_google_services_files_from_environment_variables - *detekt_on_template_compose - *unit_test_on_template_compose - name: Build APK for production diff --git a/sample-compose/README.md b/sample-compose/README.md index c7be0bf87..d18b049fd 100644 --- a/sample-compose/README.md +++ b/sample-compose/README.md @@ -38,10 +38,10 @@ $ ./gradlew domain:test - Run unit testing with coverage: ``` -$ ./gradlew koverMergedHtmlReport +$ ./gradlew koverHtmlReport ``` -Report is located at: `./build/reports/kover/merged/` +Report is located at: `app/build/reports/kover/` ## Build and deploy diff --git a/sample-compose/app/build.gradle.kts b/sample-compose/app/build.gradle.kts index e9935e0d9..1ddb5fd9e 100644 --- a/sample-compose/app/build.gradle.kts +++ b/sample-compose/app/build.gradle.kts @@ -7,7 +7,7 @@ plugins { id("dagger.hilt.android.plugin") - id("kover") + id("org.jetbrains.kotlinx.kover") } val keystoreProperties = rootDir.loadGradleProperties("signing.properties") @@ -106,13 +106,6 @@ android { // Robolectric resource processing/loading https://github.com/robolectric/robolectric/pull/4736 isIncludeAndroidResources = true } - unitTests.all { - if (it.name != "testStagingDebugUnitTest") { - it.extensions.configure(kotlinx.kover.api.KoverTaskExtension::class) { - isDisabled.set(true) - } - } - } // Disable device's animation for instrument testing // animationsDisabled = true } @@ -177,3 +170,44 @@ dependencies { androidTestImplementation("androidx.test:rules:${Versions.TEST_RULES_VERSION}") androidTestImplementation("io.mockk:mockk-android:${Versions.TEST_MOCKK_VERSION}") } + +/* + * Kover configs + */ +dependencies { + kover(project(":data")) + kover(project(":domain")) +} + +koverReport { + defaults { + mergeWith("stagingDebug") + filters { + val excludedFiles = listOf( + "*.BuildConfig.*", + "*.BuildConfig", + // Enum + "*.*\$Creator*", + // DI + "*.di.*", + // Hilt + "*.*_ComponentTreeDeps*", + "*.*_HiltComponents*", + "*.*_HiltModules*", + "*.*_MembersInjector*", + "*.*_Factory*", + "*.Hilt_*", + "dagger.hilt.internal.*", + "hilt_aggregated_deps.*", + // Jetpack Compose + "*.ComposableSingletons*", + "*.*\$*Preview\$*", + "*.ui.preview.*", + ) + + excludes { + classes(excludedFiles) + } + } + } +} diff --git a/sample-compose/build.gradle.kts b/sample-compose/build.gradle.kts index 7a63ad82a..948b8878c 100644 --- a/sample-compose/build.gradle.kts +++ b/sample-compose/build.gradle.kts @@ -63,35 +63,3 @@ detekt { ignoredFlavors = listOf("production") } - -koverMerged { - enable() - - val excludedFiles = listOf( - "*.BuildConfig.*", - "*.BuildConfig", - // Enum - "*.*\$Creator*", - // DI - "*.di.*", - // Hilt - "*.*_ComponentTreeDeps*", - "*.*_HiltComponents*", - "*.*_HiltModules*", - "*.*_MembersInjector*", - "*.*_Factory*", - "*.Hilt_*", - "dagger.hilt.internal.*", - "hilt_aggregated_deps.*", - // Jetpack Compose - "*.ComposableSingletons*", - "*.*\$*Preview\$*", - "*.ui.preview.*", - ) - - filters { - classes { - excludes += excludedFiles - } - } -} diff --git a/sample-compose/buildSrc/src/main/java/Versions.kt b/sample-compose/buildSrc/src/main/java/Versions.kt index 74036ca84..3e6549af1 100644 --- a/sample-compose/buildSrc/src/main/java/Versions.kt +++ b/sample-compose/buildSrc/src/main/java/Versions.kt @@ -6,7 +6,7 @@ object Versions { const val ANDROID_TARGET_SDK_VERSION = 33 const val ANDROID_VERSION_CODE = 1 - const val ANDROID_VERSION_NAME = "3.22.0" + const val ANDROID_VERSION_NAME = "3.23.0" // Dependencies (Alphabet sorted) const val ACCOMPANIST_PERMISSIONS_VERSION = "0.30.1" @@ -28,7 +28,7 @@ object Versions { const val KOTLIN_VERSION = "1.8.21" const val KOTLINX_COROUTINES_VERSION = "1.7.1" - const val KOVER_VERSION = "0.6.0" + const val KOVER_VERSION = "0.7.3" const val MOSHI_VERSION = "1.12.0" diff --git a/sample-compose/data/build.gradle.kts b/sample-compose/data/build.gradle.kts index 773ce3e3c..1ef1f1921 100644 --- a/sample-compose/data/build.gradle.kts +++ b/sample-compose/data/build.gradle.kts @@ -2,7 +2,7 @@ plugins { id("com.android.library") id("kotlin-android") - id("kover") + id("org.jetbrains.kotlinx.kover") } android { @@ -41,16 +41,6 @@ android { xmlReport = true xmlOutput = file("build/reports/lint/lint-result.xml") } - - testOptions { - unitTests.all { - if (it.name != "testDebugUnitTest") { - it.extensions.configure(kotlinx.kover.api.KoverTaskExtension::class) { - isDisabled.set(true) - } - } - } - } } dependencies { diff --git a/sample-compose/domain/build.gradle.kts b/sample-compose/domain/build.gradle.kts index 79bbc8925..dfbddbbb5 100644 --- a/sample-compose/domain/build.gradle.kts +++ b/sample-compose/domain/build.gradle.kts @@ -2,7 +2,7 @@ plugins { id("java-library") id("kotlin") - id("kover") + id("org.jetbrains.kotlinx.kover") } java { diff --git a/sample-xml/README.md b/sample-xml/README.md index bf64ee870..d42e926ef 100644 --- a/sample-xml/README.md +++ b/sample-xml/README.md @@ -38,10 +38,10 @@ $ ./gradlew domain:test - Run unit testing with coverage: ``` -$ ./gradlew koverMergedHtmlReport +$ ./gradlew koverHtmlReport ``` -Report is located at: `./build/reports/kover/merged/` +Report is located at: `app/build/reports/kover/` ## Build and deploy diff --git a/sample-xml/app/build.gradle.kts b/sample-xml/app/build.gradle.kts index 9826acf5c..46615b7b9 100644 --- a/sample-xml/app/build.gradle.kts +++ b/sample-xml/app/build.gradle.kts @@ -7,8 +7,7 @@ plugins { id("dagger.hilt.android.plugin") id("androidx.navigation.safeargs.kotlin") - - id("kover") + id("org.jetbrains.kotlinx.kover") } val keystoreProperties = rootDir.loadGradleProperties("signing.properties") @@ -96,13 +95,6 @@ android { isIncludeAndroidResources = true isReturnDefaultValues = true } - unitTests.all { - if (it.name != "testStagingDebugUnitTest") { - it.extensions.configure(kotlinx.kover.api.KoverTaskExtension::class) { - isDisabled.set(true) - } - } - } } } @@ -162,3 +154,62 @@ dependencies { kaptTest("com.google.dagger:hilt-android-compiler:${Versions.HILT_VERSION}") testAnnotationProcessor("com.google.dagger:hilt-android-compiler:${Versions.HILT_VERSION}") } + +/* + * Kover configs + */ +dependencies { + kover(project(":data")) + kover(project(":domain")) +} + +koverReport { + defaults { + mergeWith("stagingDebug") + filters { + val generatedFiles = setOf( + "*.R.class", + "*.R\$*.class", + "*.*\$ViewBinder*.*", + "*.*\$InjectAdapter*.*", + "*.*Injector*.*", + "*.BuildConfig.*", + "*.BuildConfig", + "*.Manifest*.*", + "*.*_ViewBinding*.*", + "*.*Adapter*.*", + "*.*Test*.*", + // Enum + "*.*\$Creator*", + // Nav Component + "*.*_Factory*", + "*.*FragmentArgs*", + "*.*FragmentDirections*", + "*.FragmentNavArgsLazy.kt", + "*.*Fragment*navArgs*", + "*.*ModuleDeps*.*", + "*.*NavGraphDirections*", + // Hilt + "*.*_ComponentTreeDeps*", + "*.*_HiltComponents*", + "*.*_HiltModules*", + "*.*_MembersInjector*", + "*.Hilt_*" + ) + + val excludedPackages = setOf( + "com.bumptech.glide.*", + "dagger.hilt.internal.*", + "hilt_aggregated_deps.*", + "co.nimblehq.sample.xml.databinding.*", + "co.nimblehq.sample.xml.di.*" + ) + + val excludedFiles = generatedFiles + excludedPackages + + excludes { + classes(excludedFiles) + } + } + } +} diff --git a/sample-xml/build.gradle.kts b/sample-xml/build.gradle.kts index 7c71cf960..5ba46de86 100644 --- a/sample-xml/build.gradle.kts +++ b/sample-xml/build.gradle.kts @@ -63,52 +63,3 @@ detekt { ignoredBuildTypes = listOf("release") ignoredFlavors = listOf("production") } - -koverMerged { - enable() - - val generatedFiles = setOf( - "*.R.class", - "*.R\$*.class", - "*.*\$ViewBinder*.*", - "*.*\$InjectAdapter*.*", - "*.*Injector*.*", - "*.BuildConfig.*", - "*.BuildConfig", - "*.Manifest*.*", - "*.*_ViewBinding*.*", - "*.*Adapter*.*", - "*.*Test*.*", - // Enum - "*.*\$Creator*", - // Nav Component - "*.*_Factory*", - "*.*FragmentArgs*", - "*.*FragmentDirections*", - "*.FragmentNavArgsLazy.kt", - "*.*Fragment*navArgs*", - "*.*ModuleDeps*.*", - "*.*NavGraphDirections*", - // Hilt - "*.*_ComponentTreeDeps*", - "*.*_HiltComponents*", - "*.*_HiltModules*", - "*.*_MembersInjector*", - "*.Hilt_*" - ) - - val excludedPackages = setOf( - "com.bumptech.glide.*", - "dagger.hilt.internal.*", - "hilt_aggregated_deps.*", - "co.nimblehq.sample.xml.databinding.*", - "co.nimblehq.sample.xml.di.*" - ) - - val excludedFiles = generatedFiles + excludedPackages - filters { - classes { - excludes += excludedFiles - } - } -} diff --git a/sample-xml/buildSrc/src/main/java/Versions.kt b/sample-xml/buildSrc/src/main/java/Versions.kt index 882b556c3..f46c5c834 100644 --- a/sample-xml/buildSrc/src/main/java/Versions.kt +++ b/sample-xml/buildSrc/src/main/java/Versions.kt @@ -6,7 +6,7 @@ object Versions { const val ANDROID_TARGET_SDK_VERSION = 33 const val ANDROID_VERSION_CODE = 1 - const val ANDROID_VERSION_NAME = "3.22.0" + const val ANDROID_VERSION_NAME = "3.23.0" // Dependencies (Alphabet sorted) const val ANDROID_COMMON_KTX_VERSION = "0.1.1" @@ -31,7 +31,7 @@ object Versions { const val KOTLIN_REFLECT_VERSION = "1.7.20" const val KOTLIN_VERSION = "1.7.20" const val KOTLINX_COROUTINES_VERSION = "1.6.4" - const val KOVER_VERSION = "0.6.0" + const val KOVER_VERSION = "0.7.3" const val MOSHI_VERSION = "1.12.0" diff --git a/sample-xml/data/build.gradle.kts b/sample-xml/data/build.gradle.kts index 591c4beb0..b5e15cfb5 100644 --- a/sample-xml/data/build.gradle.kts +++ b/sample-xml/data/build.gradle.kts @@ -2,7 +2,7 @@ plugins { id("com.android.library") id("kotlin-android") - id("kover") + id("org.jetbrains.kotlinx.kover") } android { @@ -42,16 +42,6 @@ android { xmlReport = true xmlOutput = file("build/reports/lint/lint-result.xml") } - - testOptions { - unitTests.all { - if (it.name != "testDebugUnitTest") { - it.extensions.configure(kotlinx.kover.api.KoverTaskExtension::class) { - isDisabled.set(true) - } - } - } - } } dependencies { diff --git a/sample-xml/domain/build.gradle.kts b/sample-xml/domain/build.gradle.kts index 79bbc8925..dfbddbbb5 100644 --- a/sample-xml/domain/build.gradle.kts +++ b/sample-xml/domain/build.gradle.kts @@ -2,7 +2,7 @@ plugins { id("java-library") id("kotlin") - id("kover") + id("org.jetbrains.kotlinx.kover") } java { diff --git a/template-compose/README.md b/template-compose/README.md index e52055a4b..4ef557e71 100644 --- a/template-compose/README.md +++ b/template-compose/README.md @@ -38,10 +38,10 @@ $ ./gradlew domain:test - Run unit testing with coverage: ``` -$ ./gradlew koverMergedHtmlReport +$ ./gradlew koverHtmlReport ``` -Report is located at: `./build/reports/kover/merged/` +Report is located at: `app/build/reports/kover/` ## Build and deploy diff --git a/template-compose/app/build.gradle.kts b/template-compose/app/build.gradle.kts index 57ba3c5f4..028198533 100644 --- a/template-compose/app/build.gradle.kts +++ b/template-compose/app/build.gradle.kts @@ -1,15 +1,12 @@ plugins { id("com.android.application") - id("com.google.gms.google-services") - id("kotlin-android") id("kotlin-kapt") id("kotlin-parcelize") id("dagger.hilt.android.plugin") - - id("kover") + id("org.jetbrains.kotlinx.kover") } val keystoreProperties = rootDir.loadGradleProperties("signing.properties") @@ -108,13 +105,6 @@ android { // Robolectric resource processing/loading https://github.com/robolectric/robolectric/pull/4736 isIncludeAndroidResources = true } - unitTests.all { - if (it.name != "testStagingDebugUnitTest") { - it.extensions.configure(kotlinx.kover.api.KoverTaskExtension::class) { - isDisabled.set(true) - } - } - } // Disable device's animation for instrument testing // animationsDisabled = true } @@ -142,8 +132,6 @@ dependencies { implementation("androidx.datastore:datastore-preferences:${Versions.ANDROIDX_DATASTORE_PREFERENCES_VERSION}") - implementation(platform("com.google.firebase:firebase-bom:${Versions.FIREBASE_BOM_VERSION}")) - implementation("androidx.navigation:navigation-compose:${Versions.COMPOSE_NAVIGATION_VERSION}") implementation("com.google.accompanist:accompanist-permissions:${Versions.ACCOMPANIST_PERMISSIONS_VERSION}") @@ -174,3 +162,44 @@ dependencies { testImplementation("androidx.compose.ui:ui-test-junit4") testImplementation("org.robolectric:robolectric:${Versions.TEST_ROBOLECTRIC_VERSION}") } + +/* + * Kover configs + */ +dependencies { + kover(project(":data")) + kover(project(":domain")) +} + +koverReport { + defaults { + mergeWith("stagingDebug") + filters { + val excludedFiles = listOf( + "*.BuildConfig.*", + "*.BuildConfig", + // Enum + "*.*\$Creator*", + // DI + "*.di.*", + // Hilt + "*.*_ComponentTreeDeps*", + "*.*_HiltComponents*", + "*.*_HiltModules*", + "*.*_MembersInjector*", + "*.*_Factory*", + "*.Hilt_*", + "dagger.hilt.internal.*", + "hilt_aggregated_deps.*", + // Jetpack Compose + "*.ComposableSingletons*", + "*.*\$*Preview\$*", + "*.ui.preview.*", + ) + + excludes { + classes(excludedFiles) + } + } + } +} diff --git a/template-compose/build.gradle.kts b/template-compose/build.gradle.kts index 242a2e250..cade7ca57 100644 --- a/template-compose/build.gradle.kts +++ b/template-compose/build.gradle.kts @@ -9,7 +9,6 @@ buildscript { classpath("com.android.tools.build:gradle:${Versions.BUILD_GRADLE_VERSION}") classpath("com.google.dagger:hilt-android-gradle-plugin:${Versions.HILT_VERSION}") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.KOTLIN_VERSION}") - classpath("com.google.gms:google-services:${Versions.GOOGLE_SERVICES_VERSION}") } } @@ -62,35 +61,3 @@ tasks.withType().configureEach { } } } - -koverMerged { - enable() - - val excludedFiles = listOf( - "*.BuildConfig.*", - "*.BuildConfig", - // Enum - "*.*\$Creator*", - // DI - "*.di.*", - // Hilt - "*.*_ComponentTreeDeps*", - "*.*_HiltComponents*", - "*.*_HiltModules*", - "*.*_MembersInjector*", - "*.*_Factory*", - "*.Hilt_*", - "dagger.hilt.internal.*", - "hilt_aggregated_deps.*", - // Jetpack Compose - "*.ComposableSingletons*", - "*.*\$*Preview\$*", - "*.ui.preview.*", - ) - - filters { - classes { - excludes += excludedFiles - } - } -} diff --git a/template-compose/buildSrc/src/main/java/Versions.kt b/template-compose/buildSrc/src/main/java/Versions.kt index 106e2dfd5..e5d8e3674 100644 --- a/template-compose/buildSrc/src/main/java/Versions.kt +++ b/template-compose/buildSrc/src/main/java/Versions.kt @@ -21,9 +21,6 @@ object Versions { const val COMPOSE_COMPILER_VERSION = "1.4.7" const val COMPOSE_NAVIGATION_VERSION = "2.5.3" - const val FIREBASE_BOM_VERSION = "32.1.1" - const val GOOGLE_SERVICES_VERSION = "4.3.15" - const val HILT_VERSION = "2.44" const val HILT_NAVIGATION_COMPOSE_VERSION = "1.0.0" @@ -31,7 +28,7 @@ object Versions { const val KOTLIN_VERSION = "1.8.21" const val KOTLINX_COROUTINES_VERSION = "1.7.1" - const val KOVER_VERSION = "0.6.0" + const val KOVER_VERSION = "0.7.3" const val MOSHI_VERSION = "1.12.0" diff --git a/template-compose/data/build.gradle.kts b/template-compose/data/build.gradle.kts index 773ce3e3c..1ef1f1921 100644 --- a/template-compose/data/build.gradle.kts +++ b/template-compose/data/build.gradle.kts @@ -2,7 +2,7 @@ plugins { id("com.android.library") id("kotlin-android") - id("kover") + id("org.jetbrains.kotlinx.kover") } android { @@ -41,16 +41,6 @@ android { xmlReport = true xmlOutput = file("build/reports/lint/lint-result.xml") } - - testOptions { - unitTests.all { - if (it.name != "testDebugUnitTest") { - it.extensions.configure(kotlinx.kover.api.KoverTaskExtension::class) { - isDisabled.set(true) - } - } - } - } } dependencies { diff --git a/template-compose/domain/build.gradle.kts b/template-compose/domain/build.gradle.kts index 79bbc8925..dfbddbbb5 100644 --- a/template-compose/domain/build.gradle.kts +++ b/template-compose/domain/build.gradle.kts @@ -2,7 +2,7 @@ plugins { id("java-library") id("kotlin") - id("kover") + id("org.jetbrains.kotlinx.kover") } java { diff --git a/template-xml/README.md b/template-xml/README.md index e52055a4b..4ef557e71 100644 --- a/template-xml/README.md +++ b/template-xml/README.md @@ -38,10 +38,10 @@ $ ./gradlew domain:test - Run unit testing with coverage: ``` -$ ./gradlew koverMergedHtmlReport +$ ./gradlew koverHtmlReport ``` -Report is located at: `./build/reports/kover/merged/` +Report is located at: `app/build/reports/kover/` ## Build and deploy diff --git a/template-xml/app/build.gradle.kts b/template-xml/app/build.gradle.kts index 23755b676..02fa4b2cd 100644 --- a/template-xml/app/build.gradle.kts +++ b/template-xml/app/build.gradle.kts @@ -7,8 +7,7 @@ plugins { id("dagger.hilt.android.plugin") id("androidx.navigation.safeargs.kotlin") - - id("kover") + id("org.jetbrains.kotlinx.kover") } val keystoreProperties = rootDir.loadGradleProperties("signing.properties") @@ -96,13 +95,6 @@ android { isIncludeAndroidResources = true isReturnDefaultValues = true } - unitTests.all { - if (it.name != "testStagingDebugUnitTest") { - it.extensions.configure(kotlinx.kover.api.KoverTaskExtension::class) { - isDisabled.set(true) - } - } - } } } @@ -163,3 +155,62 @@ dependencies { kaptTest("com.google.dagger:hilt-android-compiler:${Versions.HILT_VERSION}") testAnnotationProcessor("com.google.dagger:hilt-android-compiler:${Versions.HILT_VERSION}") } + +/* + * Kover configs + */ +dependencies { + kover(project(":data")) + kover(project(":domain")) +} + +koverReport { + defaults { + mergeWith("stagingDebug") + filters { + val generatedFiles = setOf( + "*.R.class", + "*.R\$*.class", + "*.*\$ViewBinder*.*", + "*.*\$InjectAdapter*.*", + "*.*Injector*.*", + "*.BuildConfig.*", + "*.BuildConfig", + "*.Manifest*.*", + "*.*_ViewBinding*.*", + "*.*Adapter*.*", + "*.*Test*.*", + // Enum + "*.*\$Creator*", + // Nav Component + "*.*_Factory*", + "*.*FragmentArgs*", + "*.*FragmentDirections*", + "*.FragmentNavArgsLazy.kt", + "*.*Fragment*navArgs*", + "*.*ModuleDeps*.*", + "*.*NavGraphDirections*", + // Hilt + "*.*_ComponentTreeDeps*", + "*.*_HiltComponents*", + "*.*_HiltModules*", + "*.*_MembersInjector*", + "*.Hilt_*" + ) + + val excludedPackages = setOf( + "com.bumptech.glide.*", + "dagger.hilt.internal.*", + "hilt_aggregated_deps.*", + "co.nimblehq.template.xml.databinding.*", + "co.nimblehq.template.xml.di.*" + ) + + val excludedFiles = generatedFiles + excludedPackages + + excludes { + classes(excludedFiles) + } + } + } +} diff --git a/template-xml/build.gradle.kts b/template-xml/build.gradle.kts index a56c6909d..109944325 100644 --- a/template-xml/build.gradle.kts +++ b/template-xml/build.gradle.kts @@ -62,52 +62,3 @@ tasks.withType().configureEach { } } } - -koverMerged { - enable() - - val generatedFiles = setOf( - "*.R.class", - "*.R\$*.class", - "*.*\$ViewBinder*.*", - "*.*\$InjectAdapter*.*", - "*.*Injector*.*", - "*.BuildConfig.*", - "*.BuildConfig", - "*.Manifest*.*", - "*.*_ViewBinding*.*", - "*.*Adapter*.*", - "*.*Test*.*", - // Enum - "*.*\$Creator*", - // Nav Component - "*.*_Factory*", - "*.*FragmentArgs*", - "*.*FragmentDirections*", - "*.FragmentNavArgsLazy.kt", - "*.*Fragment*navArgs*", - "*.*ModuleDeps*.*", - "*.*NavGraphDirections*", - // Hilt - "*.*_ComponentTreeDeps*", - "*.*_HiltComponents*", - "*.*_HiltModules*", - "*.*_MembersInjector*", - "*.Hilt_*" - ) - - val excludedPackages = setOf( - "com.bumptech.glide.*", - "dagger.hilt.internal.*", - "hilt_aggregated_deps.*", - "co.nimblehq.template.xml.databinding.*", - "co.nimblehq.template.xml.di.*" - ) - - val excludedFiles = generatedFiles + excludedPackages - filters { - classes { - excludes += excludedFiles - } - } -} diff --git a/template-xml/buildSrc/src/main/java/Versions.kt b/template-xml/buildSrc/src/main/java/Versions.kt index 62a86ea4a..e766a25ae 100644 --- a/template-xml/buildSrc/src/main/java/Versions.kt +++ b/template-xml/buildSrc/src/main/java/Versions.kt @@ -31,7 +31,7 @@ object Versions { const val KOTLIN_REFLECT_VERSION = "1.7.20" const val KOTLIN_VERSION = "1.7.20" const val KOTLINX_COROUTINES_VERSION = "1.6.4" - const val KOVER_VERSION = "0.6.0" + const val KOVER_VERSION = "0.7.3" const val MOSHI_VERSION = "1.12.0" diff --git a/template-xml/data/build.gradle.kts b/template-xml/data/build.gradle.kts index 591c4beb0..70e39944f 100644 --- a/template-xml/data/build.gradle.kts +++ b/template-xml/data/build.gradle.kts @@ -1,8 +1,7 @@ plugins { id("com.android.library") id("kotlin-android") - - id("kover") + id("org.jetbrains.kotlinx.kover") } android { @@ -42,16 +41,6 @@ android { xmlReport = true xmlOutput = file("build/reports/lint/lint-result.xml") } - - testOptions { - unitTests.all { - if (it.name != "testDebugUnitTest") { - it.extensions.configure(kotlinx.kover.api.KoverTaskExtension::class) { - isDisabled.set(true) - } - } - } - } } dependencies { diff --git a/template-xml/domain/build.gradle.kts b/template-xml/domain/build.gradle.kts index 79bbc8925..dfbddbbb5 100644 --- a/template-xml/domain/build.gradle.kts +++ b/template-xml/domain/build.gradle.kts @@ -2,7 +2,7 @@ plugins { id("java-library") id("kotlin") - id("kover") + id("org.jetbrains.kotlinx.kover") } java { diff --git a/version.properties b/version.properties index 6ae7eeb77..e97ef76c7 100644 --- a/version.properties +++ b/version.properties @@ -1,3 +1,3 @@ kotlinVersion=1.6.21 kscriptVersion=4.0.3 -templateScriptVersion=3.22.0 +templateScriptVersion=3.23.0