simplejsble 0.0.28 → 0.0.29

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.
@@ -10,31 +10,36 @@ Pod::Spec.new do |s|
10
10
  s.license = package["license"]
11
11
  s.authors = package["author"]
12
12
 
13
- s.platforms = { :ios => min_ios_version_supported }
13
+ s.platforms = {
14
+ :ios => min_ios_version_supported,
15
+ :osx => '10.13'
16
+ }
14
17
 
15
18
  s.source = { :path => "." }
16
19
 
17
20
  # Build SimpleBLE from source only if XCFramework doesn't exist
18
21
  # When installed from npm, the pre-built XCFramework is already included
19
22
  s.prepare_command = <<-CMD
20
- # Build iOS XCFramework if not present
23
+ # Build iOS/macOS XCFramework if not present
21
24
  if [ -d "ios/SimpleBLE.xcframework" ]; then
22
- echo "SimpleBLE.xcframework (iOS) already exists, skipping build"
25
+ echo "SimpleBLE.xcframework already exists, skipping build"
23
26
  else
24
- echo "Building SimpleBLE for iOS..."
27
+ echo "Building SimpleBLE for iOS and macOS..."
25
28
  set -e
26
29
  IOS_DIR="ios"
27
30
  IOS_DEPLOYMENT_TARGET="${IOS_DEPLOYMENT_TARGET:-13.4}"
