@geastack/apple 0.2.35 → 0.2.36

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geastack/apple",
3
- "version": "0.2.35",
3
+ "version": "0.2.36",
4
4
  "description": "Generated Apple SDK bindings plus the macOS, iOS, tvOS and watchOS native build targets for Gea apps.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -73,6 +73,21 @@ The Xcode project is generated under
73
73
  if you want to inspect signing or launch through Xcode. Do not hand-edit it as
74
74
  the source of truth.
75
75
 
76
+ ## Info.plist keys
77
+
78
+ Usage descriptions and other per-app keys go in `ios.json` (`tvos.json` for
79
+ tvOS) next to the app's `package.json`. Its `infoPlist` object is merged over
80
+ the generated `Info.plist`, as with `macos.json`. An app that uses
81
+ `bluetooth.central` needs `NSBluetoothAlwaysUsageDescription`:
82
+
83
+ ```json
84
+ {
85
+ "infoPlist": {
86
+ "NSBluetoothAlwaysUsageDescription": "Connects to your heart-rate strap."
87
+ }
88
+ }
89
+ ```
90
+
76
91
  ## tvOS
77
92
 
78
93
  Apps that declare `gea.targets.tvos` can use the shared UIKit host on tvOS 17
@@ -84,6 +84,10 @@ source "$GEA_CORE/gea_sources.sh"
84
84
  export GEA_FW_CXX_SOURCES="$(gea_fw_cxx_sources | grep -vE "/(runtime|services/[a-z_]+)\.cpp\$")"
85
85
  export GEA_FW_C_SOURCES="$(gea_fw_c_sources)"
86
86
  export GEA_FW_INCLUDE_DIRS="$(gea_fw_include_flags | sed "s/^-I//")"
87
+ # The Objective-C++ host backends (CoreBluetooth central, Security P-256,
88
+ # AudioToolbox Opus, the data directory). ios_websocket.mm already includes
89
+ # websocket_apple.mm, so it is left out here.
90
+ export GEA_FW_OBJCXX_SOURCES="$(gea_fw_objcxx_sources | grep -v "/websocket_apple\.mm$")"
87
91
  # A single app never compiles, includes or links GeaOS. GEA_GEAOS=1 requests a
88
92
  # GeaOS build: generate-xcode-project.mjs then adds these sources and include
89
93
  # roots, GEA_GEAOS=1 and the iOS GeaOS app host (main/ios_app_platform.mm).
@@ -85,6 +85,13 @@ fs.writeFileSync(
85
85
  .replaceAll('@APP_NAME@', appName)
86
86
  .replaceAll('@BUNDLE_ID@', bundleId),
87
87
  )
88
+ // The app's own keys (usage descriptions such as NSBluetoothAlwaysUsageDescription)
89
+ // come from the optional `infoPlist` object of ios.json (tvos.json for tvOS) next to
90
+ // its package.json, merged the same way macOS merges macos.json.
91
+ const uikitConfig = path.join(appRoot, tvos ? 'tvos.json' : 'ios.json')
92
+ if (fs.existsSync(uikitConfig)) {
93
+ execFileSync(process.execPath, [path.join(iosDir, '../macos/merge-info-plist.mjs'), plistOut, uikitConfig], { stdio: 'inherit' })
94
+ }
88
95
 
