1 // Top-level build file where you can add configuration options common to all sub-projects/modules.
3 import org.mozilla.focus.gradle.tasks.GithubDetailsTask
10 // We will always need this repository for retrieving stable dependencies (like Glean).
11 url "https://maven.mozilla.org/maven2"
14 url "https://nightly.maven.mozilla.org/maven2"
17 if (ExtraRepositories.mozillaStaging) {
19 name "Mozilla Staging"
20 url "https://maven-default.stage.mozaws.net/maven2"
26 classpath FocusDependencies.android_gradle_plugin
27 classpath FocusDependencies.kotlin_gradle_plugin
28 classpath FocusDependencies.osslicenses_plugin
29 classpath "org.mozilla.telemetry:glean-gradle-plugin:${Versions.mozilla_glean}"
30 classpath "${ApplicationServicesConfig.groupId}:tooling-nimbus-gradle:${ApplicationServicesConfig.version}"
32 // NOTE: Do not place your application dependencies here; they belong
33 // in the individual module build.gradle files
36 // Variables in plugins {} aren't directly supported. Hack around it by setting an
37 // intermediate variable which can pull from FocusDependenciesPlugin.kt and be used later.
39 detekt_plugin = FocusVersions.detekt_version
40 python_envs_plugin = FocusVersions.python_envs_plugin_version
45 id "io.gitlab.arturbosch.detekt" version "$detekt_plugin"
49 input = files("$projectDir/app")
50 config = files("$projectDir/quality/detekt.yml")
51 baseline = file("$projectDir/quality/detekt-baseline.xml")
56 destination = file("$projectDir/build/reports/detekt.html")
67 tasks.withType(io.gitlab.arturbosch.detekt.Detekt).configureEach() {
71 exclude "**/androidTest/**"
73 exclude "**/resources/**"
77 // Apply same path exclusions as for the main task
78 tasks.withType(io.gitlab.arturbosch.detekt.DetektCreateBaselineTask).configureEach() {
80 exclude "**/androidTest/**"
82 exclude "**/resources/**"
91 url "https://nightly.maven.mozilla.org/maven2"
94 url "https://maven.mozilla.org/maven2"
97 if (ExtraRepositories.mozillaStaging) {
99 name "Mozilla Staging"
100 url "https://maven-default.stage.mozaws.net/maven2"
106 task clean(type: Delete) {
107 delete rootProject.buildDir
116 ktlint("com.pinterest:ktlint:${FocusVersions.ktlint_version}") {
118 attribute(Bundling.BUNDLING_ATTRIBUTE, getObjects().named(Bundling, Bundling.EXTERNAL))
123 task ktlint(type: JavaExec, group: "verification") {
124 description = "Check Kotlin code style."
125 classpath = configurations.ktlint
126 main = "com.pinterest.ktlint.Main"
127 args "app/**/*.kt", "!**/build/**/*.kt", "buildSrc/**/*.kt"
131 task ktlintFormat(type: JavaExec, group: "formatting") {
132 description = "Fix Kotlin code style deviations."
133 classpath = configurations.ktlint
134 mainClass.set("com.pinterest.ktlint.Main")
135 args "-F", "app/**/*.kt", "!**/build/**/*.kt", "buildSrc/**/*.kt"
138 tasks.register("listRepositories") {
140 println "Repositories:"
141 project.repositories.each { println "Name: " + it.name + "; url: " + it.url }
145 tasks.register("githubTestDetails", GithubDetailsTask) {
146 text = "### [Unit Test Results]({reportsUrl}/test/testFocusDebugUnitTest/index.html)"
149 tasks.register("githubLintDetektDetails", GithubDetailsTask) {
150 text = "### [Detekt Results Focus]({reportsUrl}/detekt.html)"
153 tasks.register("githubLintAndroidDetails", GithubDetailsTask) {
154 text = "### [Android Lint Results Focus]({reportsUrl}/lint-results-debug.html)"