1 // Top-level build file where you can add configuration options common to all sub-projects/modules.
3 import org.mozilla.fenix.gradle.tasks.GithubDetailsTask
6 // This logic is duplicated in the allprojects block: I don't know how to fix that.
10 url "https://nightly.maven.mozilla.org/maven2"
12 // Improve performance: only check moz maven for mozilla deps.
13 includeGroupByRegex RepoMatching.mozilla
19 url "https://maven.mozilla.org/maven2"
21 // Improve performance: only check moz maven for mozilla deps.
22 includeGroupByRegex RepoMatching.mozilla
26 if (project.hasProperty("googleRepo")) {
29 allowInsecureProtocol true // Local Nexus in CI uses HTTP
30 url project.property("googleRepo")
35 // Improve performance: only check google maven for google deps.
36 includeGroupByRegex RepoMatching.androidx
37 includeGroupByRegex RepoMatching.comAndroid
38 includeGroupByRegex RepoMatching.comGoogle
43 if (project.hasProperty("centralRepo")) {
46 url project.property("centralRepo")
47 allowInsecureProtocol true // Local Nexus in CI uses HTTP
52 // Improve security: don't search deps with known repos.
53 excludeGroupByRegex RepoMatching.mozilla
54 excludeGroupByRegex RepoMatching.androidx
55 excludeGroupByRegex RepoMatching.comAndroid
62 classpath "org.mozilla.appservices:tooling-nimbus-gradle:${Versions.mozilla_appservices}"
64 classpath FenixDependencies.tools_androidgradle
65 classpath FenixDependencies.tools_kotlingradle
66 classpath FenixDependencies.tools_benchmarkgradle
67 classpath FenixDependencies.androidx_safeargs
68 classpath FenixDependencies.osslicenses_plugin
69 classpath "org.mozilla.telemetry:glean-gradle-plugin:${Versions.mozilla_glean}"
70 classpath "org.mozilla.appservices:tooling-nimbus-gradle:${Versions.mozilla_appservices}"
72 // NOTE: Do not place your application dependencies here; they belong
73 // in the individual module build.gradle files
78 id("io.gitlab.arturbosch.detekt").version("1.19.0")
82 // This logic is duplicated in the buildscript block: I don't know how to fix that.
85 name "Mozilla Nightly"
86 url "https://nightly.maven.mozilla.org/maven2"
88 // Improve performance: only check moz maven for mozilla deps.
89 includeGroupByRegex RepoMatching.mozilla
95 url "https://maven.mozilla.org/maven2"
97 // Improve performance: only check moz maven for mozilla deps.
98 includeGroupByRegex RepoMatching.mozilla
102 if (project.hasProperty("googleRepo")) {
105 url project.property("googleRepo")
106 allowInsecureProtocol true // Local Nexus in CI uses HTTP
111 // Improve performance: only check google maven for google deps.
112 includeGroupByRegex RepoMatching.androidx
113 includeGroupByRegex RepoMatching.comAndroid
114 includeGroupByRegex RepoMatching.comGoogle
119 if (project.hasProperty("centralRepo")) {
122 url project.property("centralRepo")
123 allowInsecureProtocol true // Local Nexus in CI uses HTTP
128 // Improve security: don't search deps with known repos.
129 excludeGroupByRegex RepoMatching.mozilla
130 excludeGroupByRegex RepoMatching.androidx
131 excludeGroupByRegex RepoMatching.comAndroid
137 tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
138 kotlinOptions.jvmTarget = "11"
139 kotlinOptions.allWarningsAsErrors = true
140 kotlinOptions.freeCompilerArgs += [
141 "-opt-in=kotlin.RequiresOptIn", "-Xjvm-default=all"
147 // Define a reusable task for updating the version in manifest.json for modules that package
148 // a web extension. We automate this to make sure we never forget to update the version, either
149 // in local development or for releases. In both cases, we want to make sure the latest version
150 // of all extensions (including their latest changes) are installed on first start-up.
151 ext.updateExtensionVersion = { task, extDir ->
154 include 'manifest.template.json'
155 rename { 'manifest.json' }
158 def values = ['version': rootProject.ext.config.componentsVersion.split("a|b")[0] + "." + new Date().format('MMddHHmmss')]
159 inputs.properties(values)
165 tasks.register('clean', Delete) {
166 delete rootProject.buildDir
170 input = files("$projectDir/app/src")
171 config = files("$projectDir/config/detekt.yml")
176 destination = file("$projectDir/build/reports/detekt.html")
187 tasks.withType(io.gitlab.arturbosch.detekt.Detekt).configureEach() {
191 exclude "**/androidTest/**"
192 exclude "**/build/**"
193 exclude "**/resources/**"
197 // Apply same path exclusions as for the main task
198 tasks.withType(io.gitlab.arturbosch.detekt.DetektCreateBaselineTask).configureEach() {
200 exclude "**/androidTest/**"
201 exclude "**/build/**"
202 exclude "**/resources/**"
211 ktlint("com.pinterest:ktlint:0.48.2") {
213 attribute(Bundling.BUNDLING_ATTRIBUTE, getObjects().named(Bundling, Bundling.EXTERNAL))
217 detekt project(":mozilla-detekt-rules")
218 detekt "io.gitlab.arturbosch.detekt:detekt-cli:${FenixVersions.detekt}"
221 tasks.register('ktlint', JavaExec) {
222 group = "verification"
223 description = "Check Kotlin code style."
224 classpath = configurations.ktlint
225 main = "com.pinterest.ktlint.Main"
226 args "app/src/**/*.kt", "!**/build/**/*.kt", "--baseline=ktlint-baseline.xml"
229 task ktlintFormat(type: JavaExec, group: "formatting") {
230 description = "Fix Kotlin code style deviations."
231 classpath = configurations.ktlint
232 mainClass.set("com.pinterest.ktlint.Main")
233 args "-F", "app/src/**/*.kt", "!**/build/**/*.kt", "--baseline=ktlint-baseline.xml"
236 tasks.withType(io.gitlab.arturbosch.detekt.Detekt.class).configureEach {
237 exclude("**/resources/**")
241 tasks.register("listRepositories") {
243 println "Repositories:"
244 project.repositories.each { println "Name: " + it.name + "; url: " + it.url }
248 tasks.register("githubTestDetails", GithubDetailsTask) {
249 text = "### [Unit Test Results Fenix]({reportsUrl}/test/testFenixDebugUnitTest/index.html)"
252 tasks.register("githubLintDetektDetails", GithubDetailsTask) {
253 text = "### [Detekt Results Fenix]({reportsUrl}/detekt.html)"
256 tasks.register("githubLintAndroidDetails", GithubDetailsTask) {
257 text = "### [Android Lint Results Fenix]({reportsUrl}/lint-results-debug.html)"