89
96
  function id(label) {
90
97
  return crypto.createHash('sha1').update(label).digest('hex').slice(0, 24).toUpperCase()
@@ -223,6 +230,7 @@ const sources = [
223
230
  // shell excluded — iOS uses its own UIKit run loop). Single source of truth.
224
231
  ...(process.env.GEA_FW_C_SOURCES || '').split('\n').filter(Boolean).map((f) => source(f, 'sourcecode.c.c')),
225
232
  ...(process.env.GEA_FW_CXX_SOURCES || '').split('\n').filter(Boolean).map((f) => source(f)),
233
+ ...(process.env.GEA_FW_OBJCXX_SOURCES || '').split('\n').filter(Boolean).map((f) => source(f, 'sourcecode.cpp.objcpp')),
226
234
  // gea_app_entry.cpp provides Application::init/frame, which calls the one
227
235
  // __gea_top_level geatsc emitted (deliberately not in the manifest).
228
236
  source(path.join(geaCore, 'gea_app_entry.cpp')),
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // Merge the optional `infoPlist` object of an app's macos.json into the
2
+ // Merge the optional `infoPlist` object of an app's macos.json (ios.json, tvos.json, watchos.json) into the
3
3
  // generated Info.plist, so an app can declare its own keys (for example
4
4
  // NSCalendarsFullAccessUsageDescription) without a per-app template. Each key
5
5
  // is written with `plutil -replace`, so values may be any JSON plutil accepts:
@@ -77,6 +77,25 @@ device type's `framebufferMask`, the clock measured from a blank app. A watch
77
77
  with a new panel size gets the nearest row, scaled by height, until it has its
78
78
  own.
79
79
 
80
+ ## Bluetooth and Info.plist keys
81
+
82
+ The host's Objective-C++ backends are compiled in, as on macOS: the
83
+ CoreBluetooth central (`bluetooth.central`), URLSession WebSockets, P-256 key
84
+ agreement and the Opus decoder. watchOS is central-only, so an app connects to
85
+ peripherals; it cannot advertise.
86
+
87
+ watchOS ends an app that touches Bluetooth without a usage description. Add the
88
+ keys an app needs to `watchos.json` next to its `package.json`. Its `infoPlist`
89
+ object is merged over the generated `Info.plist`, as with `macos.json`:
90
+
91
+ ```json
92
+ {
93
+ "infoPlist": {
94
+ "NSBluetoothAlwaysUsageDescription": "Connects to the bridge on your Mac."
95
+ }
96
+ }
97
+ ```
98
+
80
99
  ## Limits
81
100
 
82
101
  - Runtime `gea` apps only. Apple SDK bindings (`@geastack/apple/UIKit` and the
@@ -65,6 +65,9 @@ source "$GEA_CORE/gea_sources.sh"
65
65
  export GEA_FW_CXX_SOURCES="$(gea_fw_cxx_sources | grep -vE "/(runtime|services/[a-z_]+)\.cpp\$")"
66
66
  export GEA_FW_C_SOURCES="$(gea_fw_c_sources)"
67
67
  export GEA_FW_INCLUDE_DIRS="$(gea_fw_include_flags | sed "s/^-I//")"
68
+ # The Objective-C++ host backends: CoreBluetooth central (navigator.bluetooth.central),
69
+ # URLSession WebSocket, Security P-256, AudioToolbox Opus and the data directory.
70
+ export GEA_FW_OBJCXX_SOURCES="$(gea_fw_objcxx_sources)"
68
71
  APP_ID="${1:-counter-jsx}"
69
72
  DESTINATION="${2:-simulator}"
70
73
 
@@ -83,6 +83,13 @@ fs.writeFileSync(
83
83
  .replaceAll('@APP_DISPLAY_NAME@', displayName.replaceAll('&', '&amp;').replaceAll('<', '&lt;'))
84
84
  .replaceAll('@BUNDLE_ID@', bundleId),
85
85
  )
86
+ // The app's own keys (usage descriptions such as NSBluetoothAlwaysUsageDescription)
87
+ // come from the optional `infoPlist` object of watchos.json next to its package.json,
88
+ // merged the same way macOS merges macos.json.
89
+ const watchConfig = path.join(appRoot, 'watchos.json')
90
+ if (fs.existsSync(watchConfig)) {
91
+ execFileSync(process.execPath, [path.join(watchDir, '../macos/merge-info-plist.mjs'), plistOut, watchConfig], { stdio: 'inherit' })
92
+ }
86
93
 
87
94
  function id(label) {
88
95
  return crypto.createHash('sha1').update(label).digest('hex').slice(0, 24).toUpperCase()
@@ -157,6 +164,9 @@ const sources = [
157
164
  // build-watchos.sh (no services or single-app runtime shell).
158
165
  ...(process.env.GEA_FW_C_SOURCES || '').split('\n').filter(Boolean).map((f) => source(f, 'sourcecode.c.c')),
159
166
  ...(process.env.GEA_FW_CXX_SOURCES || '').split('\n').filter(Boolean).map((f) => source(f)),
167
+ // Each Objective-C++ backend links its own system framework (CoreBluetooth,
168
+ // Security, AudioToolbox) through a Mach-O linker option.
169
+ ...(process.env.GEA_FW_OBJCXX_SOURCES || '').split('\n').filter(Boolean).map((f) => source(f, 'sourcecode.cpp.objcpp')),
160
170
  // Application::init/frame, which call the __gea_top_level geatsc emitted.
161
171
  source(path.join(geaCore, 'gea_app_entry.cpp')),
162
172
  ...readGeatscSources(generatedDir),