Skip to content

Commit

Permalink
Optimize gradle & Remove redundant .gitignore files (airbnb#1877)
Browse files Browse the repository at this point in the history
Co-authored-by: Gabriel Peal <[email protected]>
  • Loading branch information
Goooler and gpeal authored Sep 19, 2021
1 parent 12748d4 commit ea5cd72
Show file tree
Hide file tree
Showing 14 changed files with 113 additions and 149 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@


.DS_Store
/build
build
/captures
.externalNativeBuild
*auto-save*
credentials/*
secring.gpg
*/build
20 changes: 17 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,23 @@ import org.ajoberstar.grgit.Grgit

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 {
Expand All @@ -13,7 +27,7 @@ buildscript {
}
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'
Expand All @@ -32,7 +46,7 @@ allprojects {
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) {
Expand Down
22 changes: 2 additions & 20 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -32,9 +13,10 @@ POM_DEVELOPER_ID=airbnb
POM_DEVELOPER_NAME=Airbnb
POM_DEVELOPER_EMAIL[email protected]
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
21 changes: 10 additions & 11 deletions issue-repro-compose/build.gradle
Original file line number Diff line number Diff line change
@@ -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
}
Expand All @@ -30,8 +29,8 @@ android {

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"
Expand Down
19 changes: 11 additions & 8 deletions issue-repro/build.gradle
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
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
}
}

dependencies {
implementation project(':lottie')
implementation("androidx.appcompat:appcompat:1.3.1")
implementation "androidx.appcompat:appcompat:$appcompatVersion"
}
1 change: 0 additions & 1 deletion lottie-compose/.gitignore

This file was deleted.

21 changes: 10 additions & 11 deletions lottie-compose/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,12 @@ plugins {
}

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
Expand All @@ -25,7 +21,7 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
jvmTarget = JavaVersion.VERSION_1_8.toString()
freeCompilerArgs += [
"-Xallow-jvm-ir-dependencies",
"-Xskip-prerelease-check",
Expand All @@ -44,8 +40,11 @@ dependencies {
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"
}
1 change: 0 additions & 1 deletion lottie/.gitignore

This file was deleted.

42 changes: 19 additions & 23 deletions lottie/build.gradle
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
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
textReport true
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 {
Expand All @@ -29,22 +31,25 @@ android {
}

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) {
Expand Down Expand Up @@ -80,12 +85,3 @@ tasks.withType(JavaCompile) {
}
}
}

// 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") }
// }
//}
1 change: 0 additions & 1 deletion sample-compose/.gitignore

This file was deleted.

38 changes: 13 additions & 25 deletions sample-compose/build.gradle
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -28,7 +23,7 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
jvmTarget = JavaVersion.VERSION_1_8.toString()
freeCompilerArgs += [
"-Xallow-jvm-ir-dependencies",
"-Xskip-prerelease-check",
Expand All @@ -53,35 +48,28 @@ kapt {

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'
}
Loading

0 comments on commit ea5cd72

Please sign in to comment.