blob: 8ba8dcfe7dd49a71c5a0f2285ace4bbaa71af4b3 [file] [log] [blame]
import net.ltgt.gradle.errorprone.CheckSeverity
plugins {
id 'com.android.library'
id 'net.ltgt.errorprone'
id 'com.vanniktech.maven.publish'
}
android {
resourcePrefix 'lottie_'
compileSdk 31
defaultConfig {
minSdk 16
targetSdk 30
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lintOptions {
abortOnError true
textReport true
textOutput 'stdout'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
testOptions {
unitTests {
includeAndroidResources = true
}
}
}
dependencies {
implementation "androidx.appcompat:appcompat:$appcompatVersion"
// Do not upgrade to 2.0 because it will bring in Kotlin as a transitive dependency.
//noinspection GradleDependency
implementation("com.squareup.okio:okio:1.17.4")
annotationProcessor "com.uber.nullaway:nullaway:0.9.2"
errorprone "com.google.errorprone:error_prone_core:2.9.0"
//noinspection GradleDynamicVersion
errorproneJavac "com.google.errorprone:javac:9+181-r4173-1"
testImplementation "org.mockito:mockito-core:$mockitoVersion"
testImplementation "org.robolectric:robolectric:$robolectricVersion"
testImplementation "junit:junit:$junitVersion"
androidTestImplementation "androidx.test.ext:junit:$extJunitVersion"
androidTestImplementation "androidx.test.espresso:espresso-core:$espressoVersion"
}
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
archiveClassifier.set('sources')
}
task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
configurations.implementation.setCanBeResolved(true)
classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) + configurations.implementation
}
tasks.withType(Javadoc) {
// This started failing with the following when upgrading to AGP 7 and JDK 11.
// TODO: investigate why once AGP 7 is stable.
// javadoc: error - The code being documented uses modules but the packages defined in https://developer.android.com/reference/ are in the unnamed module.
failOnError false
}
tasks.withType(JavaCompile) {
// remove the if condition if you want to run NullAway on test code
if (!name.toLowerCase().contains("test")) {
options.errorprone {
option("NullAway:AnnotatedPackages", "com.airbnb.lottie")
// TODO: enable these and fix errors one by one.
check("NullAway", CheckSeverity.OFF)
check("StringSplitter", CheckSeverity.OFF)
check("DefaultCharset", CheckSeverity.OFF)
check("HidingField", CheckSeverity.OFF)
check("NarrowingCompoundAssignment", CheckSeverity.OFF)
check("MissingOverride", CheckSeverity.OFF)
check("ReferenceEquality", CheckSeverity.OFF)
check("FallThrough", CheckSeverity.OFF)
check("FloatingPointLiteralPrecision", CheckSeverity.OFF)
check("MissingCasesInEnumSwitch", CheckSeverity.OFF)
check("OperatorPrecedence", CheckSeverity.OFF)
// Disabled checks
check("MixedMutabilityReturnType", CheckSeverity.OFF)
check("MissingSummary", CheckSeverity.OFF)
check("InlineMeSuggester", CheckSeverity.OFF)
}
}
}