From 50a67d372dca149221185f6e1e53960993dbc71d Mon Sep 17 00:00:00 2001 From: Dara Keon Date: Sun, 26 Nov 2023 14:05:17 +0000 Subject: [PATCH] android: avoid test deps in APK --- android/App/build.gradle | 14 +++++++++----- android/Lib/build.gradle | 16 +++++++++------- android/Makefile | 2 +- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/android/App/build.gradle b/android/App/build.gradle index 685c7a5ed..a81de9468 100644 --- a/android/App/build.gradle +++ b/android/App/build.gradle @@ -78,16 +78,20 @@ android { dependencies { implementation project(':Lib') - implementation project(":TestUtils") + if (!project.hasProperty("hide-test-deps")) { + implementation project(":TestUtils") + } implementation "com.google.android.gms:play-services-iid:$play_version" implementation "com.squareup.retrofit2:converter-gson:$retrofit_version" - testImplementation project(":TestUtils") + if (!project.hasProperty("hide-test-deps")) { + testImplementation project(":TestUtils") - testImplementation "junit:junit:$junit_version" - testImplementation "org.mockito:mockito-core:$mockito_version" - testImplementation "org.robolectric:robolectric:$robolectric_version" + testImplementation "junit:junit:$junit_version" + testImplementation "org.mockito:mockito-core:$mockito_version" + testImplementation "org.robolectric:robolectric:$robolectric_version" + } } task wrapper(type: Wrapper) { diff --git a/android/Lib/build.gradle b/android/Lib/build.gradle index bb67020ee..cbe4b2295 100644 --- a/android/Lib/build.gradle +++ b/android/Lib/build.gradle @@ -55,16 +55,18 @@ dependencies { implementation "com.squareup.retrofit2:retrofit:$retrofit_version" implementation "com.squareup.retrofit2:converter-gson:$retrofit_version" - testImplementation project(":TestUtils") + if (!project.hasProperty("hide-test-deps")) { + testImplementation project(":TestUtils") - testImplementation "junit:junit:$junit_version" - testImplementation "org.mockito:mockito-core:$mockito_version" - testImplementation "org.robolectric:robolectric:$robolectric_version" - testImplementation "com.squareup.retrofit2:converter-gson:$retrofit_version" + testImplementation "junit:junit:$junit_version" + testImplementation "org.mockito:mockito-core:$mockito_version" + testImplementation "org.robolectric:robolectric:$robolectric_version" + testImplementation "com.squareup.retrofit2:converter-gson:$retrofit_version" - androidTestImplementation project(":TestUtils") + androidTestImplementation project(":TestUtils") - androidTestImplementation "com.android.support.test:runner:$testrunner_version" + androidTestImplementation "com.android.support.test:runner:$testrunner_version" + } } task wrapper(type: Wrapper) { diff --git a/android/Makefile b/android/Makefile index f3c95ba14..61db46b77 100644 --- a/android/Makefile +++ b/android/Makefile @@ -21,7 +21,7 @@ sleep: @sleep 2 apk: - @${GRADLE} :app:bundleRelease + @${GRADLE} :app:bundleRelease -Phide-test-deps @cp App/build/outputs/bundle/release/* \ ${PROJECT}/android/publish/ \