Optimize gradle & Remove redundant .gitignore files (#1877)
Co-authored-by: Gabriel Peal <gpeal@users.noreply.github.com>
diff --git a/.gitignore b/.gitignore
index 1c82131..73d929a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -31,10 +31,9 @@
.DS_Store
-/build
+build
/captures
.externalNativeBuild
*auto-save*
credentials/*
secring.gpg
-*/build
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index 9e2ae6a..114c699 100644
--- a/build.gradle
+++ b/build.gradle
@@ -2,9 +2,23 @@
buildscript {
ext {
- composeVersion = '1.0.1'
+ coroutinesVersion = '1.5.1'
+ coreVersion = '1.6.0'
+ appcompatVersion = '1.3.1'
+ activityVersion = '1.3.1'
+ lifecycleVersion = '2.3.1'
+ composeVersion = '1.0.2'
kotlinVersion = '1.5.21'
daggerVersion = '2.38.1'
+ awsVersion = '2.8.3'
+ mockitoVersion = '3.12.4'
+ robolectricVersion = '4.6.1'
+ retrofitVersion = '2.9.0'
+ materialVersion = '1.4.0'
+ epoxyVersion = '4.6.3'
+ junitVersion = '4.13.2'
+ extJunitVersion = '1.1.3'
+ espressoVersion = '3.3.0'
}
repositories {
@@ -13,7 +27,7 @@
}
dependencies {
classpath 'org.ajoberstar:grgit:2.3.0'
- classpath 'com.android.tools.build:gradle:7.0.1'
+ classpath 'com.android.tools.build:gradle:7.0.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "net.ltgt.gradle:gradle-errorprone-plugin:2.0.2"
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.17.0'
@@ -32,7 +46,7 @@
ext {
git = Grgit.open(currentDir: project.rootDir)
gitSha = git.head().id
- gitBranch = git.branch.getCurrent().name
+ gitBranch = git.branch.current().name
}
task clean(type: Delete) {
diff --git a/gradle.properties b/gradle.properties
index 9ccb37f..02bfbcc 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,22 +1,3 @@
-# Project-wide Gradle settings.
-
-# IDE (e.g. Android Studio) users:
-# Settings specified in this file will override any Gradle settings
-# configured through the IDE.
-
-# For more details on how to configure your build environment visit
-# http://www.gradle.org/docs/current/userguide/build_environment.html
-
-# Specifies the JVM arguments used for the daemon process.
-# The setting is particularly useful for tweaking memory settings.
-# Default value: -Xmx10248m -XX:MaxPermSize=256m
-# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
-
-# When configured, Gradle will run in incubating parallel mode.
-# This option should only be used with decoupled projects. More details, visit
-# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
-# org.gradle.parallel=true
-
VERSION_NAME=4.1.1-SNAPSHOT
GROUP=com.airbnb.android
@@ -32,9 +13,10 @@
POM_DEVELOPER_NAME=Airbnb
POM_DEVELOPER_EMAIL=lottie@airbnb.com
POM_INCEPTION_YEAR=2017
+
android.useAndroidX=true
android.enableJetifier=true
org.gradle.caching=true
-org.gradle.jvmargs=-Xmx4096m
+org.gradle.jvmargs=-Xmx4g -XX:+UseParallelGC -Dfile.encoding=UTF-8
org.gradle.daemon=true
org.gradle.parallel=true
diff --git a/issue-repro-compose/build.gradle b/issue-repro-compose/build.gradle
index e07705e..b1026b2 100755
--- a/issue-repro-compose/build.gradle
+++ b/issue-repro-compose/build.gradle
@@ -1,25 +1,24 @@
-apply plugin: 'com.android.application'
-apply plugin: 'kotlin-android'
+plugins {
+ id 'com.android.application'
+ id "kotlin-android"
+}
android {
- compileSdkVersion 30
+ compileSdk 30
defaultConfig {
applicationId "com.airbnb.lottie.issues.compose"
- minSdkVersion 21
- targetSdkVersion 30
+ minSdk 21
+ targetSdk 30
versionCode 1
versionName "1.0"
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
-
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
- jvmTarget = '1.8'
+ jvmTarget = JavaVersion.VERSION_1_8.toString()
}
-
buildFeatures {
compose true
}
@@ -30,8 +29,8 @@
dependencies {
implementation project(':lottie-compose')
- implementation 'androidx.appcompat:appcompat:1.3.1'
- implementation 'androidx.activity:activity-compose:1.3.1'
+ implementation "androidx.appcompat:appcompat:$appcompatVersion"
+ implementation "androidx.activity:activity-compose:$activityVersion"
implementation "androidx.compose.ui:ui:$composeVersion"
implementation "androidx.compose.material:material:$composeVersion"
implementation "androidx.compose.material:material-icons-extended:$composeVersion"
diff --git a/issue-repro/build.gradle b/issue-repro/build.gradle
index 63a525c..49772f0 100755
--- a/issue-repro/build.gradle
+++ b/issue-repro/build.gradle
@@ -1,17 +1,20 @@
-apply plugin: 'com.android.application'
-apply plugin: 'kotlin-android'
+plugins {
+ id 'com.android.application'
+}
android {
- compileSdkVersion 30
+ compileSdk 30
defaultConfig {
applicationId "com.airbnb.lottie.issues"
- minSdkVersion 16
- targetSdkVersion 30
+ minSdk 16
+ targetSdk 30
versionCode 1
versionName "1.0"
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
-
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
buildFeatures {
viewBinding true
}
@@ -19,5 +22,5 @@
dependencies {
implementation project(':lottie')
- implementation("androidx.appcompat:appcompat:1.3.1")
+ implementation "androidx.appcompat:appcompat:$appcompatVersion"
}
diff --git a/lottie-compose/.gitignore b/lottie-compose/.gitignore
deleted file mode 100644
index 42afabf..0000000
--- a/lottie-compose/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
\ No newline at end of file
diff --git a/lottie-compose/build.gradle b/lottie-compose/build.gradle
index b22600c..01ee4b1 100644
--- a/lottie-compose/build.gradle
+++ b/lottie-compose/build.gradle
@@ -5,16 +5,12 @@
}
android {
- compileSdkVersion 30
- buildToolsVersion "30.0.3"
-
+ compileSdk 30
defaultConfig {
- minSdkVersion 21
- targetSdkVersion 30
-
+ minSdk 21
+ targetSdk 30
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
-
buildTypes {
release {
minifyEnabled false
@@ -25,7 +21,7 @@
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
- jvmTarget = '1.8'
+ jvmTarget = JavaVersion.VERSION_1_8.toString()
freeCompilerArgs += [
"-Xallow-jvm-ir-dependencies",
"-Xskip-prerelease-check",
@@ -44,8 +40,11 @@
api project(':lottie')
implementation "androidx.compose.foundation:foundation:$composeVersion"
implementation "androidx.compose.ui:ui:$composeVersion"
- testImplementation 'org.robolectric:robolectric:4.6.1'
+
+ testImplementation "org.robolectric:robolectric:$robolectricVersion"
testImplementation 'androidx.collection:collection-ktx:1.1.0'
- testImplementation 'junit:junit:4.13.2'
- testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.5.1'
+ testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion"
+ testImplementation "junit:junit:$junitVersion"
+ androidTestImplementation "androidx.test.ext:junit:$extJunitVersion"
+ androidTestImplementation "androidx.test.espresso:espresso-core:$espressoVersion"
}
\ No newline at end of file
diff --git a/lottie/.gitignore b/lottie/.gitignore
deleted file mode 100644
index 796b96d..0000000
--- a/lottie/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
diff --git a/lottie/build.gradle b/lottie/build.gradle
index a523578..6fe0cf0 100644
--- a/lottie/build.gradle
+++ b/lottie/build.gradle
@@ -1,16 +1,18 @@
import net.ltgt.gradle.errorprone.CheckSeverity
-apply plugin: 'com.android.library'
-apply plugin: 'net.ltgt.errorprone'
-apply plugin: 'com.vanniktech.maven.publish'
+plugins {
+ id 'com.android.library'
+ id 'net.ltgt.errorprone'
+ id 'com.vanniktech.maven.publish'
+}
android {
- compileSdkVersion 29
resourcePrefix 'lottie_'
-
+ compileSdk 30
defaultConfig {
- minSdkVersion 16
- targetSdkVersion 29
+ minSdk 16
+ targetSdk 30
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lintOptions {
abortOnError true
@@ -18,8 +20,8 @@
textOutput 'stdout'
}
compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_7
- targetCompatibility JavaVersion.VERSION_1_7
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
}
testOptions {
unitTests {
@@ -29,22 +31,25 @@
}
dependencies {
- implementation "androidx.appcompat:appcompat:1.3.1"
+ 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"
errorproneJavac "com.google.errorprone:javac:9+181-r4173-1"
- testImplementation "org.mockito:mockito-core:3.12.2"
- testImplementation 'junit:junit:4.13.2'
- testImplementation "org.robolectric:robolectric:4.6.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
- classifier = 'sources'
+ archiveClassifier.set('sources')
}
task javadoc(type: Javadoc) {
@@ -80,12 +85,3 @@
}
}
}
-
-// 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") }
-// }
-//}
diff --git a/sample-compose/.gitignore b/sample-compose/.gitignore
deleted file mode 100644
index 42afabf..0000000
--- a/sample-compose/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
\ No newline at end of file
diff --git a/sample-compose/build.gradle b/sample-compose/build.gradle
index 1c77b05..0f3b5b7 100644
--- a/sample-compose/build.gradle
+++ b/sample-compose/build.gradle
@@ -1,23 +1,18 @@
plugins {
id 'com.android.application'
- id 'kotlin-android'
+ id "kotlin-android"
id 'kotlin-kapt'
}
android {
- compileSdkVersion 30
- buildToolsVersion "30.0.3"
-
+ compileSdk 30
defaultConfig {
applicationId "com.airbnb.lottie.sample.compose"
- minSdkVersion 21
- targetSdkVersion 30
+ minSdk 21
+ targetSdk 30
versionCode 1
versionName VERSION_NAME
-
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
-
buildTypes {
release {
minifyEnabled false
@@ -28,7 +23,7 @@
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
- jvmTarget = '1.8'
+ jvmTarget = JavaVersion.VERSION_1_8.toString()
freeCompilerArgs += [
"-Xallow-jvm-ir-dependencies",
"-Xskip-prerelease-check",
@@ -53,35 +48,28 @@
dependencies {
implementation project(':lottie-compose')
- implementation 'androidx.core:core-ktx:1.6.0'
- implementation 'androidx.multidex:multidex:2.0.1'
- implementation 'androidx.activity:activity-ktx:1.3.1'
- implementation 'androidx.activity:activity-compose:1.3.1'
+ implementation "androidx.core:core-ktx:$coreVersion"
+ implementation "androidx.activity:activity-compose:$activityVersion"
implementation 'androidx.appcompat:appcompat:1.4.0-alpha03'
- implementation 'com.google.android.material:material:1.4.0'
+ implementation "com.google.android.material:material:$materialVersion"
implementation "androidx.compose.ui:ui:$composeVersion"
implementation "androidx.compose.material:material:$composeVersion"
implementation "androidx.compose.material:material-icons-extended:$composeVersion"
implementation "androidx.compose.ui:ui-tooling:$composeVersion"
implementation "androidx.navigation:navigation-compose:2.4.0-alpha04"
- implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
- implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
+ implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion"
implementation "androidx.navigation:navigation-ui-ktx:2.3.5"
- implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.1'
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion"
implementation "com.google.dagger:dagger:$daggerVersion"
kapt "com.google.dagger:dagger-compiler:$daggerVersion"
- implementation 'com.squareup.retrofit2:retrofit:2.9.0'
- implementation 'com.squareup.retrofit2:converter-moshi:2.9.0'
+ implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
+ implementation "com.squareup.retrofit2:converter-moshi:$retrofitVersion"
implementation "com.google.accompanist:accompanist-coil:0.15.0"
- implementation "com.google.accompanist:accompanist-pager-indicators:0.17.0"
+ implementation "com.google.accompanist:accompanist-pager-indicators:0.18.0"
implementation 'com.airbnb.android:mavericks:2.3.0'
implementation 'com.airbnb.android:mavericks-compose:2.1.0-alpha02'
-
- testImplementation 'junit:junit:4.13.2'
- androidTestImplementation 'androidx.test.ext:junit:1.1.3'
- androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
diff --git a/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/LottieComposeApplication.kt b/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/LottieComposeApplication.kt
index 6a302ea..4267cbd 100644
--- a/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/LottieComposeApplication.kt
+++ b/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/LottieComposeApplication.kt
@@ -1,12 +1,12 @@
package com.airbnb.lottie.sample.compose
-import androidx.multidex.MultiDexApplication
+import android.app.Application
import com.airbnb.lottie.L
import com.airbnb.lottie.sample.compose.dagger.ApplicationComponent
import com.airbnb.lottie.sample.compose.dagger.DaggerApplicationComponent
import com.airbnb.mvrx.Mavericks
-class LottieComposeApplication : MultiDexApplication() {
+class LottieComposeApplication : Application() {
lateinit var component: ApplicationComponent
override fun onCreate() {
diff --git a/sample/.gitignore b/sample/.gitignore
deleted file mode 100644
index 796b96d..0000000
--- a/sample/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
diff --git a/sample/build.gradle b/sample/build.gradle
index 07d817a..4126f50 100644
--- a/sample/build.gradle
+++ b/sample/build.gradle
@@ -1,29 +1,24 @@
-apply plugin: 'com.android.application'
-apply plugin: 'kotlin-android'
-apply plugin: 'kotlin-kapt'
-apply plugin: 'kotlin-parcelize'
-
-
-tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
- kotlinOptions {
- freeCompilerArgs += ["-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi"]
- }
+plugins {
+ id 'com.android.application'
+ id "kotlin-android"
+ id 'kotlin-kapt'
+ id 'kotlin-parcelize'
}
android {
- compileSdkVersion 30
+ compileSdk 30
defaultConfig {
applicationId "com.airbnb.lottie"
- minSdkVersion 16
- targetSdkVersion 30
+ minSdk 16
+ targetSdk 30
versionCode 69
versionName VERSION_NAME
multiDexEnabled true
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
buildConfigField("String", "BITRISE_GIT_BRANCH", "\"" + System.getenv("BITRISE_GIT_BRANCH") + "\"")
buildConfigField("String", "GIT_SHA", "\"" + gitSha + "\"")
buildConfigField("String", "GIT_BRANCH", "\"" + gitBranch + "\"")
vectorDrawables.useSupportLibrary = true
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildFeatures {
viewBinding true
@@ -53,7 +48,8 @@
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
- jvmTarget = "1.8"
+ jvmTarget = JavaVersion.VERSION_1_8.toString()
+ freeCompilerArgs += ["-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi"]
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
@@ -70,49 +66,41 @@
implementation project(':lottie')
implementation 'androidx.multidex:multidex:2.0.1'
- implementation "androidx.fragment:fragment-ktx:1.3.6"
- implementation "androidx.appcompat:appcompat:1.3.1"
+ implementation "androidx.appcompat:appcompat:$appcompatVersion"
implementation "androidx.recyclerview:recyclerview:1.2.1"
implementation "androidx.paging:paging-runtime-ktx:3.0.1"
implementation "androidx.cardview:cardview:1.0.0"
- implementation 'androidx.core:core-ktx:1.6.0'
+ implementation "androidx.core:core-ktx:$coreVersion"
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation "androidx.browser:browser:1.3.0"
- implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
- kapt "androidx.lifecycle:lifecycle-common-java8:2.3.1"
- implementation "com.google.android.material:material:1.4.0"
+ implementation "com.google.android.material:material:$materialVersion"
- implementation 'com.airbnb.android:epoxy:4.6.2'
- kapt 'com.airbnb.android:epoxy-processor:4.6.2'
+ implementation "com.airbnb.android:epoxy:$epoxyVersion"
+ kapt "com.airbnb.android:epoxy-processor:$epoxyVersion"
implementation 'com.airbnb.android:mvrx:1.5.1'
- implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
- implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
- implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.1'
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion"
implementation 'com.dlazaro66.qrcodereaderview:qrcodereaderview:2.0.2'
implementation 'com.github.PhilJay:MPAndroidChart:3.1.0'
- implementation 'com.amazonaws:aws-android-sdk-s3:2.8.3'
- implementation ('com.amazonaws:aws-android-sdk-mobile-client:2.8.3@aar') { transitive = true }
- implementation ('com.amazonaws:aws-android-sdk-auth-userpools:2.8.3@aar') { transitive = true }
+ implementation "com.amazonaws:aws-android-sdk-s3:$awsVersion"
+ implementation("com.amazonaws:aws-android-sdk-mobile-client:$awsVersion") { transitive = true }
+ implementation("com.amazonaws:aws-android-sdk-auth-userpools:$awsVersion") { transitive = true }
implementation 'com.google.code.gson:gson:2.8.8'
implementation 'com.squareup.okhttp3:okhttp:4.9.1'
- implementation 'com.squareup.retrofit2:retrofit:2.9.0'
- implementation 'com.squareup.retrofit2:adapter-rxjava2:2.9.0'
- implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
+ implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
+ implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion"
+ implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
implementation 'com.github.bumptech.glide:glide:4.12.0'
debugImplementation 'androidx.fragment:fragment-testing:1.3.6'
- testImplementation 'junit:junit:4.13.2'
-
+ testImplementation "junit:junit:$junitVersion"
+ androidTestImplementation "androidx.test.ext:junit:$extJunitVersion"
+ androidTestImplementation "androidx.test.espresso:espresso-core:$espressoVersion"
+ androidTestImplementation "androidx.test.espresso:espresso-idling-resource:$espressoVersion"
androidTestImplementation 'androidx.test:core:1.3.0'
- androidTestImplementation 'androidx.test.ext:junit:1.1.3'
- androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
- androidTestImplementation 'androidx.test.espresso:espresso-idling-resource:3.3.0'
androidTestImplementation 'androidx.test:rules:1.4.0'
- androidTestImplementation 'com.squareup.okhttp3:okhttp:4.9.1'
androidTestImplementation 'io.jsonwebtoken:jjwt:0.9.1'
- androidTestImplementation "org.mockito:mockito-android:3.12.2"
+ androidTestImplementation "org.mockito:mockito-android:$mockitoVersion"
androidTestImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
}