summaryrefslogtreecommitdiffstats
path: root/build.gradle
diff options
context:
space:
mode:
Diffstat (limited to 'build.gradle')
-rw-r--r--build.gradle110
1 files changed, 88 insertions, 22 deletions
diff --git a/build.gradle b/build.gradle
index 336ebde839..cdd097f208 100644
--- a/build.gradle
+++ b/build.gradle
@@ -14,18 +14,37 @@ buildscript {
}
}
- ext.kotlin_version = '1.9.22'
+ ext {
+ detekt_plugin = Versions.detekt
+ python_envs_plugin = Versions.python_envs_plugin
+ ksp_plugin = Versions.ksp_plugin
+
+ // Used in mobile/android/fenix/app/build.gradle
+ protobuf_plugin = FenixVersions.protobuf_plugin
+ }
dependencies {
classpath 'org.mozilla.apilint:apilint:0.5.2'
- classpath 'com.android.tools.build:gradle:8.0.2'
+ classpath 'com.android.tools.build:gradle:8.0.2' // Bug 1881001 for using AC version
classpath 'org.apache.commons:commons-exec:1.3'
classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.25.0'
classpath 'org.tomlj:tomlj:1.1.0'
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
+ classpath ComponentsDependencies.tools_kotlingradle
+
+ // Used in mobile/android/fenix/app/build.gradle
+ classpath ComponentsDependencies.androidx_safeargs
+ classpath FenixDependencies.osslicenses_plugin
+ classpath FenixDependencies.tools_benchmarkgradle
+ classpath "org.mozilla.telemetry:glean-gradle-plugin:${Versions.mozilla_glean}"
+ classpath "${ApplicationServicesConfig.groupId}:tooling-nimbus-gradle:${ApplicationServicesConfig.version}"
}
}
+plugins {
+ id("io.gitlab.arturbosch.detekt").version("$detekt_plugin")
+ id("com.google.devtools.ksp").version("$ksp_plugin")
+}
+
def tryInt = { string ->
if (string == null) {
return string
@@ -60,7 +79,7 @@ allprojects {
topsrcdir = gradle.mozconfig.topsrcdir
topobjdir = gradle.mozconfig.topobjdir
- gleanVersion = "58.1.0"
+ gleanVersion = Versions.mozilla_glean
if (gleanVersion != getRustVersionFor("glean")) {
throw new StopExecutionException("Mismatched Glean version, expected: ${gleanVersion}," +
" found ${getRustVersionFor("glean")}")
@@ -347,11 +366,24 @@ afterEvaluate {
"-Xlint:-serial",
// Classfile, because javac has a bug with MethodParameters attributes
// with Java 7. https://bugs.openjdk.java.net/browse/JDK-8190452
- "-Xlint:-classfile",
- // Turn all remaining warnings into errors,
- // unless marked by @SuppressWarnings.
- "-Werror"]
+ "-Xlint:-classfile"]
+
+ // In GeckoView java projects only, turn all remaining warnings
+ // into errors unless marked by @SuppressWarnings.
+ def projectName = project.getName()
+ if (projectName.startsWith('geckoview')
+ || projectName == 'annotations'
+ || projectName == 'exoplayer2'
+ || projectName == 'messaging_example'
+ || projectName == 'port_messaging_example'
+ || projectName == 'test_runner'
+ ) {
+ options.compilerArgs += [
+ "-Werror"
+ ]
+ }
}
+
}
}
@@ -385,23 +417,57 @@ idea {
}
}
-subprojects {
- apply plugin: "com.diffplug.spotless"
-
- spotless {
- java {
- target project.fileTree(project.projectDir) {
- include '**/*.java'
- exclude '**/thirdparty/**'
+subprojects { project ->
+ // Perform spotless lint in GeckoView projects only.
+ def projectName = project.getName()
+ if (projectName.startsWith('geckoview')
+ || projectName == 'annotations'
+ || projectName == 'exoplayer2'
+ || projectName == 'messaging_example'
+ || projectName == 'port_messaging_example'
+ || projectName == 'test_runner'
+ ) {
+ apply plugin: "com.diffplug.spotless"
+
+ spotless {
+ java {
+ target project.fileTree(project.projectDir) {
+ include '**/*.java'
+ exclude '**/thirdparty/**'
+ }
+ googleJavaFormat('1.17.0')
+ }
+ kotlin {
+ target project.fileTree(project.projectDir) {
+ include '**/*.kt'
+ exclude '**/thirdparty/**'
+ }
+ ktlint('0.49.1')
}
- googleJavaFormat('1.17.0')
}
- kotlin {
- target project.fileTree(project.projectDir) {
- include '**/*.kt'
- exclude '**/thirdparty/**'
+ } else {
+ afterEvaluate {
+ // Set the source and target compatibility for non-GeckoView projects only.
+ if (it.hasProperty('android')) {
+ android {
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_17
+ targetCompatibility JavaVersion.VERSION_17
+ }
+ }
+ }
+ }
+ }
+
+ project.configurations.configureEach {
+ resolutionStrategy.capabilitiesResolution.withCapability("org.mozilla.telemetry:glean-native") {
+ def toBeSelected = candidates.find {
+ it.id instanceof ProjectComponentIdentifier && it.id.projectName.contains('geckoview')
+ }
+ if (toBeSelected != null) {
+ select(toBeSelected)
}
- ktlint('0.49.1')
+ because 'use GeckoView Glean instead of standalone Glean'
}
}
}