| apply plugin: 'com.github.ben-manes.versions' |
| |
| buildscript { |
| ext.versions = [ |
| 'minSdk': 14, |
| 'compileSdk': 29, |
| 'errorProne': '2.3.1', |
| 'kotlin': '1.3.71', |
| ] |
| ext.deps = [ |
| assertj_core: 'org.assertj:assertj-core:3.9.1', |
| // We don't need the latest version of AndroidX (there are no bugs that impact what LeakCanary |
| // relies on), we're sticking a bit older because most apps will be using a more recent version |
| // and they'll automatically resolve to higher version without having to necessarily resort to a |
| // resolution strategy. |
| androidGradlePlugin: "com.android.tools.build:gradle:3.6.2", |
| androidx: [ |
| annotation: 'androidx.annotation:annotation:1.0.2', |
| core: 'androidx.core:core:1.0.1', |
| fragment: 'androidx.fragment:fragment:1.0.0', |
| test: [ |
| core: 'androidx.test:core:1.0.0', |
| espresso: 'androidx.test.espresso:espresso-core:3.1.0', |
| rules: 'androidx.test:rules:1.1.0', |
| runner: 'androidx.test:runner:1.1.0', |
| ], |
| ], |
| android_support: 'com.android.support:support-v4:28.0.0', |
| clikt: 'com.github.ajalt:clikt:2.3.0', |
| jline: 'jline:jline:2.14.6', |
| detekt: 'io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.6.0', |
| junit: 'junit:junit:4.12', |
| kotlin: [ |
| gradlePlugin: "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}", |
| stdlib: "org.jetbrains.kotlin:kotlin-stdlib:${versions.kotlin}", |
| reflect: "org.jetbrains.kotlin:kotlin-reflect:${versions.kotlin}" |
| ], |
| mockito: 'org.mockito:mockito-core:2.7.5', |
| mockito_kotlin: 'com.nhaarman:mockito-kotlin-kt1.1:1.5.0', |
| okio: 'com.squareup.okio:okio:2.2.2', |
| okio_1x: 'com.squareup.okio:okio:1.0.0', |
| robolectric: 'org.robolectric:robolectric:4.0-alpha-3', |
| ] |
| repositories { |
| google() |
| maven { url 'https://plugins.gradle.org/m2/' } |
| jcenter() |
| } |
| dependencies { |
| classpath deps.kotlin.gradlePlugin |
| classpath deps.androidGradlePlugin |
| classpath 'net.ltgt.gradle:gradle-errorprone-plugin:0.0.16' |
| classpath 'com.github.ben-manes:gradle-versions-plugin:0.20.0' |
| classpath "org.jetbrains.dokka:dokka-gradle-plugin:0.9.18" |
| classpath deps.detekt |
| } |
| } |
| |
| subprojects { |
| group = GROUP |
| version = VERSION_NAME |
| |
| repositories { |
| google() |
| // maven { |
| // url 'https://oss.sonatype.org/content/repositories/snapshots/' |
| // } |
| // mavenLocal() |
| jcenter() |
| } |
| |
| apply plugin: 'net.ltgt.errorprone' |
| apply plugin: 'org.jetbrains.dokka' |
| apply plugin: 'io.gitlab.arturbosch.detekt' |
| |
| dokka { |
| reportUndocumented = false |
| // BuildConfig files |
| packageOptions { |
| prefix = "com.squareup.leakcanary" |
| suppress = true |
| } |
| packageOptions { |
| prefix = "shark.internal" |
| suppress = true |
| } |
| packageOptions { |
| prefix = "leakcanary.internal" |
| suppress = true |
| } |
| outputFormat = 'gfm' |
| outputDirectory = "$rootDir/docs/api" |
| } |
| |
| tasks.withType(JavaCompile) { |
| options.compilerArgs += [ |
| '-Xlint:all', |
| '-Xlint:-serial', |
| '-Xlint:-deprecation', |
| // espresso-core classes say they're compiled with 51.0 but contain 52.0 attributes. |
| // warning: [classfile] MethodParameters attribute introduced in version 52.0 class files is ignored in version 51.0 class files |
| // '-Werror' |
| ] |
| } |
| |
| configurations.all { |
| resolutionStrategy { |
| eachDependency { details -> |
| // Force all the error-prone dependencies to use the same version. |
| if (details.requested.group == 'com.google.errorprone' && |
| details.requested.name.startsWith('error_prone_')) { |
| details.useVersion versions.errorProne |
| } |
| } |
| } |
| } |
| |
| tasks.withType(Test) { |
| testLogging { |
| exceptionFormat 'FULL' |
| showCauses true |
| showExceptions true |
| showStackTraces true |
| } |
| } |
| |
| detekt { |
| config = rootProject.files('detekt-config.yml') |
| parallel = true |
| reports { |
| xml.enabled = false |
| } |
| } |
| |
| afterEvaluate { |
| tasks.getByName('check').dependsOn 'detekt' |
| tasks.getByName('assemble').dependsOn installGitHooks |
| tasks.getByName('clean').dependsOn installGitHooks |
| } |
| |
| dependencies { |
| errorprone "com.google.errorprone:error_prone_core:${versions.errorProne}" |
| } |
| } |
| |
| //Copies git hooks from /hooks folder into .git; currently used to run Detekt during push |
| //Git hook installation |
| task installGitHooks(type: Copy) { |
| from new File(rootProject.rootDir, 'hooks') |
| into { new File(rootProject.rootDir, '.git/hooks') } |
| fileMode 0777 //Make files executable |
| } |