Commit d762dea4 authored by Tiger Oakes's avatar Tiger Oakes Committed by Michael Comella
Browse files

Gradle configuration avoidance

parent 0413d3c9
......@@ -11,6 +11,7 @@ apply plugin: 'com.google.android.gms.oss-licenses-plugin'
import com.android.build.OutputFile
import groovy.json.JsonOutput
import org.gradle.internal.logging.text.StyledTextOutput.Style
import org.gradle.internal.logging.text.StyledTextOutputFactory
import org.mozilla.fenix.gradle.tasks.LintUnitTestRunner
......@@ -493,7 +494,7 @@ dependencies {
}
if (project.hasProperty("coverage")) {
tasks.withType(Test) {
tasks.withType(Test).configureEach {
jacoco.includeNoLocationClasses = true
}
......@@ -535,7 +536,7 @@ if (project.hasProperty("coverage")) {
// Task for printing APK information for the requested variant
// Usage: "./gradlew printVariants
// -------------------------------------------------------------------------------------------------
task printVariants {
tasks.register('printVariants') {
doLast {
def variants = android.applicationVariants.collect {[
apks: it.variantData.outputScope.apkDatas.collect {[
......@@ -554,11 +555,13 @@ task printVariants {
build_type: 'androidTest',
name: 'androidTest',
])
println 'variants: ' + groovy.json.JsonOutput.toJson(variants)
println 'variants: ' + JsonOutput.toJson(variants)
}
}
task buildTranslationArray {
// This isn't running as a task, instead the array is build when the gradle file is parsed.
// https://github.com/mozilla-mobile/fenix/issues/14175
def foundLocales = new StringBuilder()
foundLocales.append("new String[]{")
......@@ -575,12 +578,12 @@ task buildTranslationArray {
android.defaultConfig.buildConfigField "String[]", "SUPPORTED_LOCALE_ARRAY", foundLocalesString
}
task lintUnitTestRunner(type: LintUnitTestRunner)
tasks.register('lintUnitTestRunner', LintUnitTestRunner)
afterEvaluate {
// Format test output. Ported from AC #2401
tasks.matching {it instanceof Test}.all {
tasks.withType(Test).configureEach {
systemProperty "robolectric.logging", "stdout"
systemProperty "logging.test-mode", "true"
......@@ -668,5 +671,5 @@ tasks.register("updateCookiesExtensionVersion", Copy) { task ->
updateExtensionVersion(task, 'src/main/assets/extensions/cookies')
}
preBuild.dependsOn updateAdsExtensionVersion
preBuild.dependsOn updateCookiesExtensionVersion
preBuild.dependsOn "updateAdsExtensionVersion"
preBuild.dependsOn "updateCookiesExtensionVersion"
......@@ -129,7 +129,7 @@ allprojects {
}
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.allWarningsAsErrors = true
kotlinOptions.freeCompilerArgs += [
......@@ -138,7 +138,7 @@ allprojects {
}
}
task clean(type: Delete) {
tasks.register('clean', Delete) {
delete rootProject.buildDir
}
......@@ -169,14 +169,15 @@ dependencies {
detekt "io.gitlab.arturbosch.detekt:detekt-cli:${Versions.detekt}"
}
task ktlint(type: JavaExec, group: "verification") {
tasks.register('ktlint', 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) {
tasks.withType(io.gitlab.arturbosch.detekt.Detekt.class).configureEach {
exclude("**/resources/**")
exclude("**/test/**")
exclude("**/tmp/**")
......@@ -186,7 +187,7 @@ tasks.register("listRepositories") {
doLast {
println "Repositories:"
project.repositories.each { println "Name: " + it.name + "; url: " + it.url }
}
}
}
tasks.register("githubTestDetails", GithubDetailsTask) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment