Skip to content

Commit

Permalink
Fix pack issues
Browse files Browse the repository at this point in the history
  • Loading branch information
takameyer committed Feb 1, 2024
1 parent 96a0e07 commit f07403c
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 12 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ yarn.lock
/android
/packages/realm/react-native/android/src/main/jni/core
/packages/realm/react-native/android/.cxx/
/packages/realm/build-android/
.idea
.gradle
local.properties
Expand Down Expand Up @@ -117,7 +116,6 @@ coverage/
/packages/realm/react-native/android/src/main/jniLibs/
/packages/realm/react-native/ios/lib/
/packages/realm/react-native/ios/input-files.xcfilelist
/packages/realm/react-native/shared/

# Wireit repo caches
.wireit
Expand Down
8 changes: 8 additions & 0 deletions packages/realm/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
react-native/android/src/main/jni/core
react-native/android/.cxx/
build-android/
react-native/android/src/main/java/io/realm/react/Version.java
react-native/android/src/main/jniLibs/
react-native/ios/lib/
react-native/ios/input-files.xcfilelist
react-native/shared/
2 changes: 1 addition & 1 deletion packages/realm/bindgen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ endif()

target_include_directories(realm-js PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src")

set(SDK_DIR ${PACKAGE_ROOT_DIR}/packages/realm)
set(SDK_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../)
set(BINDING_DIR ${SDK_DIR}/binding)

target_include_directories(realm-js PRIVATE "${BINDING_DIR}")
Expand Down
3 changes: 2 additions & 1 deletion packages/realm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"index.react-native.js",
"types.d.cts",
"react-native/android",
"!react-native/android/.cxx",
"react-native/ios/RealmReact",
"react-native/ios/output-files.xcfilelist",
"react-native/shared",
Expand Down Expand Up @@ -300,4 +301,4 @@
6
]
}
}
}
21 changes: 13 additions & 8 deletions packages/realm/react-native/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import org.apache.tools.ant.taskdefs.condition.Os
import java.nio.file.Paths

buildscript {
repositories {
Expand All @@ -12,24 +13,28 @@ buildscript {
}
apply plugin: 'com.android.library'

def getReactNativeDirectory() {
def reactNativeDirectory = file("${rootProject.projectDir}/../../../../node_modules/react-native")
if (reactNativeDirectory.exists()) {
return reactNativeDirectory
static def findReactNative(startDir) {
def curPath = startDir.toPath().normalize()
while (curPath) {
def nodeModules = Paths.get(curPath.toString(), "node_modules")
def reactNative = Paths.get(nodeModules.toString(), "react-native")
if (nodeModules.toFile().exists() && reactNative.toFile().exists()) {
return reactNative.toFile()
}
throw new GradleException(
"Unable to find the React Native directory"
)
curPath = curPath.getParent()
}
throw new GradleException("Unable to find the React Native directory")
}


def sanitizeFilePath(String filePath) {
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
filePath = filePath.replace(File.separatorChar, '/' as char)
}
return filePath
}

def REACT_NATIVE_ROOT_DIR = sanitizeFilePath(getReactNativeDirectory().path);
def REACT_NATIVE_ROOT_DIR = sanitizeFilePath(findReactNative(rootProject.projectDir).path);

def reactNativeArchitectures() {
def value = project.getProperties().get("reactNativeArchitectures")
Expand Down

0 comments on commit f07403c

Please sign in to comment.