Bug 1822393 - enable Werror compiler args for geckoview dependencies. r=gl,geckoview...
[gecko.git] / mobile / android / focus-android / build.gradle
blob9ef5b98c5ef057c3d1266f57c797dd62c832ba00
1 import io.gitlab.arturbosch.detekt.Detekt
2 import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask
4 // Top-level build file where you can add configuration options common to all sub-projects/modules.
6 buildscript {
7     repositories {
8         if (!System.env.MOZ_AUTOMATION && gradle.mozconfig.substs.MOZ_ARTIFACT_BUILDS) {
9             mavenLocal()
10         }
12         google()
13         mavenCentral()
14         maven {
15             // We will always need this repository for retrieving stable dependencies (like Glean).
16             url "https://maven.mozilla.org/maven2"
17         }
18         maven {
19             url "https://nightly.maven.mozilla.org/maven2"
20         }
22         if (ExtraRepositories.mozillaStaging) {
23             maven {
24                 name "Mozilla Staging"
25                 url "https://maven-default.stage.mozaws.net/maven2"
26             }
27         }
28     }
30     dependencies {
31         classpath ComponentsDependencies.tools_androidgradle
32         classpath ComponentsDependencies.tools_kotlingradle
33         classpath FocusDependencies.osslicenses_plugin
34         classpath "org.mozilla.telemetry:glean-gradle-plugin:${Versions.mozilla_glean}"
35         classpath "${ApplicationServicesConfig.groupId}:tooling-nimbus-gradle:${ApplicationServicesConfig.version}"
37         // NOTE: Do not place your application dependencies here; they belong
38         // in the individual module build.gradle files
39     }
41     // Variables in plugins {} aren't directly supported. Hack around it by setting an
42     // intermediate variable which can pull from FocusDependenciesPlugin.kt and be used later.
43     ext {
44         detekt_plugin = Versions.detekt
45         python_envs_plugin = Versions.python_envs_plugin
46         ksp_plugin = Versions.ksp_plugin
47     }
50 plugins {
51     id "io.gitlab.arturbosch.detekt" version "$detekt_plugin"
52     id("com.google.devtools.ksp").version("$ksp_plugin")
55 detekt {
56     input = files("$projectDir/app")
57     config = files("$projectDir/quality/detekt.yml")
58     baseline = file("$projectDir/quality/detekt-baseline.xml")
60     reports {
61         html {
62             enabled = true
63             destination = file("$projectDir/build/reports/detekt.html")
64         }
65         xml {
66             enabled = false
67         }
68         txt {
69             enabled = false
70         }
71     }
74 tasks.withType(Detekt).configureEach() {
75     autoCorrect = true
77     exclude "**/test/**"
78     exclude "**/androidTest/**"
79     exclude "**/build/**"
80     exclude "**/resources/**"
81     exclude "**/tmp/**"
84 // Apply same path exclusions as for the main task
85 tasks.withType(DetektCreateBaselineTask).configureEach() {
86     exclude "**/test/**"
87     exclude "**/androidTest/**"
88     exclude "**/build/**"
89     exclude "**/resources/**"
90     exclude "**/tmp/**"
93 allprojects {
94     repositories {
95         if (!System.env.MOZ_AUTOMATION && gradle.mozconfig.substs.MOZ_ARTIFACT_BUILDS) {
96             mavenLocal()
97         }
99         google()
100         mavenCentral()
101         maven {
102             url "https://nightly.maven.mozilla.org/maven2"
103         }
104         maven {
105             url "https://maven.mozilla.org/maven2"
106         }
108         if (ExtraRepositories.mozillaStaging) {
109             maven {
110                 name "Mozilla Staging"
111                 url "https://maven-default.stage.mozaws.net/maven2"
112             }
113         }
114     }
117 subprojects {
118     afterEvaluate {
119         kotlin {
120             jvmToolchain(config.jvmTargetCompatibility)
121         }
122     }
125 tasks.register('clean', Delete) {
126     delete rootProject.layout.buildDirectory
130 configurations {
131     ktlint
134 dependencies {
135     ktlint("com.pinterest:ktlint:${Versions.ktlint}") {
136         attributes {
137             attribute(Bundling.BUNDLING_ATTRIBUTE, getObjects().named(Bundling, Bundling.EXTERNAL))
138         }
139     }
142 tasks.register('ktlint', JavaExec) {
143     description = "Check Kotlin code style."
144     classpath = configurations.ktlint
145     mainClass.set("com.pinterest.ktlint.Main")
146     args "app/**/*.kt", "!**/build/**/*.kt", "buildSrc/**/*.kt"
150 tasks.register('ktlintFormat', JavaExec) {
151     description = "Fix Kotlin code style deviations."
152     classpath = configurations.ktlint
153     mainClass.set("com.pinterest.ktlint.Main")
154     args "-F", "app/**/*.kt", "!**/build/**/*.kt", "buildSrc/**/*.kt"
155     jvmArgs("--add-opens", "java.base/java.lang=ALL-UNNAMED")
158 tasks.register("listRepositories") {
159     doLast {
160         println "Repositories:"
161         project.repositories.each { println "Name: " + it.name + "; url: " + it.url }
162    }