Use a Gradle version catalog for managing dependencies
This commit is contained in:
Родитель
f189871114
Коммит
f0fe4a2cdd
|
@ -43,10 +43,10 @@ kotlin {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
testImplementation "junit:junit:$junit_version"
|
||||
testImplementation "org.robolectric:robolectric:$robolectric_core_version"
|
||||
testImplementation "org.mockito:mockito-core:$mockito_core_version"
|
||||
testImplementation libs.junit
|
||||
testImplementation libs.mockito
|
||||
testImplementation libs.robolectric
|
||||
|
||||
androidTestImplementation "androidx.test:runner:$androidx_test_version"
|
||||
androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_core_version"
|
||||
androidTestImplementation libs.test.espresso.core
|
||||
androidTestImplementation libs.test.runner
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ android {
|
|||
|
||||
protobuf {
|
||||
protoc {
|
||||
artifact = "com.google.protobuf:protoc:$protobuf_version"
|
||||
artifact = libs.protoc.get().toString() // https://github.com/google/protobuf-gradle-plugin/issues/563
|
||||
}
|
||||
generateProtoTasks {
|
||||
all().each { task ->
|
||||
|
@ -34,5 +34,5 @@ protobuf {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation "com.google.protobuf:protobuf-javalite:$protobuf_version"
|
||||
implementation libs.protobuf
|
||||
}
|
||||
|
|
61
build.gradle
61
build.gradle
|
@ -1,34 +1,6 @@
|
|||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
|
||||
ext {
|
||||
kotlin_version = '1.9.22'
|
||||
kotlin_coroutines_version = '1.7.3'
|
||||
jna_version = '5.14.0'
|
||||
android_gradle_plugin_version = '8.0.2'
|
||||
android_components_version = '122.0'
|
||||
glean_version = '57.0.0'
|
||||
|
||||
// NOTE: AndroidX libraries should be synced with AC to avoid compatibility issues
|
||||
androidx_annotation_version = '1.7.1'
|
||||
androidx_core_version = '1.12.0'
|
||||
androidx_test_version = '1.5.0'
|
||||
androidx_test_junit_version = '1.1.5'
|
||||
androidx_work_testing_version = '2.7.1'
|
||||
espresso_core_version = '3.5.1'
|
||||
|
||||
detekt_version = '1.23.5'
|
||||
ktlint_version = '0.50.0'
|
||||
gradle_download_task_version = '5.2.1'
|
||||
junit_version = '4.13.2'
|
||||
mockito_core_version = '5.10.0'
|
||||
robolectric_core_version = '4.11.1'
|
||||
rust_android_gradle_version = '0.9.3'
|
||||
protobuf_version = '3.21.10'
|
||||
gradle_protobuf_version = '0.9.4'
|
||||
}
|
||||
|
||||
ext.build = [
|
||||
ndkVersion: "25.2.9519653", // Keep it in sync in TC Dockerfile.
|
||||
|
||||
|
@ -56,36 +28,26 @@ buildscript {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
classpath "com.android.tools.build:gradle:$android_gradle_plugin_version"
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
||||
classpath "org.mozilla.rust-android-gradle:plugin:$rust_android_gradle_version"
|
||||
classpath libs.kotlin.gradle.plugin
|
||||
classpath libs.mozilla.glean.gradle.plugin
|
||||
classpath libs.mozilla.rust.android.gradle
|
||||
classpath libs.tools.android.plugin
|
||||
|
||||
// Yes, this is unusual. We want to access some host-specific
|
||||
// computation at build time.
|
||||
classpath "net.java.dev.jna:jna:$jna_version"
|
||||
|
||||
// Downloading libs/ archives from Taskcluster.
|
||||
classpath "de.undercouch:gradle-download-task:$gradle_download_task_version"
|
||||
|
||||
classpath "com.google.protobuf:protobuf-gradle-plugin:$gradle_protobuf_version"
|
||||
|
||||
// Since the Glean version depends on the Android components version,
|
||||
// it is very important to use a modern version of Glean and, ideally,
|
||||
// let this come from the embedding product itself.
|
||||
classpath "org.mozilla.telemetry:glean-gradle-plugin:$glean_version"
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
classpath libs.jna
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id "io.gitlab.arturbosch.detekt" version "$detekt_version"
|
||||
alias libs.plugins.detekt
|
||||
alias libs.plugins.gradle.download.task // Downloading libs/archives from Taskcluster.
|
||||
alias libs.plugins.protobuf.gradle apply false
|
||||
}
|
||||
|
||||
apply plugin: 'de.undercouch.download'
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
|
@ -293,7 +255,6 @@ ext.cargoExec = { spec, toolchain ->
|
|||
}
|
||||
|
||||
detekt {
|
||||
toolVersion = "$detekt_version"
|
||||
input = files(
|
||||
fileTree(dir: "${projectDir}/components", excludes: ["external", "**/generated", "**/templates"]),
|
||||
"${projectDir}/gradle-plugin",
|
||||
|
@ -315,7 +276,7 @@ configurations {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
ktlint("com.pinterest:ktlint:$ktlint_version") {
|
||||
ktlint(libs.ktlint) {
|
||||
attributes {
|
||||
attribute(Bundling.BUNDLING_ATTRIBUTE, getObjects().named(Bundling, Bundling.EXTERNAL))
|
||||
}
|
||||
|
|
|
@ -9,8 +9,8 @@ dependencies {
|
|||
// Part of the public API.
|
||||
api project(':sync15')
|
||||
|
||||
testImplementation "androidx.test:core-ktx:$androidx_test_version"
|
||||
testImplementation "androidx.work:work-testing:$androidx_work_testing_version"
|
||||
testImplementation libs.test.core
|
||||
testImplementation libs.test.work
|
||||
testImplementation project(":syncmanager")
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
plugins {
|
||||
id "com.jetbrains.python.envs" version "0.0.26"
|
||||
alias libs.plugins.gradle.python.envs
|
||||
}
|
||||
|
||||
apply from: "$rootDir/build-scripts/component-common.gradle"
|
||||
|
@ -15,9 +15,9 @@ android {
|
|||
dependencies {
|
||||
api project(':sync15')
|
||||
|
||||
implementation "org.mozilla.telemetry:glean:$glean_version"
|
||||
implementation libs.mozilla.glean
|
||||
|
||||
testImplementation "org.mozilla.telemetry:glean-native-forUnitTests:$glean_version"
|
||||
testImplementation libs.mozilla.glean.native.tests
|
||||
}
|
||||
|
||||
ext.configureUniFFIBindgen("../src/fxa_client.udl")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
plugins {
|
||||
id "com.jetbrains.python.envs" version "0.0.26"
|
||||
alias libs.plugins.gradle.python.envs
|
||||
}
|
||||
|
||||
apply from: "$rootDir/build-scripts/component-common.gradle"
|
||||
|
@ -18,11 +18,11 @@ dependencies {
|
|||
// Part of the public API.
|
||||
api project(':sync15')
|
||||
|
||||
implementation "org.mozilla.telemetry:glean:$glean_version"
|
||||
implementation libs.mozilla.glean
|
||||
|
||||
testImplementation "androidx.test:core-ktx:$androidx_test_version"
|
||||
testImplementation "androidx.work:work-testing:$androidx_work_testing_version"
|
||||
testImplementation "org.mozilla.telemetry:glean-native-forUnitTests:$glean_version"
|
||||
testImplementation libs.mozilla.glean.native.tests
|
||||
testImplementation libs.test.core
|
||||
testImplementation libs.test.work
|
||||
testImplementation project(":syncmanager")
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
plugins {
|
||||
id "com.jetbrains.python.envs" version "0.0.26"
|
||||
alias libs.plugins.gradle.python.envs
|
||||
}
|
||||
|
||||
apply from: "$rootDir/build-scripts/component-common.gradle"
|
||||
|
@ -14,18 +14,17 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation "androidx.annotation:annotation:$androidx_annotation_version"
|
||||
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutines_version"
|
||||
|
||||
api project(":remotesettings")
|
||||
implementation "org.mozilla.telemetry:glean:$glean_version"
|
||||
implementation "androidx.core:core-ktx:$androidx_core_version"
|
||||
|
||||
testImplementation "androidx.test:core-ktx:$androidx_test_version"
|
||||
testImplementation "androidx.test.ext:junit-ktx:$androidx_test_junit_version"
|
||||
testImplementation "androidx.work:work-testing:$androidx_work_testing_version"
|
||||
testImplementation "org.mozilla.telemetry:glean-native-forUnitTests:$glean_version"
|
||||
implementation libs.androidx.core
|
||||
implementation libs.androidx.annotation
|
||||
implementation libs.kotlinx.coroutines
|
||||
implementation libs.mozilla.glean
|
||||
|
||||
testImplementation libs.mozilla.glean.native.tests
|
||||
testImplementation libs.test.core
|
||||
testImplementation libs.test.junit.ext
|
||||
testImplementation libs.test.work
|
||||
}
|
||||
|
||||
ext.configureUniFFIBindgen("../src/nimbus.udl")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
plugins {
|
||||
id "com.jetbrains.python.envs" version "0.0.26"
|
||||
alias libs.plugins.gradle.python.envs
|
||||
}
|
||||
|
||||
apply from: "$rootDir/build-scripts/component-common.gradle"
|
||||
|
@ -17,11 +17,11 @@ dependencies {
|
|||
// Part of the public API.
|
||||
api project(':sync15')
|
||||
|
||||
implementation "org.mozilla.telemetry:glean:$glean_version"
|
||||
implementation libs.mozilla.glean
|
||||
|
||||
testImplementation "androidx.test:core-ktx:$androidx_test_version"
|
||||
testImplementation "androidx.work:work-testing:$androidx_work_testing_version"
|
||||
testImplementation "org.mozilla.telemetry:glean-native-forUnitTests:$glean_version"
|
||||
testImplementation libs.mozilla.glean.native.tests
|
||||
testImplementation libs.test.core
|
||||
testImplementation libs.test.work
|
||||
testImplementation project(':syncmanager')
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,6 @@ ext.dependsOnTheMegazord()
|
|||
ext.configurePublish()
|
||||
|
||||
dependencies {
|
||||
testImplementation("org.mozilla.components:concept-fetch:$android_components_version")
|
||||
testImplementation libs.mozilla.concept.fetch
|
||||
testImplementation project(":httpconfig")
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
apply from: "$rootDir/build-scripts/component-common.gradle"
|
||||
apply from: "$rootDir/build-scripts/protobuf-common.gradle"
|
||||
apply from: "$rootDir/publish.gradle"
|
||||
|
||||
android {
|
||||
|
@ -6,8 +7,12 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation "net.java.dev.jna:jna:$jna_version@aar"
|
||||
implementation "com.google.protobuf:protobuf-javalite:$protobuf_version"
|
||||
implementation(libs.jna) {
|
||||
artifact {
|
||||
extension ="aar"
|
||||
type = "aar"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ext.configurePublish()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
plugins {
|
||||
id "com.jetbrains.python.envs" version "0.0.26"
|
||||
alias libs.plugins.gradle.python.envs
|
||||
}
|
||||
|
||||
apply from: "$rootDir/build-scripts/component-common.gradle"
|
||||
|
@ -19,13 +19,13 @@ dependencies {
|
|||
// Part of the public API.
|
||||
api project(':sync15')
|
||||
|
||||
implementation "org.mozilla.telemetry:glean:$glean_version"
|
||||
implementation "androidx.core:core-ktx:$androidx_core_version"
|
||||
implementation libs.androidx.core
|
||||
implementation libs.mozilla.glean
|
||||
|
||||
testImplementation "androidx.test:core-ktx:$androidx_test_version"
|
||||
testImplementation "androidx.test.ext:junit-ktx:$androidx_test_junit_version"
|
||||
testImplementation "androidx.work:work-testing:$androidx_work_testing_version"
|
||||
testImplementation "org.mozilla.telemetry:glean-native-forUnitTests:$glean_version"
|
||||
testImplementation libs.mozilla.glean.native.tests
|
||||
testImplementation libs.test.core
|
||||
testImplementation libs.test.junit.ext
|
||||
testImplementation libs.test.work
|
||||
}
|
||||
|
||||
ext.configureUniFFIBindgen("../src/syncmanager.udl")
|
||||
|
|
|
@ -7,7 +7,7 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
api "org.mozilla.components:concept-fetch:$android_components_version"
|
||||
api libs.mozilla.concept.fetch
|
||||
}
|
||||
|
||||
ext.dependsOnTheMegazord()
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
// // Part of the public API.
|
||||
// api project(':sync15')
|
||||
|
||||
// implementation "org.mozilla.telemetry:glean:$glean_version"
|
||||
// implementation "androidx.core:core-ktx:$androidx_core_version"
|
||||
// implementation libs.androidx.core
|
||||
// implementation libs.mozilla.glean
|
||||
|
||||
// testImplementation "androidx.test:core-ktx:$androidx_test_version"
|
||||
// testImplementation "androidx.test.ext:junit-ktx:$androidx_test_junit_version"
|
||||
// testImplementation "androidx.work:work-testing:$androidx_work_testing_version"
|
||||
// testImplementation "org.mozilla.telemetry:glean-native-forUnitTests:$glean_version"
|
||||
// testImplementation libs.mozilla.glean.native.tests
|
||||
// testImplementation libs.test.core
|
||||
// testImplementation libs.test.junit.ext
|
||||
// testImplementation libs.test.work
|
||||
// }
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,97 @@
|
|||
# In general, these versions should be kept in sync with AC to avoid introducing
|
||||
# possible conflicts and compatibility issues. This primarily applies to dependencies
|
||||
# for shipping code, however. Libraries used only for the build system or testing
|
||||
# can be safely bumped when convenient.
|
||||
|
||||
[versions]
|
||||
# AGP
|
||||
android-plugin = "8.0.2"
|
||||
|
||||
# Google
|
||||
protobuf = "3.21.10"
|
||||
|
||||
# Kotlin
|
||||
kotlin-compiler = "1.9.22"
|
||||
kotlin-dsl = "4.2.1"
|
||||
kotlinx-coroutines = "1.7.3"
|
||||
|
||||
# Mozilla
|
||||
android-components = "122.0.1"
|
||||
glean = "57.0.0"
|
||||
rust-android-gradle = "0.9.3"
|
||||
|
||||
# AndroidX
|
||||
androidx-annotation = "1.7.1"
|
||||
androidx-core = "1.12.0"
|
||||
|
||||
# JNA
|
||||
jna = "5.14.0"
|
||||
|
||||
# Linting and Static Analysis
|
||||
detekt = "1.23.5"
|
||||
ktlint = "0.50.0"
|
||||
|
||||
# AndroidX Testing
|
||||
androidx-test-espresso = "3.5.1"
|
||||
androidx-test-core = "1.5.0"
|
||||
androidx-test-junit = "1.1.5"
|
||||
androidx-test-runner = "1.5.2"
|
||||
androidx-test-work = "2.7.1"
|
||||
|
||||
# Third Party Testing
|
||||
junit = "4.13.2"
|
||||
mockito = "5.10.0"
|
||||
robolectric = "4.11.1"
|
||||
|
||||
# Miscellaneous Gradle plugins
|
||||
gradle-download-task = "5.5.0"
|
||||
protobuf-gradle = "0.9.4"
|
||||
python-envs = "0.0.31"
|
||||
|
||||
[libraries]
|
||||
# AGP
|
||||
tools-android-plugin = { group = "com.android.tools.build", name = "gradle", version.ref = "android-plugin" }
|
||||
|
||||
# Google
|
||||
protobuf = { group = "com.google.protobuf", name = "protobuf-javalite", version.ref = "protobuf" }
|
||||
protoc = { group = "com.google.protobuf", name = "protoc", version.ref = "protobuf" }
|
||||
|
||||
# Kotlin
|
||||
kotlin-gradle-plugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin-compiler" }
|
||||
kotlinx-coroutines = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "kotlinx-coroutines" }
|
||||
|
||||
# Mozilla
|
||||
mozilla-concept-fetch = { group = "org.mozilla.components", name = "concept-fetch", version.ref = "android-components" }
|
||||
mozilla-glean = { group = "org.mozilla.telemetry", name = "glean", version.ref = "glean" }
|
||||
mozilla-glean-gradle-plugin = { group = "org.mozilla.telemetry", name = "glean-gradle-plugin", version.ref = "glean" }
|
||||
mozilla-glean-native-tests = { group = "org.mozilla.telemetry", name = "glean-native-forUnitTests", version.ref = "glean" }
|
||||
mozilla-rust-android-gradle = { group = "org.mozilla.rust-android-gradle", name = "plugin", version.ref = "rust-android-gradle" }
|
||||
|
||||
# AndroidX
|
||||
androidx-annotation = { group = "androidx.annotation", name = "annotation", version.ref = "androidx-annotation" }
|
||||
androidx-core = { group = "androidx.core", name = "core-ktx", version.ref = "androidx-core" }
|
||||
|
||||
# JNA
|
||||
jna = { group = "net.java.dev.jna", name = "jna", version.ref = "jna" }
|
||||
|
||||
# Linting and Static Analysis
|
||||
ktlint = { module = "com.pinterest:ktlint", version.ref = "ktlint" }
|
||||
|
||||
# AndroidX Testing
|
||||
test-core = { group = "androidx.test", name = "core-ktx", version.ref = "androidx-test-core" }
|
||||
test-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "androidx-test-espresso" }
|
||||
test-junit-ext = { group = "androidx.test.ext", name = "junit-ktx", version.ref = "androidx-test-junit" }
|
||||
test-runner = { group = "androidx.test", name = "runner", version.ref = "androidx-test-runner" }
|
||||
test-work = { group = "androidx.work", name = "work-testing", version.ref = "androidx-test-work" }
|
||||
|
||||
# Third Party Testing
|
||||
junit = { group = "junit", name = "junit", version.ref = "junit" }
|
||||
mockito = { group = "org.mockito", name = "mockito-core", version.ref = "mockito" }
|
||||
robolectric = { group = "org.robolectric", name = "robolectric", version.ref = "robolectric" }
|
||||
|
||||
[plugins]
|
||||
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
|
||||
gradle-download-task = { id = "de.undercouch.download", version.ref = "gradle-download-task" }
|
||||
gradle-python-envs = { id = "com.jetbrains.python.envs", version.ref = "python-envs" }
|
||||
kotlin-dsl = { id = "org.gradle.kotlin.kotlin-dsl", version.ref = "kotlin-dsl"}
|
||||
protobuf-gradle = { id = "com.google.protobuf", version.ref = "protobuf-gradle" }
|
|
@ -83,7 +83,12 @@ cargo {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
jnaForTest "net.java.dev.jna:jna:$jna_version@jar"
|
||||
jnaForTest(libs.jna) {
|
||||
artifact {
|
||||
extension ="jar"
|
||||
type = "jar"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
|
|
|
@ -237,12 +237,22 @@ ext.dependsOnTheMegazord = {
|
|||
}
|
||||
}
|
||||
// Depend on the megazord and its support library, as well as the
|
||||
// above-mentione JNA stuff for testing.
|
||||
// above-mentioned JNA stuff for testing.
|
||||
dependencies {
|
||||
api project(":full-megazord")
|
||||
implementation project(":native-support")
|
||||
jnaForTest "net.java.dev.jna:jna:$jna_version@jar"
|
||||
implementation "net.java.dev.jna:jna:$jna_version@aar"
|
||||
jnaForTest(libs.jna) {
|
||||
artifact {
|
||||
extension ="jar"
|
||||
type = "jar"
|
||||
}
|
||||
}
|
||||
implementation(libs.jna) {
|
||||
artifact {
|
||||
extension ="aar"
|
||||
type = "aar"
|
||||
}
|
||||
}
|
||||
// For reasons unknown, resolving the jnaForTest configuration directly
|
||||
// trips a nasty issue with the Android-Gradle plugin 3.2.1, like `Cannot
|
||||
// change attributes of configuration ':PROJECT:kapt' after it has been
|
||||
|
|
|
@ -7,7 +7,7 @@ plugins {
|
|||
id 'groovy'
|
||||
id 'maven-publish'
|
||||
id 'groovy-gradle-plugin'
|
||||
id "org.gradle.kotlin.kotlin-dsl" version "4.2.1"
|
||||
alias libs.plugins.kotlin.dsl
|
||||
}
|
||||
|
||||
gradlePlugin {
|
||||
|
|
Загрузка…
Ссылка в новой задаче