fenix/build.gradle
Michael Comella f0464b9e72
For #9644: restrict deps to specific repositories (#9649)
* For #9644: remove unnecessary leanplum maven repository.

The docs say it is [1] "only needed for Android SDK versions below 4.3.0".
That is API 18 and our min SDK is 21.

[1]: https://docs.leanplum.com/reference#android-setup

* For #9644: move buildscript block from :app to root project.

This will reduce the amount of duplication we need in specifying
restricted dependencies and centralize repository definitions. Since
we're a one project app, it shouldn't have a significant impact on
performance.

* For #9644: restrict dependencies following FFTV config.

However, there is a resolution error to be fixed in the next commit.

This is verbatim from FFTV except I removed the no-op "improve security
if code is refactored incorrectly" lines: these lines rarely changed and
I'm not that concerned. It might be better to simplify the
configuration.

Source:
  62a2fa680c/buildSrc/src/main/java/org/mozilla/gradle/Dependencies.kt (L7)
  62a2fa680c/build.gradle (L31)

* For #9644: restrict firebase deps to google repo.

This fixes the resolution error from the previous PR.
2020-04-15 10:54:36 -07:00

147 lines
4.8 KiB
Groovy

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
// This logic is duplicated in the allprojects block: I don't know how to fix that.
repositories {
maven {
url "https://nightly.maven.mozilla.org/maven2"
content {
// Improve performance: only check moz maven for mozilla deps.
includeGroupByRegex RepoMatching.mozilla
}
}
maven {
url "https://maven.mozilla.org/maven2"
content {
// Improve performance: only check moz maven for mozilla deps.
includeGroupByRegex RepoMatching.mozilla
}
}
google() {
content {
// Improve performance: only check google maven for mozilla deps.
includeGroupByRegex RepoMatching.androidx
includeGroupByRegex RepoMatching.comGoogleAndroid
includeGroupByRegex RepoMatching.comGoogleFirebase
includeGroupByRegex RepoMatching.comAndroid
}
}
jcenter() {
content {
// Improve security: don't search deps with known repos.
excludeGroupByRegex RepoMatching.mozilla
excludeGroupByRegex RepoMatching.androidx
excludeGroupByRegex RepoMatching.comGoogleAndroid
excludeGroupByRegex RepoMatching.comGoogleFirebase
excludeGroupByRegex RepoMatching.comAndroid
}
}
}
dependencies {
classpath Deps.tools_androidgradle
classpath Deps.tools_kotlingradle
classpath Deps.androidx_safeargs
classpath Deps.allopen
classpath Deps.osslicenses_plugin
classpath "org.mozilla.components:tooling-glean-gradle:${Versions.mozilla_android_components}"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
plugins {
id("io.gitlab.arturbosch.detekt").version("1.6.0")
}
allprojects {
// This logic is duplicated in the buildscript block: I don't know how to fix that.
repositories {
maven {
url "https://nightly.maven.mozilla.org/maven2"
content {
// Improve performance: only check moz maven for mozilla deps.
includeGroupByRegex RepoMatching.mozilla
}
}
maven {
url "https://maven.mozilla.org/maven2"
content {
// Improve performance: only check moz maven for mozilla deps.
includeGroupByRegex RepoMatching.mozilla
}
}
google() {
content {
// Improve performance: only check google maven for google deps.
includeGroupByRegex RepoMatching.androidx
includeGroupByRegex RepoMatching.comGoogleAndroid
includeGroupByRegex RepoMatching.comGoogleFirebase
includeGroupByRegex RepoMatching.comAndroid
}
}
jcenter() {
content {
// Improve security: don't search deps with known repos.
excludeGroupByRegex RepoMatching.mozilla
excludeGroupByRegex RepoMatching.androidx
excludeGroupByRegex RepoMatching.comGoogleAndroid
excludeGroupByRegex RepoMatching.comGoogleFirebase
excludeGroupByRegex RepoMatching.comAndroid
}
}
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.allWarningsAsErrors = true
kotlinOptions.freeCompilerArgs += ["-Xuse-experimental=kotlin.Experimental", "-Xskip-runtime-version-check"]
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
detekt {
// The version number is duplicated, please refer to plugins block for more details
version = "1.6.0"
input = files("$projectDir/app/src")
config = files("$projectDir/config/detekt.yml")
reports {
html {
enabled = true
destination = file("$projectDir/build/reports/detekt.html")
}
xml {
enabled = false
}
}
}
configurations {
ktlint
}
dependencies {
ktlint "com.pinterest:ktlint:0.34.2"
detekt project(":mozilla-detekt-rules")
detekt "io.gitlab.arturbosch.detekt:detekt-cli:${Versions.detekt}"
}
task ktlint(type: JavaExec, group: "verification") {
description = "Check Kotlin code style."
classpath = configurations.ktlint
main = "com.pinterest.ktlint.Main"
args "app/src/**/*.kt"
}
tasks.withType(io.gitlab.arturbosch.detekt.Detekt.class) {
exclude("**/resources/**")
exclude("**/test/**")
exclude("**/tmp/**")
}