28
-
29
- build_for_platform() {
31
+ MACOS_DEPLOYMENT_TARGET="${MACOS_DEPLOYMENT_TARGET:-10.13}"
32
+
33
+ # Build for iOS platforms (iphoneos, iphonesimulator)
34
+ build_for_ios_platform() {
30
35
  local PLATFORM=$1 # iphoneos or iphonesimulator
31
36
  local ARCH=$2 # arm64 or x86_64
32
-
37
+
33
38
  local BUILD_DIR="${IOS_DIR}/build_${PLATFORM}_${ARCH}"
34
39
  local INSTALL_DIR="${IOS_DIR}/simpleble_${PLATFORM}_${ARCH}"
35
-
40
+
36
41
  echo "Building SimpleBLE for ${PLATFORM} (${ARCH})..."
37
-
42
+
38
43
  cmake -B "${BUILD_DIR}" -S "${IOS_DIR}" \
39
44
  -DCMAKE_BUILD_TYPE=Release \
40
45
  -DCMAKE_SYSTEM_NAME=iOS \
@@ -44,31 +49,74 @@ Pod::Spec.new do |s|
44
49
  -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
45
50
  -DBUILD_SHARED_LIBS=OFF \
46
51
  -DSIMPLEBLE_EXCLUDE_C=ON
47
-
52
+
53
+ cmake --build "${BUILD_DIR}" --config Release --parallel
54
+ cmake --install "${BUILD_DIR}" --config Release
55
+
56
+ echo "Installed to ${INSTALL_DIR}"
57
+ }
58
+
59
+ # Build for macOS platforms
60
+ build_for_macos_platform() {
61
+ local ARCH=$1 # arm64 or x86_64
62
+
63
+ local BUILD_DIR="${IOS_DIR}/build_macosx_${ARCH}"
64
+ local INSTALL_DIR="${IOS_DIR}/simpleble_macosx_${ARCH}"
65
+
66
+ echo "Building SimpleBLE for macOS (${ARCH})..."
67
+
68
+ cmake -B "${BUILD_DIR}" -S "${IOS_DIR}" \
69
+ -DCMAKE_BUILD_TYPE=Release \
70
+ -DCMAKE_SYSTEM_NAME=Darwin \
71
+ -DCMAKE_OSX_SYSROOT="macosx" \
72
+ -DCMAKE_OSX_ARCHITECTURES="${ARCH}" \
73
+ -DCMAKE_OSX_DEPLOYMENT_TARGET="${MACOS_DEPLOYMENT_TARGET}" \
74
+ -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
75
+ -DBUILD_SHARED_LIBS=OFF \
76
+ -DSIMPLEBLE_EXCLUDE_C=ON
77
+
48
78
  cmake --build "${BUILD_DIR}" --config Release --parallel
49
79
  cmake --install "${BUILD_DIR}" --config Release
50
-
80
+
51
81
  echo "Installed to ${INSTALL_DIR}"
52
82
  }
53
-
54
- # Build for device
55
- build_for_platform "iphoneos" "arm64"
56
-
57
- # Build for simulator (Apple Silicon)
58
- build_for_platform "iphonesimulator" "arm64"
59
-
60
- # Create XCFramework from the static libraries
83
+
84
+ # Build for iOS device
85
+ build_for_ios_platform "iphoneos" "arm64"
86
+
87
+ # Build for iOS simulator (Apple Silicon)
88
+ build_for_ios_platform "iphonesimulator" "arm64"
89
+
90
+ # Build for macOS (Apple Silicon)
91
+ build_for_macos_platform "arm64"
92
+
93
+ # Build for macOS (Intel)
94
+ build_for_macos_platform "x86_64"
95
+
96
+ # Create universal macOS library
97
+ echo "Creating universal macOS library..."
98
+ MACOS_UNIVERSAL_DIR="${IOS_DIR}/simpleble_macosx_universal"
99
+ mkdir -p "${MACOS_UNIVERSAL_DIR}/lib"
100
+ cp -r "${IOS_DIR}/simpleble_macosx_arm64/include" "${MACOS_UNIVERSAL_DIR}/"
101
+ lipo -create \
102
+ "${IOS_DIR}/simpleble_macosx_arm64/lib/libsimpleble.a" \
103
+ "${IOS_DIR}/simpleble_macosx_x86_64/lib/libsimpleble.a" \
104
+ -output "${MACOS_UNIVERSAL_DIR}/lib/libsimpleble.a"
105
+
106
+ # Create XCFramework from the static libraries (iOS + macOS)
61
107
  echo "Creating XCFramework..."
62
108
  XCFRAMEWORK_PATH="${IOS_DIR}/SimpleBLE.xcframework"
63
109
  rm -rf "${XCFRAMEWORK_PATH}"
64
-
110
+
65
111
  xcodebuild -create-xcframework \
66
112
  -library "${IOS_DIR}/simpleble_iphoneos_arm64/lib/libsimpleble.a" \
67
113
  -headers "${IOS_DIR}/simpleble_iphoneos_arm64/include" \
68
114
  -library "${IOS_DIR}/simpleble_iphonesimulator_arm64/lib/libsimpleble.a" \
69
115
  -headers "${IOS_DIR}/simpleble_iphonesimulator_arm64/include" \
116
+ -library "${MACOS_UNIVERSAL_DIR}/lib/libsimpleble.a" \
117
+ -headers "${MACOS_UNIVERSAL_DIR}/include" \
70
118
  -output "${XCFRAMEWORK_PATH}"
71
-
119
+
72
120
  echo "SimpleBLE build complete!"
73
121
  echo "XCFramework created at: ${XCFRAMEWORK_PATH}"
74
122
  fi
@@ -95,9 +143,12 @@ Pod::Spec.new do |s|
95
143
 
96
144
  # Required frameworks for SimpleBLE
97
145
  s.frameworks = ['Foundation', 'CoreBluetooth']
146
+ # macOS requires additional frameworks for classic Bluetooth support
147
+ s.osx.frameworks = ['Foundation', 'CoreBluetooth', 'IOBluetooth', 'IOKit']
98
148
 
99
- # Vendored XCFramework containing all architectures
149
+ # Vendored XCFramework containing all architectures (iOS + macOS)
100
150
  s.ios.vendored_frameworks = 'ios/SimpleBLE.xcframework'
151
+ s.osx.vendored_frameworks = 'ios/SimpleBLE.xcframework'
101
152
 
102
153
  # Configure header search paths for SimpleBLE
103
154
  current_pod_target_xcconfig = s.attributes_hash['pod_target_xcconfig'] || {}
@@ -107,6 +158,10 @@ Pod::Spec.new do |s|
107
158
  # iOS header paths
108
159
  '"$(PODS_TARGET_SRCROOT)/ios/simpleble_iphoneos_arm64/include"',
109
160
  '"$(PODS_TARGET_SRCROOT)/ios/simpleble_iphonesimulator_arm64/include"',
161
+ # macOS header paths
162
+ '"$(PODS_TARGET_SRCROOT)/ios/simpleble_macosx_arm64/include"',
163
+ '"$(PODS_TARGET_SRCROOT)/ios/simpleble_macosx_x86_64/include"',
164
+ '"$(PODS_TARGET_SRCROOT)/ios/simpleble_macosx_universal/include"',
110
165
  ].join(' '),
111
166
  })
112
167
  end
