| import net.ltgt.gradle.errorprone.CheckSeverity |
| |
| apply plugin: 'com.android.library' |
| apply plugin: 'net.ltgt.errorprone' |
| apply plugin: 'com.vanniktech.maven.publish' |
| |
| android { |
| compileSdkVersion 29 |
| resourcePrefix 'lottie_' |
| |
| defaultConfig { |
| minSdkVersion 16 |
| targetSdkVersion 29 |
| } |
| lintOptions { |
| abortOnError true |
| textReport true |
| textOutput 'stdout' |
| } |
| compileOptions { |
| sourceCompatibility JavaVersion.VERSION_1_7 |
| targetCompatibility JavaVersion.VERSION_1_7 |
| } |
| testOptions { |
| unitTests { |
| includeAndroidResources = true |
| } |
| } |
| } |
| |
| mavenPublish { |
| targets { |
| uploadArchives { |
| repositoryUsername = project.hasProperty('SONATYPE_USERNAME') ? SONATYPE_USERNAME : "" |
| repositoryPassword = project.hasProperty('SONATYPE_PASSWORD') ? SONATYPE_PASSWORD : "" |
| } |
| } |
| } |
| |
| dependencies { |
| implementation "androidx.appcompat:appcompat:1.0.0" |
| // Do not upgrade to 2.0 because it will bring in Kotlin as a transitive dependency. |
| implementation("com.squareup.okio:okio:1.17.4") |
| |
| annotationProcessor "com.uber.nullaway:nullaway:0.7.5" |
| errorprone "com.google.errorprone:error_prone_core:2.3.2" |
| errorproneJavac "com.google.errorprone:javac:9+181-r4173-1" |
| |
| testImplementation "org.mockito:mockito-core:3.5.13" |
| testImplementation 'junit:junit:4.13.1' |
| testImplementation "org.robolectric:robolectric:4.4" |
| } |
| |
| task sourcesJar(type: Jar) { |
| from android.sourceSets.main.java.srcDirs |
| classifier = '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) |
| } |
| } |
| } |
| |
| // Re-enable this if releases are uploaded from CI. |
| //gradle.taskGraph.whenReady { taskGraph -> |
| // if (taskGraph.allTasks.any { it instanceof Sign }) { |
| // allprojects { ext."signing.keyId" = System.getenv("GRADLE_SIGNING_KEY_ID") } |
| // allprojects { ext."signing.secretKeyRingFile" = "~/.gnupg/secring.gpg" } |
| // allprojects { ext."signing.password" = System.getenv("GRADLE_SIGNING_PASSWORD") } |
| // } |
| //} |