diff --git a/android/build.gradle b/android/build.gradle index 73d24ff..5d8f5c4 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -50,37 +50,18 @@ static def findNodeModules(baseDir) { } basePath = basePath.getParent() } - throw new GradleException("jsiudp: Failed to find node_modules/ path!") -} - -def isNewArchitectureEnabled() { - return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true" + throw new GradleException("Failed to find node_modules/ path!") } apply plugin: "com.android.library" - -def appProject = rootProject.allprojects.find { it.plugins.hasPlugin('com.android.application') } - -if (isNewArchitectureEnabled()) { - apply plugin: "com.facebook.react" -} - -def getExtOrDefault(name) { - return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["JsiUdp_" + name] -} - -def getExtOrIntegerDefault(name) { - return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["JsiUdp_" + name]).toInteger() -} - def reactNativeArchitectures() { def value = project.getProperties().get("reactNativeArchitectures") return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"] } def nodeModules = findNodeModules(projectDir) -logger.warn("jsiudp: node_modules/ found at: ${nodeModules}") +logger.warn("node_modules/ found at: ${nodeModules}") def sourceBuild = false def defaultDir @@ -203,8 +184,8 @@ android { prefabPublishing true } prefab { - jsiudp { - headers "${project.buildDir}/headers/jsiudp/" + rnhnswlib { + headers "${project.buildDir}/headers/rnhnswlib/" } } } @@ -242,7 +223,7 @@ dependencies { implementation "com.facebook.react:react-native:+" if (REACT_NATIVE_VERSION < 71) { - logger.warn("jsiudp: Extracting files from AAR (pre RN 0.71)") + logger.warn("Extracting files from AAR (pre RN 0.71)") //noinspection GradleDynamicVersion extractHeaders("com.facebook.fbjni:fbjni:0.2.2:headers") //noinspection GradleDynamicVersion @@ -252,14 +233,14 @@ dependencies { if (!sourceBuild) { def rnAarMatcher = "**/react-native/**/*${buildType}.aar" if (REACT_NATIVE_VERSION < 69) { - logger.warn("jsiudp: aar state pre 69. match **/**/*.aar") + logger.warn("aar state pre 69. match **/**/*.aar") rnAarMatcher = "**/**/*.aar" } else if (REACT_NATIVE_VERSION >= 71) { - logger.warn("jsiudp: aar state post 70, do nothing") + logger.warn("aar state post 70, do nothing") return } def rnAAR = fileTree("${nodeModules}/react-native/android").matching({ it.include rnAarMatcher }).singleFile - logger.warn("jsiudp: Extracting JNI files (pre RN 0.71) ${rnAAR}") + logger.warn("Extracting JNI files (pre RN 0.71) ${rnAAR}") extractJNI(files(rnAAR)) } } @@ -325,7 +306,7 @@ if (ENABLE_PREFAB) { // Package all the cpp code in a flattened directory structure task prepareHeaders(type: Copy) { from fileTree('../cpp').filter { it.isFile() } - into "${project.buildDir}/headers/jsiudp/react-native-jsi-udp/" + into "${project.buildDir}/headers/rnhnswlib/react-native-hnswlib/" includeEmptyDirs = false } preBuild.dependsOn(prepareHeaders) diff --git a/android/cpp-adapter.cpp b/android/cpp-adapter.cpp index ab5bb42..d3310b8 100644 --- a/android/cpp-adapter.cpp +++ b/android/cpp-adapter.cpp @@ -6,7 +6,7 @@ extern "C" JNIEXPORT jdouble JNICALL -Java_com_hnswlib_HnswlibModule_nativeinstall(JNIEnv *env, jclass _, jlong jsiPtr, jobject jsCallInvokerHolder) { +Java_com_hnswlib_HnswlibModule_nativeInstall(JNIEnv *env, jclass _, jlong jsiPtr, jobject jsCallInvokerHolder) { auto runtime { reinterpret_cast(jsiPtr) }; auto jsCallInvoker { facebook::jni::alias_ref{ diff --git a/example/android/app/proguard-rules.pro b/example/android/app/proguard-rules.pro index 11b0257..a82ec3e 100644 --- a/example/android/app/proguard-rules.pro +++ b/example/android/app/proguard-rules.pro @@ -8,3 +8,5 @@ # http://developer.android.com/guide/developing/tools/proguard.html # Add any project specific keep options here: + +-keep class * { native ; }