| import org.jetbrains.dokka.gradle.DokkaTask |
| |
| buildscript { |
| ext.versions = [ |
| 'minSdk' : 14, |
| 'compileSdk': 31, |
| ] |
| repositories { |
| google() |
| gradlePluginPortal() |
| mavenCentral() |
| } |
| dependencies { |
| classpath libs.kotlinPlugin |
| classpath libs.androidPlugin |
| classpath libs.dokkaPlugin |
| classpath libs.mavenPublishPlugin |
| classpath libs.detektPlugin |
| classpath libs.binaryCompatibilityValidatorPlugin |
| classpath libs.keeperPlugin |
| } |
| } |
| |
| // We use JetBrain's Kotlin Binary Compatibility Validator to track changes to our public binary |
| // APIs. |
| // When making a change that results in a public ABI change, the apiCheck task will fail. When this |
| // happens, run ./gradlew apiDump to generate updated *.api files, and add those to your commit. |
| // See https://github.com/Kotlin/binary-compatibility-validator |
| apply plugin: 'binary-compatibility-validator' |
| |
| apiValidation { |
| // Ignore all sample projects, since they're not part of our API. |
| ignoredProjects += ["leakcanary-android-sample"] |
| } |
| |
| subprojects { |
| group = GROUP |
| version = VERSION_NAME |
| |
| repositories { |
| google() |
| // maven { |
| // url 'https://oss.sonatype.org/content/repositories/snapshots/' |
| // } |
| // mavenLocal() |
| jcenter() |
| } |
| |
| apply plugin: 'io.gitlab.arturbosch.detekt' |
| |
| pluginManager.withPlugin("com.vanniktech.maven.publish") { |
| mavenPublish { |
| sonatypeHost = "S01" |
| } |
| apply plugin: 'org.jetbrains.dokka' |
| tasks.named("dokkaGfm", DokkaTask.class) { |
| outputDirectory = rootProject.file("docs/api") |
| dokkaSourceSets.configureEach { |
| reportUndocumented.set(false) |
| perPackageOption { |
| // will match all .internal packages and sub-packages |
| matchingRegex.set(".*\\.internal.*") |
| suppress.set(true) |
| } |
| perPackageOption { |
| // BuildConfig files |
| matchingRegex.set("com.squareup.leakcanary\\..*") |
| suppress.set(true) |
| } |
| skipDeprecated.set(true) |
| externalDocumentationLink { |
| url.set(new URL("https://square.github.io/okio/2.x/okio/")) |
| } |
| externalDocumentationLink { |
| url.set(new URL("https://square.github.io/moshi/1.x/moshi/")) |
| } |
| } |
| } |
| } |
| |
| tasks.withType(JavaCompile).configureEach { |
| 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' |
| ] |
| } |
| |
| tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { |
| kotlinOptions { |
| // Avoid warnings of using older stdlib version 1.3 than compiler version 1.4 |
| apiVersion = "1.3" |
| } |
| } |
| |
| tasks.withType(Test).configureEach { |
| testLogging { |
| exceptionFormat 'FULL' |
| showCauses true |
| showExceptions true |
| showStackTraces true |
| } |
| } |
| |
| detekt { |
| config = rootProject.files('detekt-config.yml') |
| parallel = true |
| reports { |
| xml.enabled = false |
| } |
| } |
| |
| pluginManager.withPlugin("java") { |
| tasks.named("check") { dependsOn("detekt") } |
| tasks.named("assemble") { dependsOn(rootProject.tasks.named("installGitHooks")) } |
| tasks.named("clean") { dependsOn(rootProject.tasks.named("installGitHooks")) } |
| } |
| } |
| |
| //Copies git hooks from /hooks folder into .git; currently used to run Detekt during push |
| //Git hook installation |
| tasks.register("installGitHooks", Copy) { |
| from new File(rootProject.rootDir, 'hooks') |
| into { new File(rootProject.rootDir, '.git/hooks') } |
| fileMode 0777 //Make files executable |
| } |