@@ -0,0 +1,77 @@
1
+ # SimpleDroidBridge Integration Decision
2
+
3
+ ## Current Approach
4
+
5
+ In `build.gradle`, the simpledroidbridge Java sources are included directly:
6
+
7
+ ```gradle
8
+ sourceSets {
9
+ main {
10
+ java.srcDirs += ["../simpledroidbridge/src/main/java"]
11
+ }
12
+ }
13
+ ```
14
+
15
+ ## Why Not Use `implementation project(":simpledroidbridge")`?
16
+
17
+ ### Option 1: `java.srcDirs` (Current)
18
+
19
+ Compiles simpledroidbridge sources directly into the main library.
20
+
21
+ **Pros:**
22
+ - No configuration needed in consumer app
23
+ - Works seamlessly in npm package context
24
+ - No build config conflicts
25
+ - React Native autolinking works out of the box
26
+
27
+ **Cons:**
28
+ - Sources compiled together (single output)
29
+
30
+ ### Option 2: `implementation project(":simpledroidbridge")`
31
+
32
+ Would treat simpledroidbridge as a separate Gradle module dependency.
33
+
34
+ **Pros:**
35
+ - Cleaner separation of modules
36
+ - Could be reused independently
37
+
38
+ **Cons:**
39
+ - Requires consumer app's `settings.gradle.kts` to include:
40
+ ```kotlin
41
+ include(":simpledroidbridge")
42
+ project(":simpledroidbridge").projectDir = File("node_modules/simplejsble/simpledroidbridge")
43
+ ```
44
+ - `simpledroidbridge/build.gradle.kts` has its own SDK versions (`compileSdk = 31`, `minSdk = 31`) which may conflict with consumer apps
45
+ - React Native autolinking doesn't handle transitive local project dependencies
46
+ - Complex path resolution for npm packages
47
+
48
+ ## Comparison
49
+
50
+ | Aspect | `java.srcDirs` | `project(":simpledroidbridge")` |
51
+ |--------|----------------|--------------------------------|
52
+ | Consumer setup | None required | Must modify settings.gradle |
53
+ | Build config conflicts | None | Possible SDK version conflicts |
54
+ | npm package compatibility | Works out of the box | Complex path resolution |
55
+ | Autolinking | Works | Not supported |
56
+
57
+ ## Conclusion
58
+
59
+ The `java.srcDirs` approach is the right choice for npm package distribution. Converting to a project dependency would add unnecessary friction for package consumers.
60
+
61
+ ## Package Structure
62
+
63
+ The npm package bundles simpledroidbridge (defined in `package.json`):
64
+
65
+ ```json
66
+ {
67
+ "files": [
68
+ "android/",
69
+ "simpledroidbridge/",
70
+ ...
71
+ ]
72
+ }
73
+ ```
74
+
75
+ This allows the relative path `../simpledroidbridge/src/main/java` to work correctly from the `android/` folder in both:
76
+ - Monorepo development
77
+ - npm package installation (`node_modules/simplejsble/`)
@@ -107,8 +107,8 @@ android {
107
107
  }
108
108
 
109
109
  compileOptions {
110
- sourceCompatibility JavaVersion.VERSION_1_8
111
- targetCompatibility JavaVersion.VERSION_1_8
110
+ sourceCompatibility JavaVersion.VERSION_1_9
111
+ targetCompatibility JavaVersion.VERSION_1_9
112
112
  }
113
113
 
