Skip to content

Commit e5e00d3

Browse files
authored
fix: duplicate dynamic libs by retaining the instance of the map (#160)
1 parent 4d5429f commit e5e00d3

File tree

1 file changed

+10
-7
lines changed
  • gradle-plugins/react/brownfield/src/main/kotlin/com/callstack/react/brownfield/processors

1 file changed

+10
-7
lines changed

gradle-plugins/react/brownfield/src/main/kotlin/com/callstack/react/brownfield/processors/JNILibsProcessor.kt

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,14 @@ class JNILibsProcessor : BaseProject() {
4444
it.dependsOn(copyTask)
4545

4646
it.doFirst {
47+
val existingJNILibs =
48+
listOf("arm64-v8a", "armeabi-v7a", "x86_64", "x86")
49+
.associateWith { mutableListOf<String>() }
50+
.toMutableMap()
51+
4752
for (archiveLibrary in aarLibraries) {
4853
val jniDir = archiveLibrary.getJniDir()
49-
processNestedLibs(jniDir.listFiles())
54+
processNestedLibs(jniDir.listFiles(), existingJNILibs)
5055
if (jniDir.exists()) {
5156
val filteredSourceSets = androidExtension.sourceSets.filter { sourceSet -> sourceSet.name == variant.name }
5257
filteredSourceSets.forEach { sourceSet -> sourceSet.jniLibs.srcDir(jniDir) }
@@ -86,12 +91,10 @@ class JNILibsProcessor : BaseProject() {
8691
}
8792
}
8893

89-
private fun processNestedLibs(files: Array<File>?) {
90-
val existingJNILibs =
91-
listOf("arm64-v8a", "armeabi-v7a", "x86_64", "x86")
92-
.associateWith { mutableListOf<String>() }
93-
.toMutableMap()
94-
94+
private fun processNestedLibs(
95+
files: Array<File>?,
96+
existingJNILibs: MutableMap<String, MutableList<String>>,
97+
) {
9598
files?.forEach { folder ->
9699
val libFiles = folder.listFiles() ?: return@forEach
97100
val libList = existingJNILibs[folder.name] ?: return@forEach

0 commit comments

Comments
 (0)