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"
19 classpath FocusDependencies.android_gradle_plugin
20 classpath FocusDependencies.kotlin_gradle_plugin
21 classpath "org.mozilla.telemetry:glean-gradle-plugin:${Versions.mozilla_glean}"
22 // NOTE: The Nimbus plugin needs to be refactored into a top-level plugin
23 // and consumed via includeBuild (using composite builds). This is a short-term
24 // workaround to consume the latest version of the Nimbus plugin matching the Focus version.
25 if (Config.readVersionFromFile().contains("a")) {
26 // Use the latest version of the plugin on the main branch (nightly).
27 classpath("org.mozilla.components:tooling-nimbus-gradle:latest.release")
29 // Use the latest version matching the major version of the branch (beta/release).
30 classpath("org.mozilla.components:tooling-nimbus-gradle") {
32 strictly("${Config.majorVersion()}.+")
37 // NOTE: Do not place your application dependencies here; they belong
38 // in the individual module build.gradle files
43 id "io.gitlab.arturbosch.detekt" version "1.19.0" // Variables in plugins {} aren't supported
47 buildUponDefaultConfig = true
48 input = files("$projectDir/app")
49 config = files("$projectDir/quality/detekt.yml")
50 baseline = file("$projectDir/quality/detekt-baseline.xml")
55 destination = file("$projectDir/build/reports/detekt.html")
65 url "https://nightly.maven.mozilla.org/maven2"
68 url "https://maven.mozilla.org/maven2"
74 // Define a reusable task for updating the version in manifest.json for modules that package
75 // a web extension. We automate this to make sure we never forget to update the version, either
76 // in local development or for releases. In both cases, we want to make sure the latest version
77 // of all extensions (including their latest changes) are installed on first start-up.
78 ext.updateExtensionVersion = { task, extDir ->
81 include 'manifest.template.json'
82 rename { 'manifest.json' }
85 def values = ['version': rootProject.ext.config.componentsVersion + "." + new Date().format('MMddHHmmss')]
86 inputs.properties(values)
92 task clean(type: Delete) {
93 delete rootProject.buildDir
102 ktlint("com.pinterest:ktlint:${FocusVersions.ktlint_version}") {
104 attribute(Bundling.BUNDLING_ATTRIBUTE, getObjects().named(Bundling, Bundling.EXTERNAL))
109 task ktlint(type: JavaExec, group: "verification") {
110 description = "Check Kotlin code style."
111 classpath = configurations.ktlint
112 main = "com.pinterest.ktlint.Main"
113 args "app/**/*.kt", "!**/build/**/*.kt", "buildSrc/**/*.kt"
117 task ktlintFormat(type: JavaExec, group: "formatting") {
118 description = "Fix Kotlin code style deviations."
119 classpath = configurations.ktlint
120 main = "com.pinterest.ktlint.Main"
121 args "-F", "app/**/*.kt", "!**/build/**/*.kt", "buildSrc/**/*.kt"
124 tasks.register("listRepositories") {
126 println "Repositories:"
127 project.repositories.each { println "Name: " + it.name + "; url: " + it.url }
131 tasks.register("githubTestDetails", GithubDetailsTask) {
132 text = "### [Unit Test Results]({reportsUrl}/test/testFocusDebugUnitTest/index.html)"
135 tasks.register("githubLintDetektDetails", GithubDetailsTask) {
136 text = "### [Detekt Results Focus]({reportsUrl}/detekt.html)"
139 tasks.register("githubLintAndroidDetails", GithubDetailsTask) {
140 text = "### [Android Lint Results Focus]({reportsUrl}/lint-results-debug.html)"