114
114
  sourceSets {
@@ -1,5 +1,5 @@
1
1
  NitroSimplejsble_kotlinVersion=2.1.20
2
- NitroSimplejsble_minSdkVersion=23
3
- NitroSimplejsble_targetSdkVersion=36
4
- NitroSimplejsble_compileSdkVersion=36
2
+ NitroSimplejsble_minSdkVersion=31
3
+ NitroSimplejsble_targetSdkVersion=31
4
+ NitroSimplejsble_compileSdkVersion=31
5
5
  NitroSimplejsble_ndkVersion=27.1.12297006
@@ -0,0 +1,50 @@
1
+ # CMake Install Options Reference
2
+
3
+ ## Install Target Destinations
4
+
5
+ | Destination | Purpose | File Types |
6
+ |-------------|---------|------------|
7
+ | `ARCHIVE` | Static libraries and import libraries | `.a`, `.lib` (Windows import libs) |
8
+ | `LIBRARY` | Shared libraries | `.so`, `.dylib` |
9
+ | `RUNTIME` | Executables and DLLs | `.exe`, `.dll` |
10
+
11
+ ## Recommended Variables (via `GNUInstallDirs`)
12
+
13
+ ```cmake
14
+ include(GNUInstallDirs)
15
+ ```
16
+
17
+ | Variable | Default Value | Purpose |
18
+ |----------|---------------|---------|
19
+ | `CMAKE_INSTALL_LIBDIR` | `lib` | Library installation directory |
20
+ | `CMAKE_INSTALL_INCLUDEDIR` | `include` | Header installation directory |
21
+ | `CMAKE_INSTALL_BINDIR` | `bin` | Binary/executable installation directory |
22
+
23
+ ## Current iOS CMakeLists.txt
24
+
25
+ ```cmake
26
+ install(TARGETS simpleble ARCHIVE DESTINATION lib)
27
+
28
+ install(DIRECTORY ${PROJECT_ROOT_DIR}/simpleble/include/simpleble/ DESTINATION include/simpleble)
29
+ install(DIRECTORY ${CMAKE_BINARY_DIR}/simpleble/export/simpleble/ DESTINATION include/simpleble)
30
+ install(FILES ${PROJECT_ROOT_DIR}/dependencies/external/kvn/kvn_bytearray.h DESTINATION include/simpleble/kvn)
31
+ ```
32
+
33
+ ## Recommended Update (matching main simpleble pattern)
34
+
35
+ ```cmake
36
+ include(GNUInstallDirs)
37
+
38
+ install(TARGETS simpleble ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
39
+
40
+ install(DIRECTORY ${PROJECT_ROOT_DIR}/simpleble/include/simpleble/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/simpleble)
41
+ install(DIRECTORY ${CMAKE_BINARY_DIR}/simpleble/export/simpleble/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/simpleble)
42
+ install(FILES ${PROJECT_ROOT_DIR}/dependencies/external/kvn/kvn_bytearray.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/simpleble/kvn)
43
+ ```
44
+
45
+ ## Notes
46
+
47
+ - For iOS static builds (`BUILD_SHARED_LIBS OFF`), only `ARCHIVE` is needed
48
+ - `LIBRARY` is unnecessary since we're not building shared libraries
49
+ - Using CMake variables instead of hardcoded paths improves portability
50
+ - Header installation is required separately from library installation for XCFramework builds
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "simplejsble",
3
- "version": "0.0.28",
3
+ "version": "0.0.29",
4
4
  "description": "React Native Bluetooth Low Energy library using SimpleBLE with Nitro Modules",
5
5
  "main": "lib/index",
6
6
  "module": "lib/index",
@@ -29,7 +29,7 @@
29
29
  "prepack": "npm run build && npx nitrogen && bash scripts/prepare-package.sh",
30
30
  "typecheck": "tsc --noEmit",
31
31
  "build": "tsc",
32
- "clean": "rm -rf simpleble simpledroidbridge cmake dependencies VERSION nitrogen lib android/build android/.cxx android/.gradle ios/build_iphoneos_arm64 ios/build_iphonesimulator_arm64 ios/simpleble_iphoneos_arm64 ios/simpleble_iphonesimulator_arm64 ios/SimpleBLE.xcframework",
32
+ "clean": "rm -rf simpleble simpledroidbridge cmake dependencies VERSION nitrogen lib android/build android/.cxx android/.gradle ios/build_iphoneos_arm64 ios/build_iphonesimulator_arm64 ios/simpleble_iphoneos_arm64 ios/simpleble_iphonesimulator_arm64 ios/build_macosx_arm64 ios/build_macosx_x86_64 ios/simpleble_macosx_arm64 ios/simpleble_macosx_x86_64 ios/simpleble_macosx_universal ios/SimpleBLE.xcframework",
33
33
  "lint": "eslint \"**/*.{js,ts,tsx}\" --fix",
34
34
  "prepublishOnly": "npm run typecheck",
35
35
  "postpublish": "npm run clean",
@@ -44,7 +44,8 @@
44
44
  "nitro",
45
45
  "nitro-modules",
46
46
  "ios",
47
- "android"
47
+ "android",
48
+ "macos"
48
49
  ],
49
50
  "repository": {
50
51
  "type": "git",
package/lib/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import type { Adapter } from "./specs/Adapter.nitro";
2
- export declare const HybridAdapter: Adapter;
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAGrD,eAAO,MAAM,aAAa,SAAsD,CAAC"}
@@ -1,10 +0,0 @@
1
- import { type HybridObject } from 'react-native-nitro-modules';
2
- export interface Adapter extends HybridObject<{
3
- ios: 'c++';
4
- android: 'c++';
5
- }> {
6
- greet(name: string): string;
7
- get_adapters(): Adapter[];
8
- bluetooth_enabled(): boolean;
9
- }
10
- //# sourceMappingURL=Adapter.nitro.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Adapter.nitro.d.ts","sourceRoot":"","sources":["../../src/specs/Adapter.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAC9D,MAAM,WAAW,OAAQ,SAAQ,YAAY,CAAC;IAC5C,GAAG,EAAE,KAAK,CAAC;IACX,OAAO,EAAE,KAAK,CAAA;CACf,CAAC;IACA,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;IAC3B,YAAY,IAAI,OAAO,EAAE,CAAA;IACzB,iBAAiB,IAAI,OAAO,CAAA;CAC7B"}