mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-11 13:11:01 +00:00
270 lines
9.0 KiB
Groovy
270 lines
9.0 KiB
Groovy
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
|
|
|
import org.mozilla.fenix.gradle.tasks.GithubDetailsTask
|
|
|
|
buildscript {
|
|
// This logic is duplicated in the allprojects block: I don't know how to fix that.
|
|
repositories {
|
|
maven {
|
|
name "Mozilla Nightly"
|
|
url "https://nightly.maven.mozilla.org/maven2"
|
|
content {
|
|
// Improve performance: only check moz maven for mozilla deps.
|
|
includeGroupByRegex RepoMatching.mozilla
|
|
}
|
|
}
|
|
|
|
maven {
|
|
name "Mozilla"
|
|
url "https://maven.mozilla.org/maven2"
|
|
content {
|
|
// Improve performance: only check moz maven for mozilla deps.
|
|
includeGroupByRegex RepoMatching.mozilla
|
|
}
|
|
}
|
|
|
|
if (project.hasProperty("googleRepo")) {
|
|
maven {
|
|
name "Google"
|
|
allowInsecureProtocol true // Local Nexus in CI uses HTTP
|
|
url project.property("googleRepo")
|
|
}
|
|
} else {
|
|
google() {
|
|
content {
|
|
// Improve performance: only check google maven for google deps.
|
|
includeGroupByRegex RepoMatching.androidx
|
|
includeGroupByRegex RepoMatching.comAndroid
|
|
includeGroupByRegex RepoMatching.comGoogle
|
|
}
|
|
}
|
|
}
|
|
|
|
if (project.hasProperty("centralRepo")) {
|
|
maven {
|
|
name "MavenCentral"
|
|
url project.property("centralRepo")
|
|
allowInsecureProtocol true // Local Nexus in CI uses HTTP
|
|
}
|
|
} else {
|
|
mavenCentral() {
|
|
content {
|
|
// Improve security: don't search deps with known repos.
|
|
excludeGroupByRegex RepoMatching.mozilla
|
|
excludeGroupByRegex RepoMatching.androidx
|
|
excludeGroupByRegex RepoMatching.comAndroid
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
classpath FenixDependencies.tools_androidgradle
|
|
classpath FenixDependencies.tools_kotlingradle
|
|
classpath FenixDependencies.tools_benchmarkgradle
|
|
classpath FenixDependencies.androidx_safeargs
|
|
classpath FenixDependencies.osslicenses_plugin
|
|
classpath "org.mozilla.telemetry:glean-gradle-plugin:${Versions.mozilla_glean}"
|
|
// NOTE: The Nimbus plugin needs to be refactored into a top-level plugin
|
|
// and consumed via includeBuild (using composite builds). This is a short-term
|
|
// workaround to consume the latest version of the Nimbus plugin matching the Focus version.
|
|
if (Config.readVersionFromFile().contains("a")) {
|
|
// Use the latest version of the plugin on the main branch (nightly).
|
|
classpath("org.mozilla.components:tooling-nimbus-gradle:latest.release")
|
|
} else {
|
|
// Use the latest version matching the major version of the branch (beta/release).
|
|
classpath("org.mozilla.components:tooling-nimbus-gradle") {
|
|
version {
|
|
strictly("${Config.majorVersion()}.+")
|
|
}
|
|
}
|
|
}
|
|
|
|
// 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.19.0")
|
|
}
|
|
|
|
allprojects {
|
|
// This logic is duplicated in the buildscript block: I don't know how to fix that.
|
|
repositories {
|
|
maven {
|
|
name "Mozilla Nightly"
|
|
url "https://nightly.maven.mozilla.org/maven2"
|
|
content {
|
|
// Improve performance: only check moz maven for mozilla deps.
|
|
includeGroupByRegex RepoMatching.mozilla
|
|
}
|
|
}
|
|
|
|
maven {
|
|
name "Mozilla"
|
|
url "https://maven.mozilla.org/maven2"
|
|
content {
|
|
// Improve performance: only check moz maven for mozilla deps.
|
|
includeGroupByRegex RepoMatching.mozilla
|
|
}
|
|
}
|
|
|
|
if (project.hasProperty("googleRepo")) {
|
|
maven {
|
|
name "Google"
|
|
url project.property("googleRepo")
|
|
allowInsecureProtocol true // Local Nexus in CI uses HTTP
|
|
}
|
|
} else {
|
|
google() {
|
|
content {
|
|
// Improve performance: only check google maven for google deps.
|
|
includeGroupByRegex RepoMatching.androidx
|
|
includeGroupByRegex RepoMatching.comAndroid
|
|
includeGroupByRegex RepoMatching.comGoogle
|
|
}
|
|
}
|
|
}
|
|
|
|
if (project.hasProperty("centralRepo")) {
|
|
maven {
|
|
name "MavenCentral"
|
|
url project.property("centralRepo")
|
|
allowInsecureProtocol true // Local Nexus in CI uses HTTP
|
|
}
|
|
} else {
|
|
mavenCentral() {
|
|
content {
|
|
// Improve security: don't search deps with known repos.
|
|
excludeGroupByRegex RepoMatching.mozilla
|
|
excludeGroupByRegex RepoMatching.androidx
|
|
excludeGroupByRegex RepoMatching.comAndroid
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
|
|
kotlinOptions.jvmTarget = "11"
|
|
kotlinOptions.allWarningsAsErrors = true
|
|
kotlinOptions.freeCompilerArgs += [
|
|
"-opt-in=kotlin.RequiresOptIn", "-Xjvm-default=all"
|
|
]
|
|
}
|
|
}
|
|
|
|
subprojects {
|
|
// Define a reusable task for updating the version in manifest.json for modules that package
|
|
// a web extension. We automate this to make sure we never forget to update the version, either
|
|
// in local development or for releases. In both cases, we want to make sure the latest version
|
|
// of all extensions (including their latest changes) are installed on first start-up.
|
|
ext.updateExtensionVersion = { task, extDir ->
|
|
configure(task) {
|
|
from extDir
|
|
include 'manifest.template.json'
|
|
rename { 'manifest.json' }
|
|
into extDir
|
|
|
|
def values = ['version': rootProject.ext.config.componentsVersion.split("a|b")[0] + "." + new Date().format('MMddHHmmss')]
|
|
inputs.properties(values)
|
|
expand(values)
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.register('clean', Delete) {
|
|
delete rootProject.buildDir
|
|
}
|
|
|
|
detekt {
|
|
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
|
|
}
|
|
txt {
|
|
enabled = false
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.withType(io.gitlab.arturbosch.detekt.Detekt).configureEach() {
|
|
autoCorrect = true
|
|
|
|
exclude "**/test/**"
|
|
exclude "**/androidTest/**"
|
|
exclude "**/build/**"
|
|
exclude "**/resources/**"
|
|
exclude "**/tmp/**"
|
|
}
|
|
|
|
// Apply same path exclusions as for the main task
|
|
tasks.withType(io.gitlab.arturbosch.detekt.DetektCreateBaselineTask).configureEach() {
|
|
exclude "**/test/**"
|
|
exclude "**/androidTest/**"
|
|
exclude "**/build/**"
|
|
exclude "**/resources/**"
|
|
exclude "**/tmp/**"
|
|
}
|
|
|
|
configurations {
|
|
ktlint
|
|
}
|
|
|
|
dependencies {
|
|
ktlint("com.pinterest:ktlint:0.48.2") {
|
|
attributes {
|
|
attribute(Bundling.BUNDLING_ATTRIBUTE, getObjects().named(Bundling, Bundling.EXTERNAL))
|
|
}
|
|
}
|
|
|
|
detekt project(":mozilla-detekt-rules")
|
|
detekt "io.gitlab.arturbosch.detekt:detekt-cli:${FenixVersions.detekt}"
|
|
}
|
|
|
|
tasks.register('ktlint', JavaExec) {
|
|
group = "verification"
|
|
description = "Check Kotlin code style."
|
|
classpath = configurations.ktlint
|
|
main = "com.pinterest.ktlint.Main"
|
|
args "app/src/**/*.kt", "!**/build/**/*.kt", "--baseline=ktlint-baseline.xml"
|
|
}
|
|
|
|
task ktlintFormat(type: JavaExec, group: "formatting") {
|
|
description = "Fix Kotlin code style deviations."
|
|
classpath = configurations.ktlint
|
|
mainClass.set("com.pinterest.ktlint.Main")
|
|
args "-F", "app/src/**/*.kt", "!**/build/**/*.kt", "--baseline=ktlint-baseline.xml"
|
|
}
|
|
|
|
tasks.withType(io.gitlab.arturbosch.detekt.Detekt.class).configureEach {
|
|
exclude("**/resources/**")
|
|
exclude("**/tmp/**")
|
|
}
|
|
|
|
tasks.register("listRepositories") {
|
|
doLast {
|
|
println "Repositories:"
|
|
project.repositories.each { println "Name: " + it.name + "; url: " + it.url }
|
|
}
|
|
}
|
|
|
|
tasks.register("githubTestDetails", GithubDetailsTask) {
|
|
text = "### [Unit Test Results Fenix]({reportsUrl}/test/testFenixDebugUnitTest/index.html)"
|
|
}
|
|
|
|
tasks.register("githubLintDetektDetails", GithubDetailsTask) {
|
|
text = "### [Detekt Results Fenix]({reportsUrl}/detekt.html)"
|
|
}
|
|
|
|
tasks.register("githubLintAndroidDetails", GithubDetailsTask) {
|
|
text = "### [Android Lint Results Fenix]({reportsUrl}/lint-results-debug.html)"
|
|
}
|