Skip to content

Commit

Permalink
Build Cleanup & Dependency Minimization
Browse files Browse the repository at this point in the history
[Additional Slack context](https://2dimensions.slack.com/archives/C03GXT15JKX/p1733267916478549).

After our discussions around `androidx.core:core-ktx`, I did some investigations and it turns out we don't need it at all at the library level. This allows users to use any version they want, without impacting their `targetSdk`.

This lead me down the path of wondering what other dependencies aren't necessary. So one by one I disabled them checking if it would break the build. In a couple instances I was able to go from a "bundle" dependency to only the exact sub-dependency required, e.g. `"androidx.test:core-ktx:1.6.1"` -> `androidx.test:runner`.

There's also a bit of other minor housekeeping as I was poking around in these files.

Diffs=
b90fd3019f Build Cleanup & Dependency Minimization (#8675)

Co-authored-by: Erik <[email protected]>
  • Loading branch information
ErikUggeldahl and ErikUggeldahl committed Dec 4, 2024
1 parent 837241c commit 4f70fd7
Show file tree
Hide file tree
Showing 15 changed files with 35 additions and 160 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ kotlin/src/main/jniLibs/*
kotlin/.cxx
# Notification of missing NDK
kotlin/src/main/cpp/rive_build_x86.log

# Kotlin 2.0 output
.kotlin/sessions
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9dfd01fb3a8853f666ffc0c02ed6869668a35432
b90fd3019f6c9d1f1692f2af60f6d762cac58aba
24 changes: 5 additions & 19 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ plugins {
id "org.jetbrains.kotlin.plugin.compose"
}


android {
compileSdk 35
namespace "app.rive.runtime.example"
Expand All @@ -18,9 +17,6 @@ android {
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary true
}
}

buildTypes {
Expand Down Expand Up @@ -69,30 +65,20 @@ android {

dependencies {
implementation "androidx.activity:activity-compose:1.9.3"
implementation "androidx.activity:activity-ktx:1.9.3"
implementation "androidx.appcompat:appcompat:1.7.0"
implementation "androidx.compose.material3:material3:1.3.1"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.constraintlayout:constraintlayout:2.2.0"
implementation "androidx.core:core-ktx:1.15.0"
implementation "androidx.compose.ui:ui-tooling-preview-android:$compose_version"
implementation "androidx.fragment:fragment-ktx:1.8.5"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.8.7"
implementation "androidx.startup:startup-runtime:1.2.0"
implementation "com.android.volley:volley:1.2.1"
implementation "com.google.android.material:material:1.12.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation fileTree(dir: "libs", include: ["*.jar"])

debugImplementation project(path: ":kotlin")
releaseImplementation project(path: ":kotlin")
//noinspection GradleDynamicVersion We explicitly want the latest version
previewImplementation "app.rive:rive-android:+"

testImplementation "junit:junit:4.13.2"
androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.7.5"
androidTestImplementation "androidx.test.espresso:espresso-core:3.6.1"
androidTestImplementation "androidx.test.ext:junit:1.2.1"
androidTestImplementation "androidx.test:runner:1.6.2"
androidTestImplementation project(path: ":kotlin")
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"

debugImplementation "com.squareup.leakcanary:leakcanary-android:2.14"
}
16 changes: 0 additions & 16 deletions app/src/test/java/app/rive/runtime/example/ExampleUnitTest.kt

This file was deleted.

4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ buildscript {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
classpath("org.jetbrains.dokka:dokka-gradle-plugin:${dokkaVersion}")
classpath("io.github.gradle-nexus:publish-plugin:1.3.0")
classpath("com.palantir.gradle.gitversion:gradle-git-version:3.0.0")
classpath "org.jetbrains.kotlin:compose-compiler-gradle-plugin:2.0.21"
classpath("com.palantir.gradle.gitversion:gradle-git-version:3.1.0")
classpath("org.jetbrains.kotlin:compose-compiler-gradle-plugin:2.0.21")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand Down
26 changes: 11 additions & 15 deletions compatibilitytest/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id "com.android.application"
id "org.jetbrains.kotlin.android"
}

android {
compileSdk 35
namespace 'app.rive.runtime.compatibilitytest'
ndkVersion '25.1.8937393'
namespace "app.rive.runtime.compatibilitytest"
ndkVersion "25.1.8937393"

defaultConfig {
applicationId "app.rive.runtime.compatibilitytest"
Expand Down Expand Up @@ -36,18 +36,14 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
jvmTarget = "1.8"
}
}

dependencies {
implementation 'androidx.core:core-ktx:1.15.0'
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'com.google.android.material:material:1.12.0'
implementation 'androidx.constraintlayout:constraintlayout:2.2.0'

implementation project(path: ':kotlin')
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
}
implementation "androidx.appcompat:appcompat:1.7.0"
implementation "androidx.constraintlayout:constraintlayout:2.2.0"
implementation "androidx.core:core-ktx:1.15.0"
implementation "com.google.android.material:material:1.12.0"
implementation project(path: ":kotlin")
}
21 changes: 0 additions & 21 deletions compatibilitytest/proguard-rules.pro

This file was deleted.

This file was deleted.

This file was deleted.

Binary file removed docs/images/android.gte.29.png
Binary file not shown.
Binary file removed docs/images/android.lt.29.png
Binary file not shown.
Binary file removed docs/images/editor.png
Binary file not shown.
42 changes: 11 additions & 31 deletions kotlin/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
apply plugin: "com.android.library"
apply plugin: "kotlin-android"
apply plugin: "org.jetbrains.dokka"
plugins {
id "com.android.library"
id "kotlin-android"
id "org.jetbrains.dokka"
}

android {
compileSdk 35
Expand Down Expand Up @@ -33,10 +35,6 @@ android {
}
}

testOptions {
unitTests.includeAndroidResources = true
}

dokkaGfm {
dokkaSourceSets {
named("main") {
Expand All @@ -48,34 +46,16 @@ android {
}
}

configurations.configureEach {
resolutionStrategy.force "junit:junit:4.13.2"
}

dependencies {
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.8.7"
implementation "androidx.startup:startup-runtime:1.2.0"
implementation "com.android.volley:volley:1.2.1"
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "androidx.core:core-ktx:1.15.0"
implementation "androidx.appcompat:appcompat:1.7.0"
// Required until minSdk >= 23
// https://github.com/KeepSafe/ReLinker?tab=readme-ov-file#who-needs-relinker
implementation "com.getkeepsafe.relinker:relinker:1.4.5"
implementation "androidx.startup:startup-runtime:1.2.0"

testImplementation "junit:junit:4.13.2"
testImplementation "androidx.test:core-ktx:1.6.1"

androidTestImplementation "androidx.test.ext:junit:1.2.1"
androidTestImplementation "androidx.test.espresso:espresso-core:3.6.1"
androidTestImplementation "androidx.test.ext:junit-ktx:1.2.1"
androidTestImplementation "androidx.test:runner:1.6.2"
}

// Commenting this out, this only really helps when you're doing local dev, but it means our git actions need abd!
// static def getDeviceAbi() {
// return "adb shell getprop ro.product.cpu.abi".execute().text.trim()
// }

// task buildJNI(type: Exec) {
// workingDir "../cpp"
// commandLine "./build.rive.for.sh", "-a", getDeviceAbi()
// }

apply from: "${rootProject.projectDir}/scripts/publish-module.gradle"
16 changes: 0 additions & 16 deletions kotlin/src/test/java/app/rive/runtime/kotlin/ExampleUnitTest.kt

This file was deleted.

3 changes: 2 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
rootProject.name = "rive-android"

include ':kotlin'
include ':app'
rootProject.name = "rive-android"
include ':compatibilitytest'

0 comments on commit 4f70fd7

Please sign in to comment.