From ecb305e260aeb944e969103786080c787b8f0670 Mon Sep 17 00:00:00 2001 From: Arno Burkhart Date: Sun, 31 Dec 2023 15:04:46 +0100 Subject: [PATCH] #9: Upgrade gradle and plugins --- app/build.gradle | 81 ++++++++++++++++-------- build.gradle | 6 +- gradle/wrapper/gradle-wrapper.properties | 2 +- 3 files changed, 58 insertions(+), 31 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index aec798e..be95f29 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -5,14 +5,6 @@ plugins { id "org.sonarqube" version "4.2.1.3168" } -sonarqube { - properties { - property "sonar.projectKey", "arburk_vscp" - property "sonar.organization", "arburk" - property "sonar.host.url", "https://sonarcloud.io" - } -} - android { namespace 'com.github.arburk.vscp.app' compileSdk 33 @@ -24,7 +16,8 @@ android { versionCode 1 versionName "1.0" - testInstrumentationRunner "com.github.arburk.vscp.app.AndroidJunitRunnerWithDexOpener" + //testInstrumentationRunner "com.github.arburk.vscp.app.AndroidJunitRunnerWithDexOpener" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { @@ -97,17 +90,26 @@ android { } } +sonarqube { + properties { + property "sonar.projectKey", "arburk_vscp" + property "sonar.organization", "arburk" + property "sonar.host.url", "https://sonarcloud.io" + } +} + apply plugin: 'jacoco' jacoco { + version = "0.8.11" toolVersion = "0.8.11" } tasks.register('jacocoTestReport', JacocoReport) { dependsOn(testDebugUnitTest) - dependsOn(testReleaseUnitTest) - dependsOn(compileDebugJavaWithJavac) - dependsOn(compileDebugKotlin) + //dependsOn(testReleaseUnitTest) + //dependsOn(compileDebugJavaWithJavac) + //dependsOn(compileDebugKotlin) //dependsOn(nexus5api27DebugAndroidTest) //dependsOn(pixel3api30DebugAndroidTest) @@ -124,14 +126,29 @@ tasks.register('jacocoTestReport', JacocoReport) { //kotlin compiled classes def kotlinTree = fileTree(dir: "$project.projectDir/build/tmp/kotlin-classes/debug", excludes: fileFilter) +/* + def releaseKotlinClasses = fileTree(dir: "$project.projectDir/build/tmp/kotlin-classes/release", excludes: fileFilter) + def debugKotlinClasses = fileTree(dir: "$project.projectDir/build/tmp/kotlin-classes/debug") + def releaseJavaClasses = fileTree(dir: "$project.projectDir/build/intermediates/javac/release", excludes: fileFilter) + def debugJavaClasses = fileTree(dir: "$project.projectDir/build/intermediates/javac/debug") + + def mainClasses = releaseKotlinClasses + debugKotlinClasses + def javaClasses = releaseJavaClasses + debugJavaClasses + + sourceDirectories.from = files([mainSrc]) + classDirectories.from = files([mainClasses, javaClasses]) + executionData.from = fileTree(dir: "$project.projectDir/build", include: [ + "jacoco/testReleaseUnitTest.exec", + "outputs/unit_test_code_coverage/debugUnitTest/testDebugUnitTest.exec"]) + */ sourceDirectories.setFrom(files([mainSrc])) classDirectories.from = files([javaTree, kotlinTree]) executionData.setFrom(fileTree(dir: "$projectDir/build", includes: [ - "jacoco/testReleaseUnitTest.exec", + // "jacoco/testReleaseUnitTest.exec", "outputs/unit_test_code_coverage/debugUnitTest/testDebugUnitTest.exec", - "outputs/managed_device_code_coverage/**/coverage.ec", - "outputs/code_coverage/debugAndroidTest/connected/**/coverage.ec", + // "outputs/managed_device_code_coverage/**/coverage.ec", + // "outputs/code_coverage/debugAndroidTest/connected/**/coverage.ec", ])) } @@ -150,7 +167,17 @@ dependencies { // Required -- JUnit 4 framework testImplementation "junit:junit:$jUnitVersion" - testRuntimeOnly("org.junit.vintage:junit-vintage-engine:5.8.2") + testRuntimeOnly("org.junit.vintage:junit-vintage-engine:5.9.2") + testRuntimeOnly 'org.junit.platform:junit-platform-launcher' + // If using JUnit Jupiter + //testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2' + //testRuntimeOnly 'org.junit.platform:junit-platform-launcher' + + + //testRuntimeOnly("org.jacoco:org.jacoco.core:0.8.11") + + + // Optional -- Robolectric environment // testImplementation "androidx.test:core:$androidXTestVersion" // Optional -- Mockito framework @@ -165,15 +192,15 @@ dependencies { // testImplementation "org.junit.jupiter:junit-jupiter-api:$junitJupiterVersion" // testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitJupiterVersion" - androidTestImplementation 'com.github.tmurakami:dexopener:2.0.5' - androidTestImplementation 'androidx.test.ext:junit:1.1.5' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' - androidTestImplementation 'androidx.test:runner:1.5.2' - androidTestImplementation 'androidx.test:rules:1.5.0' - androidTestImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.1' - androidTestImplementation "io.mockk:mockk-android:$mockkVersion" - androidTestImplementation "io.mockk:mockk-agent:$mockkVersion" - androidTestImplementation 'io.insert-koin:koin-test-junit4:3.0.2' - - debugImplementation "androidx.fragment:fragment-testing:$fragmentTestingVersion" +// androidTestImplementation 'com.github.tmurakami:dexopener:2.0.5' +// androidTestImplementation 'androidx.test.ext:junit:1.1.5' +// androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' +// androidTestImplementation 'androidx.test:runner:1.5.2' +// androidTestImplementation 'androidx.test:rules:1.5.0' + // androidTestImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.1' + // androidTestImplementation "io.mockk:mockk-android:$mockkVersion" + // androidTestImplementation "io.mockk:mockk-agent:$mockkVersion" + // androidTestImplementation 'io.insert-koin:koin-test-junit4:3.0.2' + + // debugImplementation "androidx.fragment:fragment-testing:$fragmentTestingVersion" } \ No newline at end of file diff --git a/build.gradle b/build.gradle index 12b0428..62e727e 100644 --- a/build.gradle +++ b/build.gradle @@ -1,8 +1,8 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. plugins { - id 'com.android.application' version '8.1.4' apply false - id 'com.android.library' version '8.1.4' apply false - id 'org.jetbrains.kotlin.android' version '1.9.21' apply false + id 'com.android.application' version '8.2.0' apply false + id 'com.android.library' version '8.2.0' apply false + id 'org.jetbrains.kotlin.android' version '1.9.22' apply false } ext { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 744c64d..3499ded 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists