@tokamakdev/platform-macos-arm64 0.1.1-beta.138 → 0.1.1-beta.139

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.
@@ -238,6 +238,9 @@ swift_type='^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)*$'
238
238
  # <directory>/<name> compiles as <plugin>-<directory>-<name>.
239
239
  plugin_sources=$temporary/plugin-sources
240
240
  mkdir "$plugin_sources"
241
+ # A plugin's compilation conditions start with its id in capitals, such as
242
+ # LOCATION_ for location, as every plugin compiles into one module.
243
+ compilation_conditions=()
241
244
  registry=$temporary/TokamakPluginRegistry.swift
242
245
  printf '%s\n\n%s\n%s\n' 'import Foundation' 'func tokamakPlugins(app: TokamakApp) -> [any TokamakPlugin] {' ' [' > "$registry"
243
246
  for plugin in "$input/plugins"/*/; do
@@ -248,6 +251,15 @@ for plugin in "$input/plugins"/*/; do
248
251
  exit 1
249
252
  fi
250
253
  printf ' %s(host: TokamakHost(app: app, plugin: "%s")),\n' "$class" "$plugin_id" >> "$registry"
254
+ condition_prefix=$(printf '%s' "$plugin_id" | tr 'a-z-' 'A-Z_')_
255
+ for condition_file in "$plugin/compilation-conditions"/*; do
256
+ condition=$(<"$condition_file")
257
+ if [[ ! "$condition" =~ ^${condition_prefix}[A-Za-z0-9_]+$ ]]; then
258
+ echo "plugin '$plugin_id' has compilation condition '$condition', which must be $condition_prefix followed by letters, digits or underscores" >&2
259
+ exit 1
260
+ fi
261
+ compilation_conditions+=(-D "$condition")
262
+ done
251
263
  [[ -d "$plugin/native" ]] || continue
252
264
  while IFS= read -r -d '' source; do
253
265
  relative=${source#"$plugin/native/"}
@@ -282,6 +294,10 @@ swift_args=(
282
294
  -Xlinker -dead_strip
283
295
  -Xlinker -exported_symbols_list -Xlinker "$exported_symbols"
284
296
  )
297
+ # Bash 3.2 cannot expand an empty array under set -u.
298
+ if [[ ${#compilation_conditions[@]} -gt 0 ]]; then
299
+ swift_args+=("${compilation_conditions[@]}")
300
+ fi
285
301
 
286
302
  # Simulator builds embed their entitlements in __TEXT,__entitlements, where
287
303
  # the simulator reads them.
@@ -21,6 +21,7 @@
21
21
  },
22
22
  "pluginKeys": {
23
23
  "class": "string",
24
+ "compilation-conditions": "strings",
24
25
  "plist": "path",
25
26
  "resources": "paths"
26
27
  }
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/macos-arm64/tools/tokamak-swift-describe
3
3
  size: 34569672 bytes
4
- sha256: e54c4a7af303167621d8e0e89d6a2b83116245651ef52801a38962552ae6b7ab
4
+ sha256: 049b62dcb8c9b294081644a0c4285824a4bbacf39e20d268dec74362b129b78a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokamakdev/platform-macos-arm64",
3
- "version": "0.1.1-beta.138",
3
+ "version": "0.1.1-beta.139",
4
4
  "description": "The tokamak platform pack for macos-arm64",
5
5
  "repository": {
6
6
  "type": "git",