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.
8 if (!System.env.MOZ_AUTOMATION && gradle.mozconfig.substs.MOZ_ARTIFACT_BUILDS) {
15 // We will always need this repository for retrieving stable dependencies (like Glean).
16 url "https://maven.mozilla.org/maven2"
19 url "https://nightly.maven.mozilla.org/maven2"
22 if (ExtraRepositories.mozillaStaging) {
24 name "Mozilla Staging"
25 url "https://maven-default.stage.mozaws.net/maven2"
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
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.
44 detekt_plugin = Versions.detekt
45 python_envs_plugin = Versions.python_envs_plugin
46 ksp_plugin = Versions.ksp_plugin
51 id "io.gitlab.arturbosch.detekt" version "$detekt_plugin"
52 id("com.google.devtools.ksp").version("$ksp_plugin")
56 input = files("$projectDir/app")
57 config = files("$projectDir/quality/detekt.yml")
58 baseline = file("$projectDir/quality/detekt-baseline.xml")
63 destination = file("$projectDir/build/reports/detekt.html")
74 tasks.withType(Detekt).configureEach() {
78 exclude "**/androidTest/**"
80 exclude "**/resources/**"
84 // Apply same path exclusions as for the main task
85 tasks.withType(DetektCreateBaselineTask).configureEach() {
87 exclude "**/androidTest/**"
89 exclude "**/resources/**"
95 if (!System.env.MOZ_AUTOMATION && gradle.mozconfig.substs.MOZ_ARTIFACT_BUILDS) {
102 url "https://nightly.maven.mozilla.org/maven2"
105 url "https://maven.mozilla.org/maven2"
108 if (ExtraRepositories.mozillaStaging) {
110 name "Mozilla Staging"
111 url "https://maven-default.stage.mozaws.net/maven2"
120 jvmToolchain(config.jvmTargetCompatibility)
125 tasks.register('clean', Delete) {
126 delete rootProject.layout.buildDirectory
135 ktlint("com.pinterest:ktlint:${Versions.ktlint}") {
137 attribute(Bundling.BUNDLING_ATTRIBUTE, getObjects().named(Bundling, Bundling.EXTERNAL))
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") {
160 println "Repositories:"
161 project.repositories.each { println "Name: " + it.name + "; url: " + it.url }