Skip to content

Instantly share code, notes, and snippets.

@Slowhand0309
Created July 28, 2019 06:49
Show Gist options
  • Save Slowhand0309/bc5ce0fc1e08b326649f58bd451ef026 to your computer and use it in GitHub Desktop.
Save Slowhand0309/bc5ce0fc1e08b326649f58bd451ef026 to your computer and use it in GitHub Desktop.
[Gradle Tips] #Android #Gradle
// buildTypesに応じたgoogle-services.jsonをapp/.へコピー
gradle.taskGraph.beforeTask { Task task ->
if (task.name ==~ /process.*GoogleServices/) {
applicationVariants.all { variant ->
if (task.name ==~ /(?i)process${variant.name}GoogleServices/) {
copy {
from "src/${variant.name}"
into "."
include "google-services.json"
}
}
}
}
}
dependencies {
// Debug
[
"hyperion-core",
"hyperion-attr",
"hyperion-measurement",
"hyperion-disk",
"hyperion-crash",
"hyperion-shared-preferences"
].forEach {
debugImplementation("com.willowtreeapps.hyperion:$it:0.9.27") {
exclude group: 'com.android.support'
}
}
}
configurations {
ktlint
}
dependencies {
ktlint "com.github.shyiko:ktlint:0.29.0"
}
task ktlint(type: JavaExec, group: "verification") {
description = "Check Kotlin code style."
classpath = configurations.ktlint
main = "com.github.shyiko.ktlint.Main"
args "--android", "--color", "--reporter=plain", "--reporter=checkstyle,output=${buildDir}/reports/ktlint-results.xml", "src/**/*.kt"
ignoreExitValue true
}
check.dependsOn ktlint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment