Skip to content

Commit

Permalink
Fixed native libraries not aggregating on main (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
gmazzo authored Nov 5, 2024
1 parent 3d32178 commit a0de2da
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions demo/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ android {
}

dependencies {
implementation(libs.androidx.camera)
implementation(libs.androidx.workManager)
debugImplementation(libs.leakCanary)
releaseImplementation(libs.google.services.maps)
Expand Down
9 changes: 8 additions & 1 deletion demo/src/main/AndroidManifest.lock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ main:
libraries:
- org.apache.http.legacy:
required: false
nativeLibraries:
- androidx.camera:camera-core:
libimage_processing_util_jni:
- arm64-v8a
- armeabi-v7a
- x86
- x86_64
exports:
activity:
- io.github.gmazzo.android.manifest.lock.demo.MainActivity
Expand Down Expand Up @@ -57,4 +64,4 @@ variants:
- armeabi-v7a
- x86
- x86_64
fingerprint: 70ec9fae5d7435eed5f8f32954de4798
fingerprint: 7e6124de96d872c67dc09d85e314ac43
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ agp = "8.7.2"
kotlin-serialization-yaml = { module = "com.charleskorn.kaml:kaml", version = "0.62.2" }

# `demo` project dependencies
androidx-camera = { module = "androidx.camera:camera-core", version = "1.4.0" }
androidx-workManager = { module = "androidx.work:work-runtime-ktx", version = "2.9.0" }
firebase-crashlytics-ndk = { module = "com.google.firebase:firebase-crashlytics-ndk", version = "19.2.1" }
google-services-maps = { module = "com.google.android.gms:play-services-maps", version = "18.2.0" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ internal object ManifestLockFactory {
}
}
?.withoutEmpties(),
nativeLibraries = manifests.mapNotNull(Manifest::nativeLibraries).onlySame(),
)

private fun <Type> Sequence<Type?>.sameOrNull() = this
Expand All @@ -62,13 +63,14 @@ internal object ManifestLockFactory {
exports = m.exports.orEmpty()
.mapValues { (type, names) -> names - main.exports?.get(type).orEmpty() }
.withoutEmpties(),
nativeLibraries = m.nativeLibraries?.without(main.nativeLibraries),
)) {
emptyManifest -> null
else -> variant to reduced
}
}.toMap().takeUnless { it.isEmpty() }

private fun List<Manifest.Entry>.without(other: List<Manifest.Entry>?) = when (other) {
private fun <Type> List<Type>.without(other: List<Type>?) = when (other) {
null -> this
else -> this - other.toSet()
}.takeUnless { it.isEmpty() }
Expand Down

0 comments on commit a0de2da

Please # to comment.