react-native-yolo 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -20
- package/README.md +51 -51
- package/Yolo.podspec +31 -31
- package/android/CMakeLists.txt +35 -32
- package/android/build.gradle +154 -152
- package/android/fix-prefab.gradle +50 -50
- package/android/gradle.properties +5 -5
- package/android/src/main/AndroidManifest.xml +3 -2
- package/android/src/main/cpp/cpp-adapter.cpp +8 -8
- package/android/src/main/java/com/yolo/HybridYolo.kt +65 -42
- package/android/src/main/java/com/yolo/YoloPackage.kt +20 -20
- package/android/src/main/java/com/yolo/utils/BitmapOrientationFixer.kt +56 -0
- package/android/src/main/java/com/yolo/utils/FrameJpegConverter.kt +27 -0
- package/android/src/main/java/com/yolo/utils/FrameValidator.kt +29 -0
- package/android/src/main/java/com/yolo/utils/Nv21JpegEncoder.kt +34 -0
- package/android/src/main/java/com/yolo/utils/Yuv420ToNv21Converter.kt +62 -0
- package/ios/Bridge.h +8 -8
- package/ios/HybridYolo.swift +14 -14
- package/lib/commonjs/index.js +10 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +10 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/index.d.ts +3 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/yolo.nitro.d.ts +2 -0
- package/lib/typescript/src/specs/yolo.nitro.d.ts.map +1 -1
- package/nitro.json +29 -29
- package/nitrogen/generated/android/c++/JHybridYoloSpec.cpp +10 -1
- package/nitrogen/generated/android/c++/JHybridYoloSpec.hpp +1 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/yolo/HybridYoloSpec.kt +5 -0
- package/nitrogen/generated/ios/Yolo-Swift-Cxx-Bridge.cpp +11 -0
- package/nitrogen/generated/ios/Yolo-Swift-Cxx-Bridge.hpp +27 -0
- package/nitrogen/generated/ios/Yolo-Swift-Cxx-Umbrella.hpp +5 -0
- package/nitrogen/generated/ios/c++/HybridYoloSpecSwift.hpp +12 -1
- package/nitrogen/generated/ios/swift/HybridYoloSpec.swift +2 -0
- package/nitrogen/generated/ios/swift/HybridYoloSpec_cxx.swift +17 -0
- package/nitrogen/generated/shared/c++/HybridYoloSpec.cpp +1 -0
- package/nitrogen/generated/shared/c++/HybridYoloSpec.hpp +5 -1
- package/package.json +127 -122
- package/src/index.ts +11 -11
- package/src/specs/yolo.nitro.ts +7 -6
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Khaoula-Ghalimi
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Khaoula-Ghalimi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
# react-native-yolo
|
|
2
|
-
|
|
3
|
-
🚧 **Work in Progress**
|
|
4
|
-
|
|
5
|
-
`react-native-yolo` is currently under active development and is **not yet ready for production use**. APIs, features, and installation steps may change between releases.
|
|
6
|
-
|
|
7
|
-
The goal of this project is to provide YOLO-based object detection capabilities for React Native applications using Nitro Modules.
|
|
8
|
-
|
|
9
|
-
[](https://www.npmjs.com/package/react-native-yolo)
|
|
10
|
-
[](https://www.npmjs.com/package/react-native-yolo)
|
|
11
|
-
[](https://github.com/patrickkabwe/react-native-yolo/LICENSE)
|
|
12
|
-
|
|
13
|
-
## Current Status
|
|
14
|
-
|
|
15
|
-
* 🚧 Under active development
|
|
16
|
-
* ⚠️ Breaking changes may occur between releases
|
|
17
|
-
* ⚠️ Documentation is incomplete
|
|
18
|
-
* ⚠️ Features are still being implemented and tested
|
|
19
|
-
|
|
20
|
-
## Requirements
|
|
21
|
-
|
|
22
|
-
* React Native v0.76.0 or higher
|
|
23
|
-
* Node 18.0.0 or higher
|
|
24
|
-
|
|
25
|
-
> [!IMPORTANT]
|
|
26
|
-
> To support `Nitro Views`, you need React Native v0.78.0 or higher.
|
|
27
|
-
|
|
28
|
-
## Installation
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
npm install react-native-yolo react-native-nitro-modules
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
## Roadmap
|
|
35
|
-
|
|
36
|
-
Planned features include:
|
|
37
|
-
|
|
38
|
-
* YOLO model loading
|
|
39
|
-
* Real-time object detection
|
|
40
|
-
* Camera integration
|
|
41
|
-
* Android support
|
|
42
|
-
* iOS support
|
|
43
|
-
* Performance optimizations
|
|
44
|
-
|
|
45
|
-
## Credits
|
|
46
|
-
|
|
47
|
-
Bootstrapped with [create-nitro-module](https://github.com/patrickkabwe/create-nitro-module).
|
|
48
|
-
|
|
49
|
-
## Contributing
|
|
50
|
-
|
|
51
|
-
Contributions, bug reports, and feature requests are welcome. Since the project is still under development, feedback is especially appreciated.
|
|
1
|
+
# react-native-yolo
|
|
2
|
+
|
|
3
|
+
🚧 **Work in Progress**
|
|
4
|
+
|
|
5
|
+
`react-native-yolo` is currently under active development and is **not yet ready for production use**. APIs, features, and installation steps may change between releases.
|
|
6
|
+
|
|
7
|
+
The goal of this project is to provide YOLO-based object detection capabilities for React Native applications using Nitro Modules.
|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/react-native-yolo)
|
|
10
|
+
[](https://www.npmjs.com/package/react-native-yolo)
|
|
11
|
+
[](https://github.com/patrickkabwe/react-native-yolo/LICENSE)
|
|
12
|
+
|
|
13
|
+
## Current Status
|
|
14
|
+
|
|
15
|
+
* 🚧 Under active development
|
|
16
|
+
* ⚠️ Breaking changes may occur between releases
|
|
17
|
+
* ⚠️ Documentation is incomplete
|
|
18
|
+
* ⚠️ Features are still being implemented and tested
|
|
19
|
+
|
|
20
|
+
## Requirements
|
|
21
|
+
|
|
22
|
+
* React Native v0.76.0 or higher
|
|
23
|
+
* Node 18.0.0 or higher
|
|
24
|
+
|
|
25
|
+
> [!IMPORTANT]
|
|
26
|
+
> To support `Nitro Views`, you need React Native v0.78.0 or higher.
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install react-native-yolo react-native-nitro-modules
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Roadmap
|
|
35
|
+
|
|
36
|
+
Planned features include:
|
|
37
|
+
|
|
38
|
+
* YOLO model loading
|
|
39
|
+
* Real-time object detection
|
|
40
|
+
* Camera integration
|
|
41
|
+
* Android support
|
|
42
|
+
* iOS support
|
|
43
|
+
* Performance optimizations
|
|
44
|
+
|
|
45
|
+
## Credits
|
|
46
|
+
|
|
47
|
+
Bootstrapped with [create-nitro-module](https://github.com/patrickkabwe/create-nitro-module).
|
|
48
|
+
|
|
49
|
+
## Contributing
|
|
50
|
+
|
|
51
|
+
Contributions, bug reports, and feature requests are welcome. Since the project is still under development, feedback is especially appreciated.
|
package/Yolo.podspec
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
require "json"
|
|
2
|
-
|
|
3
|
-
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
-
|
|
5
|
-
Pod::Spec.new do |s|
|
|
6
|
-
s.name = "Yolo"
|
|
7
|
-
s.version = package["version"]
|
|
8
|
-
s.summary = package["description"]
|
|
9
|
-
s.homepage = package["homepage"]
|
|
10
|
-
s.license = package["license"]
|
|
11
|
-
s.authors = package["author"]
|
|
12
|
-
|
|
13
|
-
s.platforms = { :ios => min_ios_version_supported, :visionos => 1.0 }
|
|
14
|
-
s.source = { :git => "https://github.com/khaoula-ghalimi/react-native-yolo.git", :tag => "#{s.version}" }
|
|
15
|
-
|
|
16
|
-
s.source_files = [
|
|
17
|
-
# Implementation (Swift)
|
|
18
|
-
"ios/**/*.{swift}",
|
|
19
|
-
# Autolinking/Registration (Objective-C++)
|
|
20
|
-
"ios/**/*.{m,mm}",
|
|
21
|
-
# Implementation (C++ objects)
|
|
22
|
-
"cpp/**/*.{hpp,cpp}",
|
|
23
|
-
]
|
|
24
|
-
|
|
25
|
-
load 'nitrogen/generated/ios/Yolo+autolinking.rb'
|
|
26
|
-
add_nitrogen_files(s)
|
|
27
|
-
|
|
28
|
-
s.dependency 'React-jsi'
|
|
29
|
-
s.dependency 'React-callinvoker'
|
|
30
|
-
install_modules_dependencies(s)
|
|
31
|
-
end
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = "Yolo"
|
|
7
|
+
s.version = package["version"]
|
|
8
|
+
s.summary = package["description"]
|
|
9
|
+
s.homepage = package["homepage"]
|
|
10
|
+
s.license = package["license"]
|
|
11
|
+
s.authors = package["author"]
|
|
12
|
+
|
|
13
|
+
s.platforms = { :ios => min_ios_version_supported, :visionos => 1.0 }
|
|
14
|
+
s.source = { :git => "https://github.com/khaoula-ghalimi/react-native-yolo.git", :tag => "#{s.version}" }
|
|
15
|
+
|
|
16
|
+
s.source_files = [
|
|
17
|
+
# Implementation (Swift)
|
|
18
|
+
"ios/**/*.{swift}",
|
|
19
|
+
# Autolinking/Registration (Objective-C++)
|
|
20
|
+
"ios/**/*.{m,mm}",
|
|
21
|
+
# Implementation (C++ objects)
|
|
22
|
+
"cpp/**/*.{hpp,cpp}",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
load 'nitrogen/generated/ios/Yolo+autolinking.rb'
|
|
26
|
+
add_nitrogen_files(s)
|
|
27
|
+
|
|
28
|
+
s.dependency 'React-jsi'
|
|
29
|
+
s.dependency 'React-callinvoker'
|
|
30
|
+
install_modules_dependencies(s)
|
|
31
|
+
end
|
package/android/CMakeLists.txt
CHANGED
|
@@ -1,32 +1,35 @@
|
|
|
1
|
-
project(Yolo)
|
|
2
|
-
cmake_minimum_required(VERSION 3.9.0)
|
|
3
|
-
|
|
4
|
-
set (PACKAGE_NAME Yolo)
|
|
5
|
-
set (CMAKE_VERBOSE_MAKEFILE ON)
|
|
6
|
-
set (CMAKE_CXX_STANDARD 20)
|
|
7
|
-
|
|
8
|
-
# Enable Raw Props parsing in react-native (for Nitro Views)
|
|
9
|
-
add_compile_options(-DRN_SERIALIZABLE_STATE=1)
|
|
10
|
-
|
|
11
|
-
# Define C++ library and add all sources
|
|
12
|
-
add_library(${PACKAGE_NAME} SHARED
|
|
13
|
-
src/main/cpp/cpp-adapter.cpp
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
# Add Nitrogen specs :)
|
|
17
|
-
include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/Yolo+autolinking.cmake)
|
|
18
|
-
|
|
19
|
-
# Set up local includes
|
|
20
|
-
include_directories(
|
|
21
|
-
"src/main/cpp"
|
|
22
|
-
"../cpp"
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
find_library(LOG_LIB log)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
1
|
+
project(Yolo)
|
|
2
|
+
cmake_minimum_required(VERSION 3.9.0)
|
|
3
|
+
|
|
4
|
+
set (PACKAGE_NAME Yolo)
|
|
5
|
+
set (CMAKE_VERBOSE_MAKEFILE ON)
|
|
6
|
+
set (CMAKE_CXX_STANDARD 20)
|
|
7
|
+
|
|
8
|
+
# Enable Raw Props parsing in react-native (for Nitro Views)
|
|
9
|
+
add_compile_options(-DRN_SERIALIZABLE_STATE=1)
|
|
10
|
+
|
|
11
|
+
# Define C++ library and add all sources
|
|
12
|
+
add_library(${PACKAGE_NAME} SHARED
|
|
13
|
+
src/main/cpp/cpp-adapter.cpp
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
# Add Nitrogen specs :)
|
|
17
|
+
include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/Yolo+autolinking.cmake)
|
|
18
|
+
|
|
19
|
+
# Set up local includes
|
|
20
|
+
include_directories(
|
|
21
|
+
"src/main/cpp"
|
|
22
|
+
"../cpp"
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
find_library(LOG_LIB log)
|
|
26
|
+
find_package(react-native-vision-camera REQUIRED) # <-- for the HybridFrameSpec and HybridCameraOutputSpec
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# Link all libraries together
|
|
30
|
+
target_link_libraries(
|
|
31
|
+
${PACKAGE_NAME}
|
|
32
|
+
${LOG_LIB}
|
|
33
|
+
android # <-- Android core
|
|
34
|
+
react-native-vision-camera::VisionCamera
|
|
35
|
+
)
|
package/android/build.gradle
CHANGED
|
@@ -1,153 +1,155 @@
|
|
|
1
|
-
buildscript {
|
|
2
|
-
repositories {
|
|
3
|
-
google()
|
|
4
|
-
mavenCentral()
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
dependencies {
|
|
8
|
-
classpath "com.android.tools.build:gradle:8.8.0"
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
def reactNativeArchitectures() {
|
|
13
|
-
def value = rootProject.getProperties().get("reactNativeArchitectures")
|
|
14
|
-
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
def isNewArchitectureEnabled() {
|
|
18
|
-
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
apply plugin: "com.android.library"
|
|
22
|
-
apply plugin: 'org.jetbrains.kotlin.android'
|
|
23
|
-
apply from: '../nitrogen/generated/android/Yolo+autolinking.gradle'
|
|
24
|
-
apply from: "./fix-prefab.gradle"
|
|
25
|
-
|
|
26
|
-
if (isNewArchitectureEnabled()) {
|
|
27
|
-
apply plugin: "com.facebook.react"
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
def getExtOrDefault(name) {
|
|
31
|
-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["Yolo_" + name]
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
def getExtOrIntegerDefault(name) {
|
|
35
|
-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["Yolo_" + name]).toInteger()
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
android {
|
|
39
|
-
namespace "com.yolo"
|
|
40
|
-
|
|
41
|
-
ndkVersion getExtOrDefault("ndkVersion")
|
|
42
|
-
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
43
|
-
|
|
44
|
-
defaultConfig {
|
|
45
|
-
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
46
|
-
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
47
|
-
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
48
|
-
|
|
49
|
-
externalNativeBuild {
|
|
50
|
-
cmake {
|
|
51
|
-
cppFlags "-frtti -fexceptions -Wall -Wextra -fstack-protector-all"
|
|
52
|
-
arguments "-DANDROID_STL=c++_shared", "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON"
|
|
53
|
-
abiFilters (*reactNativeArchitectures())
|
|
54
|
-
|
|
55
|
-
buildTypes {
|
|
56
|
-
debug {
|
|
57
|
-
cppFlags "-O1 -g"
|
|
58
|
-
}
|
|
59
|
-
release {
|
|
60
|
-
cppFlags "-O2"
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
externalNativeBuild {
|
|
68
|
-
cmake {
|
|
69
|
-
path "CMakeLists.txt"
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
packagingOptions {
|
|
74
|
-
excludes = [
|
|
75
|
-
"META-INF",
|
|
76
|
-
"META-INF/**",
|
|
77
|
-
"**/libc++_shared.so",
|
|
78
|
-
"**/libfbjni.so",
|
|
79
|
-
"**/libjsi.so",
|
|
80
|
-
"**/libfolly_json.so",
|
|
81
|
-
"**/libfolly_runtime.so",
|
|
82
|
-
"**/libglog.so",
|
|
83
|
-
"**/libhermes.so",
|
|
84
|
-
"**/libhermes-executor-debug.so",
|
|
85
|
-
"**/libhermes_executor.so",
|
|
86
|
-
"**/libreactnative.so",
|
|
87
|
-
"**/libreactnativejni.so",
|
|
88
|
-
"**/libturbomodulejsijni.so",
|
|
89
|
-
"**/libreact_nativemodule_core.so",
|
|
90
|
-
"**/libjscexecutor.so"
|
|
91
|
-
]
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
buildFeatures {
|
|
95
|
-
buildConfig true
|
|
96
|
-
prefab true
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
buildTypes {
|
|
100
|
-
release {
|
|
101
|
-
minifyEnabled false
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
lintOptions {
|
|
106
|
-
disable "GradleCompatible"
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
compileOptions {
|
|
110
|
-
sourceCompatibility JavaVersion.VERSION_1_8
|
|
111
|
-
targetCompatibility JavaVersion.VERSION_1_8
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
sourceSets {
|
|
115
|
-
main {
|
|
116
|
-
if (isNewArchitectureEnabled()) {
|
|
117
|
-
java.srcDirs += [
|
|
118
|
-
// React Codegen files
|
|
119
|
-
"${project.buildDir}/generated/source/codegen/java"
|
|
120
|
-
]
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
repositories {
|
|
127
|
-
mavenCentral()
|
|
128
|
-
google()
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
dependencies {
|
|
133
|
-
// For < 0.71, this will be from the local maven repo
|
|
134
|
-
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
|
135
|
-
//noinspection GradleDynamicVersion
|
|
136
|
-
implementation "com.facebook.react:react-native:+"
|
|
137
|
-
|
|
138
|
-
// Add a dependency on NitroModules
|
|
139
|
-
implementation project(":react-native-nitro-modules")
|
|
140
|
-
|
|
141
|
-
// Add TensorFlow Lite dependencies
|
|
142
|
-
implementation "com.google.ai.edge.litert:litert:1.4.2"
|
|
143
|
-
implementation "com.google.ai.edge.litert:litert-support-api:1.4.2"
|
|
144
|
-
implementation "com.google.ai.edge.litert:litert-gpu:1.4.2"
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
1
|
+
buildscript {
|
|
2
|
+
repositories {
|
|
3
|
+
google()
|
|
4
|
+
mavenCentral()
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
dependencies {
|
|
8
|
+
classpath "com.android.tools.build:gradle:8.8.0"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
def reactNativeArchitectures() {
|
|
13
|
+
def value = rootProject.getProperties().get("reactNativeArchitectures")
|
|
14
|
+
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
def isNewArchitectureEnabled() {
|
|
18
|
+
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
apply plugin: "com.android.library"
|
|
22
|
+
apply plugin: 'org.jetbrains.kotlin.android'
|
|
23
|
+
apply from: '../nitrogen/generated/android/Yolo+autolinking.gradle'
|
|
24
|
+
apply from: "./fix-prefab.gradle"
|
|
25
|
+
|
|
26
|
+
if (isNewArchitectureEnabled()) {
|
|
27
|
+
apply plugin: "com.facebook.react"
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
def getExtOrDefault(name) {
|
|
31
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["Yolo_" + name]
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
def getExtOrIntegerDefault(name) {
|
|
35
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["Yolo_" + name]).toInteger()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
android {
|
|
39
|
+
namespace "com.yolo"
|
|
40
|
+
|
|
41
|
+
ndkVersion getExtOrDefault("ndkVersion")
|
|
42
|
+
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
43
|
+
|
|
44
|
+
defaultConfig {
|
|
45
|
+
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
46
|
+
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
47
|
+
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
48
|
+
|
|
49
|
+
externalNativeBuild {
|
|
50
|
+
cmake {
|
|
51
|
+
cppFlags "-frtti -fexceptions -Wall -Wextra -fstack-protector-all"
|
|
52
|
+
arguments "-DANDROID_STL=c++_shared", "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON"
|
|
53
|
+
abiFilters (*reactNativeArchitectures())
|
|
54
|
+
|
|
55
|
+
buildTypes {
|
|
56
|
+
debug {
|
|
57
|
+
cppFlags "-O1 -g"
|
|
58
|
+
}
|
|
59
|
+
release {
|
|
60
|
+
cppFlags "-O2"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
externalNativeBuild {
|
|
68
|
+
cmake {
|
|
69
|
+
path "CMakeLists.txt"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
packagingOptions {
|
|
74
|
+
excludes = [
|
|
75
|
+
"META-INF",
|
|
76
|
+
"META-INF/**",
|
|
77
|
+
"**/libc++_shared.so",
|
|
78
|
+
"**/libfbjni.so",
|
|
79
|
+
"**/libjsi.so",
|
|
80
|
+
"**/libfolly_json.so",
|
|
81
|
+
"**/libfolly_runtime.so",
|
|
82
|
+
"**/libglog.so",
|
|
83
|
+
"**/libhermes.so",
|
|
84
|
+
"**/libhermes-executor-debug.so",
|
|
85
|
+
"**/libhermes_executor.so",
|
|
86
|
+
"**/libreactnative.so",
|
|
87
|
+
"**/libreactnativejni.so",
|
|
88
|
+
"**/libturbomodulejsijni.so",
|
|
89
|
+
"**/libreact_nativemodule_core.so",
|
|
90
|
+
"**/libjscexecutor.so"
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
buildFeatures {
|
|
95
|
+
buildConfig true
|
|
96
|
+
prefab true
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
buildTypes {
|
|
100
|
+
release {
|
|
101
|
+
minifyEnabled false
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
lintOptions {
|
|
106
|
+
disable "GradleCompatible"
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
compileOptions {
|
|
110
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
111
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
sourceSets {
|
|
115
|
+
main {
|
|
116
|
+
if (isNewArchitectureEnabled()) {
|
|
117
|
+
java.srcDirs += [
|
|
118
|
+
// React Codegen files
|
|
119
|
+
"${project.buildDir}/generated/source/codegen/java"
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
repositories {
|
|
127
|
+
mavenCentral()
|
|
128
|
+
google()
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
dependencies {
|
|
133
|
+
// For < 0.71, this will be from the local maven repo
|
|
134
|
+
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
|
135
|
+
//noinspection GradleDynamicVersion
|
|
136
|
+
implementation "com.facebook.react:react-native:+"
|
|
137
|
+
|
|
138
|
+
// Add a dependency on NitroModules
|
|
139
|
+
implementation project(":react-native-nitro-modules")
|
|
140
|
+
|
|
141
|
+
// Add TensorFlow Lite dependencies
|
|
142
|
+
implementation "com.google.ai.edge.litert:litert:1.4.2"
|
|
143
|
+
implementation "com.google.ai.edge.litert:litert-support-api:1.4.2"
|
|
144
|
+
implementation "com.google.ai.edge.litert:litert-gpu:1.4.2"
|
|
145
|
+
|
|
146
|
+
compileOnly project(":react-native-vision-camera")
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (isNewArchitectureEnabled()) {
|
|
150
|
+
react {
|
|
151
|
+
jsRootDir = file("../src/")
|
|
152
|
+
libraryName = "Yolo"
|
|
153
|
+
codegenJavaPackageName = "com.yolo"
|
|
154
|
+
}
|
|
153
155
|
}
|