diff --git a/app/build.gradle b/app/build.gradle index 69e9dbcc1ec..f02e3cf5d97 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -93,7 +93,7 @@ android { } composeOptions { - kotlinCompilerExtensionVersion = Versions.compose_compiler + kotlinCompilerExtensionVersion = Versions.google_compose_compiler } flavorDimensions "product" @@ -217,18 +217,18 @@ dependencies { implementation Dependencies.androidx_compose_ui_tooling implementation Dependencies.androidx_compose_foundation implementation Dependencies.androidx_compose_material - implementation Dependencies.androidx_compose_constraint_layout implementation Dependencies.androidx_compose_runtime_livedata implementation Dependencies.androidx_constraint_layout + implementation Dependencies.androidx_constraint_layout_compose implementation Dependencies.androidx_core_ktx implementation Dependencies.androidx_fragment implementation Dependencies.androidx_lifecycle_process implementation Dependencies.androidx_lifecycle_viewmodel implementation Dependencies.androidx_palette - implementation Dependencies.androidx_preferences + implementation Dependencies.androidx_preference implementation Dependencies.androidx_recyclerview implementation Dependencies.androidx_savedstate - implementation Dependencies.androidx_splash_screen + implementation Dependencies.androidx_splashscreen implementation Dependencies.androidx_transition implementation Dependencies.google_accompanist_insets_ui @@ -295,14 +295,13 @@ dependencies { implementation project(':service-telemetry') - implementation Dependencies.kotlin_stdlib implementation Dependencies.kotlin_coroutines debugImplementation Dependencies.leakcanary focusImplementation Dependencies.adjust focusImplementation Dependencies.install_referrer // Required by Adjust - jnaForTest "net.java.dev.jna:jna:${jna_version}@jar" + jnaForTest Dependencies.jna testImplementation files(configurations.jnaForTest.copyRecursive().files) testImplementation "org.mozilla.telemetry:glean-native-forUnitTests:${project.ext.glean_version}" @@ -316,38 +315,37 @@ dependencies { testImplementation Dependencies.androidx_arch_core_testing testImplementation "org.mozilla.components:support-test:${AndroidComponents.VERSION}" testImplementation "org.mozilla.components:support-test-libstate:${AndroidComponents.VERSION}" - androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_version", { + androidTestImplementation Dependencies.espresso_core, { exclude group: 'com.android.support', module: 'support-annotations' } - androidTestImplementation "androidx.test.espresso:espresso-idling-resource:$espresso_version" - androidTestImplementation "androidx.test.espresso:espresso-web:$espresso_version", { + androidTestImplementation Dependencies.espresso_idling_resource + androidTestImplementation Dependencies.espresso_web, { exclude group: 'com.android.support', module: 'support-annotations' } - androidTestImplementation "androidx.test.espresso:espresso-intents:$espresso_version" + androidTestImplementation Dependencies.espresso_intents - androidTestImplementation 'com.squareup.okhttp3:mockwebserver:4.10.0' - testImplementation 'com.squareup.okhttp3:mockwebserver:4.10.0' + androidTestImplementation Dependencies.testing_mockwebserver + testImplementation Dependencies.testing_mockwebserver testImplementation "org.mozilla.components:lib-fetch-okhttp:${AndroidComponents.VERSION}" - androidTestImplementation "tools.fastlane:screengrab:2.0.0" - // This Falcon version is added to maven central now required for Screengrab - implementation 'com.jraska:falcon:2.2.0' + androidTestImplementation Dependencies.fastlane + implementation Dependencies.falcon // Required by fastlane - androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.1.0-alpha4', { + androidTestImplementation Dependencies.espresso_contrib, { exclude group: 'com.android.support', module: 'support-annotations' exclude group: 'com.android.support', module: 'support-v4' exclude group: 'com.android.support', module: 'design' exclude group: 'com.android.support', module: 'recyclerview-v7' } - testImplementation 'androidx.test:core:1.4.0' - testImplementation 'androidx.test:runner:1.4.0' - testImplementation 'androidx.test:rules:1.4.0' - - androidTestImplementation 'androidx.test:core-ktx:1.4.0' - androidTestImplementation 'androidx.test.ext:junit-ktx:1.1.3' - androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0' - androidTestImplementation 'androidx.test:runner:1.4.0' - androidTestUtil 'androidx.test:orchestrator:1.4.1' + testImplementation Dependencies.androidx_test_core + testImplementation Dependencies.androidx_test_runner + testImplementation Dependencies.androidx_test_rules + + androidTestImplementation Dependencies.androidx_test_core_ktx + androidTestImplementation Dependencies.androidx_junit_ktx + androidTestImplementation Dependencies.androidx_uiautomator + androidTestImplementation Dependencies.androidx_test_runner + androidTestUtil Dependencies.androidx_orchestrator } // ------------------------------------------------------------------------------------------------- diff --git a/build.gradle b/build.gradle index b1299f85478..850cd350691 100644 --- a/build.gradle +++ b/build.gradle @@ -3,12 +3,6 @@ import org.mozilla.focus.gradle.tasks.GithubDetailsTask buildscript { - ext.espresso_version = '3.4.0' - ext.jna_version = "5.12.1" - // Pinning the last working version of the service-telemetry component until we decide - // what we want to do with telemetry in the app. - ext.mozilla_components_version_telemetry = '57.0.9' - repositories { google() mavenCentral() @@ -33,16 +27,10 @@ buildscript { } plugins { - // The version number is duplicated in the detekt block. We are unable to use constants due to - // limitations of the gradle plugin. We've decided to stick with duplication for now since the - // other methods involve using undocumented APIs - // https://docs.gradle.org/current/userguide/plugins.html#plugins_dsl_limitations - id("io.gitlab.arturbosch.detekt").version("1.18.0") + id "io.gitlab.arturbosch.detekt" version "1.18.0" // Variables in plugins {} aren't supported } detekt { - // The version number is duplicated, please refer to plugins block for more details - version = "1.18.0" buildUponDefaultConfig = true input = files("$projectDir/app") config = files("$projectDir/quality/detekt.yml") @@ -79,7 +67,7 @@ configurations { } dependencies { - ktlint("com.pinterest:ktlint:0.47.0") { + ktlint("com.pinterest:ktlint:${Versions.ktlint_version}") { attributes { attribute(Bundling.BUNDLING_ATTRIBUTE, getObjects().named(Bundling, Bundling.EXTERNAL)) } diff --git a/buildSrc/src/main/java/Dependencies.kt b/buildSrc/src/main/java/Dependencies.kt index 8b573324524..4c82b5983eb 100644 --- a/buildSrc/src/main/java/Dependencies.kt +++ b/buildSrc/src/main/java/Dependencies.kt @@ -3,59 +3,75 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ object Versions { - const val compose_version = "1.2.1" - const val compose_compiler = "1.3.2" - const val leakcanary = "2.9.1" - const val sentry = "6.4.2" + object Adjust { + const val adjust = "4.32.0" + const val install_referrer = "2.2" + } object AndroidX { - const val activity_compose = "1.3.1" const val annotation = "1.1.0" const val appcompat = "1.3.0" const val arch = "2.1.0" const val browser = "1.3.0" - const val core = "1.9.0" - const val compose = compose_version - const val compose_constraint_layout = "1.0.1" - const val constraint_layout = "2.1.4" const val cardview = "1.0.0" + const val compose = "1.2.1" + const val constraint_layout = "2.1.4" + const val constraint_layout_compose = "1.0.1" + const val core = "1.9.0" const val fragment = "1.5.2" - const val recyclerview = "1.2.0" - const val palette = "1.0.0" - const val preferences = "1.1.1" const val lifecycle = "2.5.1" - const val saved_state = "1.2.0" - const val splash_screen = "1.0.0" + const val palette = "1.0.0" + const val preference = "1.1.1" + const val recyclerview = "1.2.0" + const val savedstate = "1.2.0" + const val splashscreen = "1.0.0" const val transition = "1.4.0" + const val work = "2.7.1" } object Google { - const val material = "1.2.1" const val accompanist = "0.16.1" + const val compose_compiler = "1.3.2" + const val material = "1.2.1" const val play = "1.10.3" } - object Kotlin { - const val version = "1.7.20" - const val coroutines = "1.6.4" - } - object Gradle { - const val kotlin_plugin = Kotlin.version const val android_plugin = "7.3.0" + const val kotlin_plugin = Kotlin.compiler } - object Test { - const val robolectric = "4.9" - const val mockito = "3.12.4" - const val androidx_work = "2.7.1" + object Kotlin { + const val compiler = "1.7.20" + const val coroutines = "1.6.4" + } + + object Testing { + const val androidx_core = "1.4.0" + const val androidx_espresso = "3.4.0" + const val androidx_ext_junit = "1.1.3" + const val androidx_orchestrator = "1.4.1" + const val androidx_uiautomator = "2.2.0" + const val falcon = "2.2.0" + const val fastlane = "2.0.0" const val junit = "5.8.2" + const val ktlint = "0.47.0" + const val mockito = "3.12.4" + const val mockwebserver = "4.10.0" + const val robolectric = "4.9" } - object Adjust { - const val adjust = "4.32.0" - const val install_referrer = "2.2" + object ThirdParty { + const val jna = "5.12.1" + const val leakcanary = "2.9.1" + const val sentry = "6.4.2" } + + // Workaround for a Gradle parsing bug that prevents using nested objects directly in Gradle files. + // These might be removable if we switch to kts files instead. + // https://github.com/gradle/gradle/issues/9251 + const val google_compose_compiler = Versions.Google.compose_compiler + const val ktlint_version = Versions.Testing.ktlint } object Dependencies { @@ -71,42 +87,57 @@ object Dependencies { const val androidx_compose_foundation = "androidx.compose.foundation:foundation:${Versions.AndroidX.compose}" const val androidx_compose_material = "androidx.compose.material:material:${Versions.AndroidX.compose}" const val androidx_compose_runtime_livedata = "androidx.compose.runtime:runtime-livedata:${Versions.AndroidX.compose}" - const val androidx_compose_constraint_layout = - "androidx.constraintlayout:constraintlayout-compose:${Versions.AndroidX.compose_constraint_layout}" + const val androidx_constraint_layout_compose = + "androidx.constraintlayout:constraintlayout-compose:${Versions.AndroidX.constraint_layout_compose}" const val androidx_constraint_layout = "androidx.constraintlayout:constraintlayout:${Versions.AndroidX.constraint_layout}" const val androidx_core_ktx = "androidx.core:core-ktx:${Versions.AndroidX.core}" const val androidx_fragment = "androidx.fragment:fragment:${Versions.AndroidX.fragment}" const val androidx_palette = "androidx.palette:palette-ktx:${Versions.AndroidX.palette}" - const val androidx_preferences = "androidx.preference:preference-ktx:${Versions.AndroidX.preferences}" + const val androidx_preference = "androidx.preference:preference-ktx:${Versions.AndroidX.preference}" const val androidx_recyclerview = "androidx.recyclerview:recyclerview:${Versions.AndroidX.recyclerview}" const val androidx_lifecycle_process = "androidx.lifecycle:lifecycle-process:${Versions.AndroidX.lifecycle}" const val androidx_lifecycle_viewmodel = "androidx.lifecycle:lifecycle-viewmodel-ktx:${Versions.AndroidX.lifecycle}" - const val androidx_splash_screen = "androidx.core:core-splashscreen:${Versions.AndroidX.splash_screen}" - const val androidx_savedstate = "androidx.savedstate:savedstate-ktx:${Versions.AndroidX.saved_state}" + const val androidx_splashscreen = "androidx.core:core-splashscreen:${Versions.AndroidX.splashscreen}" + const val androidx_savedstate = "androidx.savedstate:savedstate-ktx:${Versions.AndroidX.savedstate}" const val androidx_transition = "androidx.transition:transition:${Versions.AndroidX.transition}" + const val androidx_work_testing = "androidx.work:work-testing:${Versions.AndroidX.work}" const val google_material = "com.google.android.material:material:${Versions.Google.material}" const val google_accompanist_insets_ui = "com.google.accompanist:accompanist-insets-ui:${Versions.Google.accompanist}" const val google_play = "com.google.android.play:core:${Versions.Google.play}" const val kotlin_gradle_plugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.Gradle.kotlin_plugin}" const val android_gradle_plugin = "com.android.tools.build:gradle:${Versions.Gradle.android_plugin}" - const val leakcanary = "com.squareup.leakcanary:leakcanary-android-core:${Versions.leakcanary}" - const val sentry = "io.sentry:sentry-android:${Versions.sentry}" + const val jna = "net.java.dev.jna:jna:${Versions.ThirdParty.jna}@jar" + const val leakcanary = "com.squareup.leakcanary:leakcanary-android-core:${Versions.ThirdParty.leakcanary}" + const val sentry = "io.sentry:sentry-android:${Versions.ThirdParty.sentry}" - const val kotlin_stdlib = "org.jetbrains.kotlin:kotlin-stdlib:${Versions.Kotlin.version}" const val kotlin_coroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.Kotlin.coroutines}" const val kotlin_coroutines_android = "org.jetbrains.kotlinx:kotlinx-coroutines-android:${Versions.Kotlin.coroutines}" const val adjust = "com.adjust.sdk:adjust-android:${Versions.Adjust.adjust}" const val install_referrer = "com.android.installreferrer:installreferrer:${Versions.Adjust.install_referrer}" - const val testing_robolectric = "org.robolectric:robolectric:${Versions.Test.robolectric}" - const val testing_mockito = "org.mockito:mockito-core:${Versions.Test.mockito}" + const val androidx_junit_ktx = "androidx.test.ext:junit-ktx:${Versions.Testing.androidx_ext_junit}" + const val androidx_orchestrator = "androidx.test:orchestrator:${Versions.Testing.androidx_orchestrator}" + const val androidx_test_core = "androidx.test:core:${Versions.Testing.androidx_core}" + const val androidx_test_core_ktx = "androidx.test:core-ktx:${Versions.Testing.androidx_core}" + const val androidx_test_rules = "androidx.test:rules:${Versions.Testing.androidx_core}" + const val androidx_test_runner = "androidx.test:runner:${Versions.Testing.androidx_core}" + const val androidx_uiautomator = "androidx.test.uiautomator:uiautomator:${Versions.Testing.androidx_uiautomator}" + const val espresso_contrib = "androidx.test.espresso:espresso-contrib:${Versions.Testing.androidx_espresso}" + const val espresso_core = "androidx.test.espresso:espresso-core:${Versions.Testing.androidx_espresso}" + const val espresso_idling_resource = "androidx.test.espresso:espresso-idling-resource:${Versions.Testing.androidx_espresso}" + const val espresso_intents = "androidx.test.espresso:espresso-intents:${Versions.Testing.androidx_espresso}" + const val espresso_web = "androidx.test.espresso:espresso-web:${Versions.Testing.androidx_espresso}" + const val falcon = "com.jraska:falcon:${Versions.Testing.falcon}" + const val fastlane = "tools.fastlane:screengrab:${Versions.Testing.fastlane}" + const val testing_robolectric = "org.robolectric:robolectric:${Versions.Testing.robolectric}" + const val testing_mockito = "org.mockito:mockito-core:${Versions.Testing.mockito}" + const val testing_mockwebserver = "com.squareup.okhttp3:mockwebserver:${Versions.Testing.mockwebserver}" const val testing_coroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-test:${Versions.Kotlin.coroutines}" - const val androidx_work_testing = "androidx.work:work-testing:${Versions.Test.androidx_work}" - const val testing_junit_api = "org.junit.jupiter:junit-jupiter-api:${Versions.Test.junit}" - const val testing_junit_engine = "org.junit.jupiter:junit-jupiter-engine:${Versions.Test.junit}" - const val testing_junit_params = "org.junit.jupiter:junit-jupiter-params:${Versions.Test.junit}" + const val testing_junit_api = "org.junit.jupiter:junit-jupiter-api:${Versions.Testing.junit}" + const val testing_junit_engine = "org.junit.jupiter:junit-jupiter-engine:${Versions.Testing.junit}" + const val testing_junit_params = "org.junit.jupiter:junit-jupiter-params:${Versions.Testing.junit}" } diff --git a/service-telemetry/build.gradle b/service-telemetry/build.gradle index 45518cf6a76..f90d3979701 100644 --- a/service-telemetry/build.gradle +++ b/service-telemetry/build.gradle @@ -33,15 +33,4 @@ dependencies { implementation "org.mozilla.components:concept-fetch:${AndroidComponents.VERSION}" implementation Dependencies.androidx_annotation - - implementation Dependencies.kotlin_stdlib - - testImplementation "junit:junit:4.12" - testImplementation Dependencies.testing_robolectric - testImplementation Dependencies.testing_mockito - - testImplementation 'com.squareup.okhttp3:mockwebserver:3.11.0' - - testImplementation "org.mozilla.components:lib-fetch-httpurlconnection:${AndroidComponents.VERSION}" - testImplementation "org.mozilla.components:lib-fetch-okhttp:${AndroidComponents.VERSION}" } \ No newline at end of file