Skip to content

Commit

Permalink
fix: work-around long path issues on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
dwgray committed Apr 9, 2024
1 parent 4e07cf6 commit ff0fb47
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
diff --git a/android/build.gradle b/android/build.gradle
index 88ea6a5b7b32dca55eeedc5b4bf255157742abdf..5b7268df98a16ae82db3765ee788af9985d28887 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -72,6 +72,20 @@ static def findNodeModules(baseDir) {

def nodeModules = findNodeModules(projectDir)

+static def findTools(baseDir) {
+ def basePath = baseDir.toPath().normalize()
+ while (basePath) {
+ def toolsPath = Paths.get(basePath.toString(), "tools")
+ if (toolsPath.toFile().exists()) {
+ return toolsPath.toString()
+ }
+ basePath = basePath.getParent()
+ }
+ throw new GradleException("react-native-vision-camera: Failed to find tools/ path!")
+}
+
+def toolsDir = findTools(projectDir)
+
def hasWorklets = !safeExtGetBool('VisionCamera_disableFrameProcessors', false) && findProject(":react-native-worklets-core") != null
logger.warn("[VisionCamera] react-native-worklets-core ${hasWorklets ? "found" : "not found"}, Frame Processors ${hasWorklets ? "enabled" : "disabled"}!")

@@ -120,7 +134,9 @@ android {
cppFlags "-O2 -frtti -fexceptions -Wall -Wno-unused-variable -fstack-protector-all"
arguments "-DANDROID_STL=c++_shared",
"-DNODE_MODULES_DIR=${nodeModules}",
- "-DENABLE_FRAME_PROCESSORS=${hasWorklets ? "ON" : "OFF"}"
+ "-DENABLE_FRAME_PROCESSORS=${hasWorklets ? "ON" : "OFF"}",
+ "-DCMAKE_MAKE_PROGRAM=${toolsDir}\\windows\\ninja.exe",
+ "-DCMAKE_OBJECT_PATH_MAX=1024"
abiFilters (*reactNativeArchitectures())
}
}
2 changes: 1 addition & 1 deletion examples/objectdetection/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx512m -XX:MaxMetaspaceSize=256m
org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m
org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=512m

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@
"typescript": "^5.2.2"
},
"resolutions": {
"@types/react": "^18.2.44"
"@types/react": "^18.2.44",
"react-native-vision-camera@^3.9.2": "patch:react-native-vision-camera@npm%3A3.9.2#./.yarn/patches/react-native-vision-camera-npm-3.9.2-3b35d90475.patch"
},
"peerDependencies": {
"react": "*",
Expand Down
Binary file added tools/windows/ninja.exe
Binary file not shown.
20 changes: 17 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17474,6 +17474,20 @@ __metadata:
languageName: unknown
linkType: soft

"react-native-vision-camera@npm:3.9.2":
version: 3.9.2
resolution: "react-native-vision-camera@npm:3.9.2"
peerDependencies:
react: "*"
react-native: "*"
react-native-worklets-core: "*"
peerDependenciesMeta:
react-native-worklets-core:
optional: true
checksum: b69beca5bcc486c6e4f9b11199ba46cc8552be2bb46a8b1f74851c9563f88eedf851d9c61299e2d3e507029398281a7fcbc4e2183af3ee39d75a6194bcfaf757
languageName: node
linkType: hard

"react-native-vision-camera@npm:^3.8.2":
version: 3.9.1
resolution: "react-native-vision-camera@npm:3.9.1"
Expand All @@ -17488,17 +17502,17 @@ __metadata:
languageName: node
linkType: hard

"react-native-vision-camera@npm:^3.9.2":
"react-native-vision-camera@patch:react-native-vision-camera@npm%3A3.9.2#./.yarn/patches/react-native-vision-camera-npm-3.9.2-3b35d90475.patch::locator=react-native-mediapipe%40workspace%3A.":
version: 3.9.2
resolution: "react-native-vision-camera@npm:3.9.2"
resolution: "react-native-vision-camera@patch:react-native-vision-camera@npm%3A3.9.2#./.yarn/patches/react-native-vision-camera-npm-3.9.2-3b35d90475.patch::version=3.9.2&hash=526571&locator=react-native-mediapipe%40workspace%3A."
peerDependencies:
react: "*"
react-native: "*"
react-native-worklets-core: "*"
peerDependenciesMeta:
react-native-worklets-core:
optional: true
checksum: b69beca5bcc486c6e4f9b11199ba46cc8552be2bb46a8b1f74851c9563f88eedf851d9c61299e2d3e507029398281a7fcbc4e2183af3ee39d75a6194bcfaf757
checksum: 9bc4db58b2012f353e49e8dc095dec232b2e73eb3fab02d0e678bb50d854627b336139d46c68e5ca4f9b14ce5ff402e042e46eb04178134aec99fb5d566f43cd
languageName: node
linkType: hard

Expand Down

0 comments on commit ff0fb47

Please sign in to comment.