2018-12-07 20:11:50 +00:00
|
|
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
|
|
|
|
2020-07-10 18:24:48 +00:00
|
|
|
import org.mozilla.fenix.gradle.tasks.GithubDetailsTask
|
|
|
|
|
2018-12-07 20:11:50 +00:00
|
|
|
buildscript {
|
2020-04-15 17:54:36 +00:00
|
|
|
// This logic is duplicated in the allprojects block: I don't know how to fix that.
|
2018-12-07 20:11:50 +00:00
|
|
|
repositories {
|
2020-04-15 17:54:36 +00:00
|
|
|
maven {
|
2020-05-13 16:36:48 +00:00
|
|
|
name "Mozilla Nightly"
|
2020-04-15 17:54:36 +00:00
|
|
|
url "https://nightly.maven.mozilla.org/maven2"
|
|
|
|
content {
|
|
|
|
// Improve performance: only check moz maven for mozilla deps.
|
|
|
|
includeGroupByRegex RepoMatching.mozilla
|
|
|
|
}
|
|
|
|
}
|
2021-02-09 16:06:03 +00:00
|
|
|
|
2020-04-15 17:54:36 +00:00
|
|
|
maven {
|
2020-05-13 16:36:48 +00:00
|
|
|
name "Mozilla"
|
2020-04-15 17:54:36 +00:00
|
|
|
url "https://maven.mozilla.org/maven2"
|
|
|
|
content {
|
|
|
|
// Improve performance: only check moz maven for mozilla deps.
|
|
|
|
includeGroupByRegex RepoMatching.mozilla
|
|
|
|
}
|
|
|
|
}
|
2021-02-09 16:06:03 +00:00
|
|
|
|
2020-05-13 16:36:48 +00:00
|
|
|
if (project.hasProperty("googleRepo")) {
|
|
|
|
maven {
|
|
|
|
name "Google"
|
|
|
|
url project.property("googleRepo")
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
google() {
|
|
|
|
content {
|
2020-10-02 22:29:56 +00:00
|
|
|
// Improve performance: only check google maven for google deps.
|
2020-05-13 16:36:48 +00:00
|
|
|
includeGroupByRegex RepoMatching.androidx
|
|
|
|
includeGroupByRegex RepoMatching.comGoogleAndroid
|
|
|
|
includeGroupByRegex RepoMatching.comGoogleFirebase
|
|
|
|
includeGroupByRegex RepoMatching.comAndroid
|
|
|
|
}
|
2020-04-15 17:54:36 +00:00
|
|
|
}
|
|
|
|
}
|
2020-05-13 16:36:48 +00:00
|
|
|
|
2021-02-09 16:06:03 +00:00
|
|
|
if (project.hasProperty("centralRepo")) {
|
|
|
|
maven {
|
|
|
|
name "MavenCentral"
|
|
|
|
url project.property("centralRepo")
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
mavenCentral() {
|
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-12-07 20:11:50 +00:00
|
|
|
}
|
2020-04-15 17:54:36 +00:00
|
|
|
|
2018-12-07 20:11:50 +00:00
|
|
|
dependencies {
|
2019-01-07 21:47:47 +00:00
|
|
|
classpath Deps.tools_androidgradle
|
|
|
|
classpath Deps.tools_kotlingradle
|
2019-02-08 18:35:48 +00:00
|
|
|
classpath Deps.androidx_safeargs
|
2019-02-20 02:10:17 +00:00
|
|
|
classpath Deps.allopen
|
2019-08-07 16:37:56 +00:00
|
|
|
classpath Deps.osslicenses_plugin
|
2018-12-07 20:11:50 +00:00
|
|
|
|
2020-04-15 17:54:36 +00:00
|
|
|
classpath "org.mozilla.components:tooling-glean-gradle:${Versions.mozilla_android_components}"
|
|
|
|
|
2018-12-07 20:11:50 +00:00
|
|
|
// NOTE: Do not place your application dependencies here; they belong
|
|
|
|
// in the individual module build.gradle files
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-30 16:29:45 +00:00
|
|
|
plugins {
|
2020-07-20 22:09:58 +00:00
|
|
|
id("io.gitlab.arturbosch.detekt").version("1.9.1")
|
2019-01-30 16:29:45 +00:00
|
|
|
}
|
|
|
|
|
2018-12-07 20:11:50 +00:00
|
|
|
allprojects {
|
2020-04-15 17:54:36 +00:00
|
|
|
// This logic is duplicated in the buildscript block: I don't know how to fix that.
|
2018-12-07 20:11:50 +00:00
|
|
|
repositories {
|
2019-01-15 18:47:38 +00:00
|
|
|
maven {
|
2020-05-13 16:36:48 +00:00
|
|
|
name "Mozilla Nightly"
|
2020-03-13 14:39:55 +00:00
|
|
|
url "https://nightly.maven.mozilla.org/maven2"
|
2020-04-15 17:54:36 +00:00
|
|
|
content {
|
|
|
|
// Improve performance: only check moz maven for mozilla deps.
|
|
|
|
includeGroupByRegex RepoMatching.mozilla
|
|
|
|
}
|
2019-01-15 18:47:38 +00:00
|
|
|
}
|
2021-02-09 16:06:03 +00:00
|
|
|
|
2019-01-07 21:47:47 +00:00
|
|
|
maven {
|
2020-05-13 16:36:48 +00:00
|
|
|
name "Mozilla"
|
2019-01-07 21:47:47 +00:00
|
|
|
url "https://maven.mozilla.org/maven2"
|
2020-04-15 17:54:36 +00:00
|
|
|
content {
|
|
|
|
// Improve performance: only check moz maven for mozilla deps.
|
|
|
|
includeGroupByRegex RepoMatching.mozilla
|
|
|
|
}
|
2019-01-07 21:47:47 +00:00
|
|
|
}
|
2021-02-09 16:06:03 +00:00
|
|
|
|
2020-05-13 16:36:48 +00:00
|
|
|
if (project.hasProperty("googleRepo")) {
|
|
|
|
maven {
|
|
|
|
name "Google"
|
|
|
|
url project.property("googleRepo")
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
google() {
|
|
|
|
content {
|
2020-10-02 22:29:56 +00:00
|
|
|
// Improve performance: only check google maven for google deps.
|
2020-05-13 16:36:48 +00:00
|
|
|
includeGroupByRegex RepoMatching.androidx
|
|
|
|
includeGroupByRegex RepoMatching.comGoogleAndroid
|
|
|
|
includeGroupByRegex RepoMatching.comGoogleFirebase
|
|
|
|
includeGroupByRegex RepoMatching.comAndroid
|
|
|
|
}
|
2020-04-15 17:54:36 +00:00
|
|
|
}
|
|
|
|
}
|
2021-02-09 16:06:03 +00:00
|
|
|
|
|
|
|
if (project.hasProperty("centralRepo")) {
|
|
|
|
maven {
|
|
|
|
name "MavenCentral"
|
|
|
|
url project.property("centralRepo")
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
mavenCentral() {
|
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-13 16:36:48 +00:00
|
|
|
if (project.hasProperty("jcenterRepo")) {
|
|
|
|
maven {
|
|
|
|
name "BintrayJCenter"
|
|
|
|
url project.property("jcenterRepo")
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
jcenter() {
|
|
|
|
content {
|
2021-02-09 17:15:18 +00:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// JCenter is going away. Please do not add any new dependencies here.
|
|
|
|
// https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
// Leanplum
|
|
|
|
// The docs mention a custom repository (repo.leanplum.com) that we may be able
|
|
|
|
// to switch to.
|
|
|
|
includeVersion("com.leanplum", "leanplum-core", "5.4.0")
|
|
|
|
includeVersion("com.leanplum", "leanplum-push", "5.4.0")
|
|
|
|
includeVersion("com.leanplum", "leanplum-fcm", "5.4.0")
|
|
|
|
|
|
|
|
// Used by Android Gradle Plugin
|
|
|
|
// Issue for publishing to maven central: https://youtrack.jetbrains.com/issue/IDEA-261387
|
|
|
|
// Related plugin issue: https://issuetracker.google.com/issues/179291081
|
|
|
|
// Other option: Update to Android Gradle Plugin 7+ (still in Alpha currently)
|
|
|
|
includeVersion("org.jetbrains.trove4j", "trove4j", "20160824")
|
|
|
|
|
|
|
|
// Used by detekt
|
|
|
|
// Issue for publishing to maven central: https://github.com/Kotlin/kotlinx.html/issues/173
|
|
|
|
// Related detekt issue: https://github.com/detekt/detekt/issues/3461
|
|
|
|
includeVersion("org.jetbrains.kotlinx", "kotlinx-html-jvm", "0.7.1")
|
|
|
|
includeVersion("org.jetbrains.kotlinx", "kotlinx-html-common", "0.7.1")
|
|
|
|
|
|
|
|
// Fastlane
|
|
|
|
// Doesn't seem to be available on Maven Central yet, and I couldn't find an issue for it
|
|
|
|
// https://github.com/fastlane/fastlane
|
|
|
|
includeVersion("tools.fastlane", "screengrab", "2.0.0")
|
|
|
|
// https://github.com/jraska/Falcon/issues/52
|
|
|
|
includeVersion("com.jraska", "falcon", "2.1.1")
|
2020-05-13 16:36:48 +00:00
|
|
|
}
|
2020-04-15 17:54:36 +00:00
|
|
|
}
|
2019-03-07 07:19:31 +00:00
|
|
|
}
|
2018-12-07 20:11:50 +00:00
|
|
|
}
|
2020-04-15 17:54:36 +00:00
|
|
|
|
2020-08-04 17:56:28 +00:00
|
|
|
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
|
2019-08-09 19:16:44 +00:00
|
|
|
kotlinOptions.jvmTarget = "1.8"
|
2019-08-07 21:00:53 +00:00
|
|
|
kotlinOptions.allWarningsAsErrors = true
|
2020-06-03 18:18:44 +00:00
|
|
|
kotlinOptions.freeCompilerArgs += [
|
2020-07-20 22:09:58 +00:00
|
|
|
"-Xuse-experimental=kotlin.Experimental"
|
2020-06-03 18:18:44 +00:00
|
|
|
]
|
2019-08-07 21:00:53 +00:00
|
|
|
}
|
2018-12-07 20:11:50 +00:00
|
|
|
}
|
|
|
|
|
2020-08-04 17:56:28 +00:00
|
|
|
tasks.register('clean', Delete) {
|
2018-12-07 20:11:50 +00:00
|
|
|
delete rootProject.buildDir
|
2019-01-15 18:47:38 +00:00
|
|
|
}
|
2019-01-30 16:29:45 +00:00
|
|
|
|
|
|
|
detekt {
|
|
|
|
// The version number is duplicated, please refer to plugins block for more details
|
2020-07-20 22:09:58 +00:00
|
|
|
version = "1.9.1"
|
2019-12-05 03:06:05 +00:00
|
|
|
input = files("$projectDir/app/src")
|
2019-01-30 16:29:45 +00:00
|
|
|
config = files("$projectDir/config/detekt.yml")
|
|
|
|
|
|
|
|
reports {
|
|
|
|
html {
|
|
|
|
enabled = true
|
|
|
|
destination = file("$projectDir/build/reports/detekt.html")
|
|
|
|
}
|
2019-08-21 17:52:09 +00:00
|
|
|
xml {
|
|
|
|
enabled = false
|
|
|
|
}
|
2019-01-30 16:29:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
configurations {
|
|
|
|
ktlint
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2019-08-09 19:16:44 +00:00
|
|
|
ktlint "com.pinterest:ktlint:0.34.2"
|
2019-12-31 16:46:22 +00:00
|
|
|
detekt project(":mozilla-detekt-rules")
|
|
|
|
detekt "io.gitlab.arturbosch.detekt:detekt-cli:${Versions.detekt}"
|
2019-01-30 16:29:45 +00:00
|
|
|
}
|
|
|
|
|
2020-08-04 17:56:28 +00:00
|
|
|
tasks.register('ktlint', JavaExec) {
|
|
|
|
group = "verification"
|
2019-01-30 16:29:45 +00:00
|
|
|
description = "Check Kotlin code style."
|
|
|
|
classpath = configurations.ktlint
|
2019-08-21 17:21:58 +00:00
|
|
|
main = "com.pinterest.ktlint.Main"
|
2019-12-05 03:06:05 +00:00
|
|
|
args "app/src/**/*.kt"
|
2019-05-29 13:19:17 +00:00
|
|
|
}
|
2020-04-01 22:42:46 +00:00
|
|
|
|
2020-08-04 17:56:28 +00:00
|
|
|
tasks.withType(io.gitlab.arturbosch.detekt.Detekt.class).configureEach {
|
2020-04-01 22:42:46 +00:00
|
|
|
exclude("**/resources/**")
|
|
|
|
exclude("**/tmp/**")
|
|
|
|
}
|
2020-05-13 16:36:48 +00:00
|
|
|
|
2020-07-10 18:24:48 +00:00
|
|
|
tasks.register("listRepositories") {
|
2020-05-13 16:36:48 +00:00
|
|
|
doLast {
|
|
|
|
println "Repositories:"
|
|
|
|
project.repositories.each { println "Name: " + it.name + "; url: " + it.url }
|
2020-08-04 17:56:28 +00:00
|
|
|
}
|
2020-05-13 16:36:48 +00:00
|
|
|
}
|
2020-07-10 18:24:48 +00:00
|
|
|
|
|
|
|
tasks.register("githubTestDetails", GithubDetailsTask) {
|
2020-08-07 22:39:06 +00:00
|
|
|
text = "### [Unit Test Results]({reportsUrl}/test/testDebugUnitTest/index.html)"
|
2020-07-10 18:24:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
tasks.register("githubLintDetektDetails", GithubDetailsTask) {
|
2020-08-07 22:39:06 +00:00
|
|
|
text = "### [Detekt Results]({reportsUrl}/detekt.html)"
|
2020-07-10 18:24:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
tasks.register("githubLintAndroidDetails", GithubDetailsTask) {
|
2020-08-10 19:35:39 +00:00
|
|
|
text = "### [Android Lint Results]({reportsUrl}/lint-results-debug.html)"
|
2020-07-10 18:24:48 +00:00
|
|
|
}
|