From 8bb78ce68b858b1f12291004a741fd18b2c6f9c9 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 3 Mar 2023 16:40:23 +0100 Subject: [PATCH 1/2] `sonarqube` task is deprecated, use `sonar` now. --- .github/workflows/tests.yml | 2 +- build.gradle | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 111648a2d46..6ee85168af8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -111,7 +111,7 @@ jobs: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} ORG_GRADLE_PROJECT_SONAR_LOGIN: ${{ secrets.SONAR_TOKEN }} if: ${{ always() && env.GITHUB_TOKEN != '' && env.SONAR_TOKEN != '' && env.ORG_GRADLE_PROJECT_SONAR_LOGIN != '' }} - run: ./gradlew sonarqube $CI_GRADLE_ARG_PROPERTIES + run: ./gradlew sonar $CI_GRADLE_ARG_PROPERTIES - name: Format unit test results if: always() diff --git a/build.gradle b/build.gradle index 285713cacfe..2e28911a4f1 100644 --- a/build.gradle +++ b/build.gradle @@ -203,10 +203,10 @@ if (launchTask.contains("coverage".toLowerCase())) { apply plugin: 'org.sonarqube' // To run a sonar analysis: -// Run './gradlew sonarqube -Dsonar.login=' +// Run './gradlew sonar -Dsonar.login=' // The SONAR_KEY is stored in passbolt as Token Sonar Cloud Bma -sonarqube { +sonar { properties { property "sonar.projectName", "element-android" property "sonar.projectKey", "vector-im_element-android" @@ -225,7 +225,7 @@ sonarqube { } project(":vector") { - sonarqube { + sonar { properties { property "sonar.sources", project(":vector").android.sourceSets.main.java.srcDirs // exclude source code from analyses separated by a colon (:) @@ -236,13 +236,13 @@ project(":vector") { } project(":library:external:diff-match-patch") { - sonarqube { + sonar { skipProject = true } } //project(":matrix-sdk-android") { -// sonarqube { +// sonar { // properties { // property "sonar.sources", project(":matrix-sdk-android").android.sourceSets.main.java.srcDirs // // exclude source code from analyses separated by a colon (:) From ceda85f6249a20972b811fb37a0522396c47767e Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 3 Mar 2023 18:01:10 +0100 Subject: [PATCH 2/2] Fix test by mocking `WorkManagerProvider.tag` Appeared when upgrading androidx.work:work-runtime-ktx from 2.7.1 to 2.8.0 in #8099 --- .../org/matrix/android/sdk/internal/di/WorkManagerProvider.kt | 2 +- .../matrix/android/sdk/test/fakes/FakeWorkManagerProvider.kt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/di/WorkManagerProvider.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/di/WorkManagerProvider.kt index ad28286a849..d8cdd162f1a 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/di/WorkManagerProvider.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/di/WorkManagerProvider.kt @@ -41,7 +41,7 @@ internal class WorkManagerProvider @Inject constructor( private val coroutineDispatchers: MatrixCoroutineDispatchers, private val sessionScope: CoroutineScope ) { - private val tag = MATRIX_SDK_TAG_PREFIX + sessionId + val tag = MATRIX_SDK_TAG_PREFIX + sessionId val workManager = WorkManager.getInstance(context) diff --git a/matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fakes/FakeWorkManagerProvider.kt b/matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fakes/FakeWorkManagerProvider.kt index 51ff24c01d2..437fda65e44 100644 --- a/matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fakes/FakeWorkManagerProvider.kt +++ b/matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fakes/FakeWorkManagerProvider.kt @@ -26,5 +26,6 @@ internal class FakeWorkManagerProvider( val instance = mockk().also { every { it.workManager } returns fakeWorkManager.instance + every { it.tag } returns "Tag" } }