Skip to content

Commit 573ff02

Browse files
committed
Fix Kotlin compilation errors in build.gradle.kts
- add missing imports for java.util.zip.ZipEntry and ZipFile - add explicit type annotation ZipEntry to the lambda parameter - replace entry.isDirectory with !entry.name.endsWith("/") since ZipEntry has no isDirectory property
1 parent 209b7ee commit 573ff02

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

packages/react-native/ReactAndroid/build.gradle.kts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@ import com.facebook.react.internal.PrivateReactExtension
1010
import com.facebook.react.tasks.internal.*
1111
import com.facebook.react.tasks.internal.utils.*
1212
import de.undercouch.gradle.tasks.download.Download
13+
import java.io.File
1314
import java.nio.file.Paths
1415
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
1516
import org.gradle.kotlin.dsl.*
17+
import java.util.zip.ZipEntry
18+
import java.util.zip.ZipFile
1619

1720
plugins {
1821
id("maven-publish")
@@ -463,15 +466,15 @@ val prepareFbjni by
463466
headersOutputDir.mkdirs()
464467
libsOutputDir.mkdirs()
465468
// Extract only the fbjni headers from the AAR
466-
val zip = java.util.zip.ZipFile(inputAar)
469+
val zip = ZipFile(inputAar)
467470
try {
468-
zip.entries().asSequence().forEach { entry ->
471+
zip.entries().asSequence().forEach { entry: ZipEntry ->
469472
when {
470473
entry.name.startsWith("prefab/modules/fbjni/include/fbjni/") -> {
471474
// Extract headers
472475
val destFile = File(headersOutputDir, entry.name.removePrefix("prefab/modules/fbjni/include/"))
473476
destFile.parentFile.mkdirs()
474-
if (!entry.isDirectory) {
477+
if (!entry.name.endsWith("/")) {
475478
destFile.outputStream().use { output ->
476479
zip.getInputStream(entry).use { input ->
477480
input.copyTo(output)
@@ -483,7 +486,7 @@ val prepareFbjni by
483486
// Extract .so files to prefab_package directory
484487
val destFile = File(libsOutputDir, entry.name.substringAfter("android."))
485488
destFile.parentFile.mkdirs()
486-
if (!entry.isDirectory) {
489+
if (!entry.name.endsWith("/")) {
487490
destFile.outputStream().use { output ->
488491
zip.getInputStream(entry).use { input ->
489492
input.copyTo(output)

0 commit comments

Comments
 (0)