blob: c02c429912550317eaa4222e072b378f7f702916 [file] [log] [blame] [edit]
import com.vanniktech.maven.publish.SonatypeHost
import net.ltgt.gradle.errorprone.CheckSeverity
plugins {
id 'com.android.library'
id 'net.ltgt.errorprone'
id 'com.vanniktech.maven.publish'
}
android {
namespace 'com.airbnb.lottie'
resourcePrefix 'lottie_'
compileSdk 33
defaultConfig {
minSdk 16
targetSdk 33
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lintOptions {
abortOnError true
textReport true
textOutput 'stdout'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
testOptions {
unitTests {
includeAndroidResources = true
}
}
}
mavenPublishing {
publishToMavenCentral(SonatypeHost.DEFAULT)
signAllPublications()
}
dependencies {
implementation libs.androidx.appcompat
// Do not upgrade to 2.0 because it will bring in Kotlin as a transitive dependency.
//noinspection GradleDependency
implementation libs.okio
annotationProcessor libs.nullaway
errorprone libs.errorprone.core
errorproneJavac libs.errorprone.javac
testImplementation libs.mockito.core
testImplementation libs.robolectric
testImplementation libs.junit4
androidTestImplementation libs.androidx.test.junit
androidTestImplementation libs.androidx.test.espresso
}
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)
}
}
}