@tokamakdev/platform-ios-simulator-x64 0.1.1-beta.70 → 0.1.1-beta.71

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.
@@ -1,51 +1,55 @@
1
1
  #!/usr/bin/env bash
2
2
  set -euo pipefail
3
3
 
4
+ # The CLI runs the entrypoint from the pack root.
5
+ pack=$PWD
6
+ apple_tool=$pack/tools/tokamak-apple-signing
7
+ if [[ ! -x "$apple_tool" ]]; then
8
+ echo "Apple platform pack is missing its Apple helper: $apple_tool" >&2
9
+ exit 1
10
+ fi
11
+ if [[ $# -eq 1 && $1 == certs ]]; then
12
+ exec "$apple_tool" inventory
13
+ fi
4
14
  if [[ $# -ne 3 || $1 != build ]]; then
5
- echo "usage: entrypoint build INPUT OUTPUT" >&2
15
+ echo "usage: entrypoint build INPUT OUTPUT | entrypoint certs" >&2
6
16
  exit 2
7
17
  fi
8
18
 
9
19
  input=$2
10
20
  output=$3
11
21
  metadata=$input/metadata
12
- native_shell=$input/native-shell
13
- framework_root=$input/runtime/frameworks
14
22
  app_slug=$(cat "$metadata/app-slug")
15
23
  identifier=$(cat "$metadata/identifier")
16
24
  platform=$(cat "$metadata/platform")
17
25
  target=$(cat "$metadata/target")
18
26
  project_dir=$(cat "$metadata/project-dir")
27
+ minimum=$(<"$pack/build/$platform-deployment-target")
19
28
  output_parent=$(dirname "$output")
20
29
  module_cache=$output_parent/.tokamak/module-cache
21
30
  temporary=$(mktemp -d "${TMPDIR:-/tmp}/tokamak-apple.XXXXXX")
22
31
  trap 'rm -rf "$temporary"' EXIT
23
- apple_tool=$PWD/tools/tokamak-apple-signing
24
- if [[ ! -x "$apple_tool" ]]; then
25
- echo "Apple platform pack is missing its Apple helper: $apple_tool" >&2
26
- exit 1
27
- fi
28
32
 
29
33
  case "$target" in
30
34
  macos-arm64)
31
35
  sdk=macosx
32
- triple=arm64-apple-macos14.0
36
+ triple=arm64-apple-macos$minimum
33
37
  ;;
34
38
  macos-x64)
35
39
  sdk=macosx
36
- triple=x86_64-apple-macos14.0
40
+ triple=x86_64-apple-macos$minimum
37
41
  ;;
38
42
  ios-arm64)
39
43
  sdk=iphoneos
40
- triple=arm64-apple-ios17.0
44
+ triple=arm64-apple-ios$minimum
41
45
  ;;
42
46
  ios-simulator-arm64)
43
47
  sdk=iphonesimulator
44
- triple=arm64-apple-ios17.0-simulator
48
+ triple=arm64-apple-ios$minimum-simulator
45
49
  ;;
46
50
  ios-simulator-x64)
47
51
  sdk=iphonesimulator
48
- triple=x86_64-apple-ios17.0-simulator
52
+ triple=x86_64-apple-ios$minimum-simulator
49
53
  ;;
50
54
  *)
51
55
  echo "unsupported Apple target: $target" >&2
@@ -58,17 +62,24 @@ if [[ "$platform" == macos ]]; then
58
62
  contents=$bundle/Contents
59
63
  executable_dir=$contents/MacOS
60
64
  app_dir=$contents/Resources/app
65
+ icon=${TOKAMAK_MACOS_ICON:-}
66
+ app_files=("${TOKAMAK_MACOS_PLIST:-}" "${TOKAMAK_MACOS_ENTITLEMENTS:-}")
61
67
  else
62
68
  contents=$bundle
63
69
  executable_dir=$bundle
64
70
  app_dir=$bundle/app
71
+ icon=${TOKAMAK_IOS_ICON:-}
72
+ app_files=("${TOKAMAK_IOS_PLIST:-}" "${TOKAMAK_IOS_ENTITLEMENTS:-}")
73
+ fi
74
+ if [[ -n "$icon" && ! ( -d "$icon" && "$icon" == *.[iI][cC][oO][nN] ) ]]; then
75
+ echo "$platform.icon must be an Icon Composer .icon package: $icon" >&2
76
+ exit 1
65
77
  fi
66
- icons=$input/icons/$platform
67
78
  icon_info_plist=$output_parent/.tokamak/$(basename "$output").icon-info.plist
68
79
 
69
80
  write_plist() {
70
81
  plist_args=(plist --input "$input" --output "$temporary/Info.plist")
71
- if [[ -d "$icons/AppIcon.icon" ]]; then
82
+ if [[ -n "$icon" ]]; then
72
83
  plist_args+=(--icon-info-plist "$icon_info_plist")
73
84
  fi
74
85
  "$apple_tool" "${plist_args[@]}"
@@ -93,33 +104,30 @@ sign_bundle() {
93
104
  "$apple_tool" "${signing_args[@]}"
94
105
  }
95
106
 
107
+ # The bundle is reused while everything it is built from, apart from the
108
+ # Worker's environment and the signing settings, is unchanged.
96
109
  bundle_key_file=$output_parent/.tokamak/$(basename "$output").input-key
97
- if [[ -f "$metadata/input-key" ]]; then
98
- case "$platform" in
99
- ios) app_files=("${TOKAMAK_IOS_PLIST:-}" "${TOKAMAK_IOS_ENTITLEMENTS:-}") ;;
100
- macos) app_files=("${TOKAMAK_MACOS_PLIST:-}" "${TOKAMAK_MACOS_ENTITLEMENTS:-}") ;;
101
- esac
102
- bundle_key=$(
103
- {
104
- cat "$metadata/input-key"
105
- shasum -a 256 "$0" "$apple_tool"
106
- for app_file in "${app_files[@]}"; do
107
- if [[ -n "$app_file" ]]; then
108
- shasum -a 256 "$app_file"
109
- fi
110
- done
111
- env | LC_ALL=C sort | sed -n '/^TOKAMAK_/p' |
112
- sed '/^TOKAMAK_IOS_TEAM_ID=/d; /^TOKAMAK_IOS_SIGNING_IDENTITY=/d; /^TOKAMAK_IOS_PROVISIONING_PROFILE=/d; /^TOKAMAK_MACOS_TEAM_ID=/d; /^TOKAMAK_IOS_BUILD_NUMBER=/d; /^TOKAMAK_MACOS_BUILD_NUMBER=/d'
113
- printf '%s\n' "${DEVELOPER_DIR:-}" "$PATH"
114
- xcodebuild -version
115
- } | shasum -a 256 | cut -d ' ' -f 1
116
- )
117
- if [[ -d "$bundle" && -f "$bundle_key_file" && $(cat "$bundle_key_file") == "$bundle_key" && ( ! -d "$icons/AppIcon.icon" || -f "$icon_info_plist" ) ]]; then
118
- write_plist
119
- cp "$input/app/worker-environment.json" "$app_dir/worker-environment.json"
120
- sign_bundle
121
- exit 0
110
+ key_files=("$input" "$pack")
111
+ for key_file in "$icon" "${app_files[@]}"; do
112
+ if [[ -n "$key_file" ]]; then
113
+ key_files+=("$key_file")
122
114
  fi
115
+ done
116
+ bundle_key=$(
117
+ {
118
+ find -L "${key_files[@]}" -type f ! -path "$input/app/worker-environment.json" -print0 |
119
+ LC_ALL=C sort -z | xargs -0 shasum -a 256
120
+ env | LC_ALL=C sort | sed -n '/^TOKAMAK_/p' |
121
+ sed '/^TOKAMAK_IOS_TEAM_ID=/d; /^TOKAMAK_IOS_SIGNING_IDENTITY=/d; /^TOKAMAK_IOS_PROVISIONING_PROFILE=/d; /^TOKAMAK_MACOS_TEAM_ID=/d; /^TOKAMAK_IOS_BUILD_NUMBER=/d; /^TOKAMAK_MACOS_BUILD_NUMBER=/d'
122
+ printf '%s\n' "${DEVELOPER_DIR:-}" "$PATH"
123
+ xcodebuild -version
124
+ } | shasum -a 256 | cut -d ' ' -f 1
125
+ )
126
+ if [[ -d "$bundle" && -f "$bundle_key_file" && $(cat "$bundle_key_file") == "$bundle_key" && ( -z "$icon" || -f "$icon_info_plist" ) ]]; then
127
+ write_plist
128
+ cp "$input/app/worker-environment.json" "$app_dir/worker-environment.json"
129
+ sign_bundle
130
+ exit 0
123
131
  fi
124
132
 
125
133
  rm -f "$bundle_key_file" "$icon_info_plist"
@@ -127,36 +135,36 @@ rm -rf "$bundle"
127
135
  mkdir -p "$executable_dir" "$app_dir" "$module_cache"
128
136
  cp -R "$input/app/." "$app_dir/"
129
137
 
130
- if [[ -d "$icons/AppIcon.icon" ]]; then
138
+ if [[ -n "$icon" ]]; then
131
139
  if [[ "$platform" == macos ]]; then
132
140
  icon_output=$contents/Resources
133
- icon_minimum=14.0
134
141
  icon_targets=(--target-device mac)
135
142
  else
136
143
  icon_output=$bundle
137
- icon_minimum=17.0
138
144
  icon_targets=(--target-device iphone --target-device ipad)
139
145
  fi
146
+ # actool names the app icon after its package.
147
+ cp -R "$icon" "$temporary/AppIcon.icon"
140
148
  xcrun --sdk "$sdk" actool \
141
149
  --compile "$icon_output" \
142
150
  --platform "$sdk" \
143
- --minimum-deployment-target "$icon_minimum" \
151
+ --minimum-deployment-target "$minimum" \
144
152
  --app-icon AppIcon \
145
153
  "${icon_targets[@]}" \
146
154
  --output-partial-info-plist "$icon_info_plist" \
147
155
  --output-format human-readable-text \
148
- "$icons/AppIcon.icon"
156
+ "$temporary/AppIcon.icon"
149
157
  fi
150
158
 
151
159
  shopt -s nullglob
152
160
  swift_sources=()
153
- for source in "$native_shell"/*.swift; do
161
+ for source in "$pack/native-shell"/*.swift; do
154
162
  [[ -f "$source" ]] || continue
155
163
  swift_sources+=("$source")
156
164
  done
157
165
 
158
- if [[ ! -f "$native_shell/TokamakShell.swift" ]]; then
159
- echo "Apple native shell source is missing: $native_shell/TokamakShell.swift" >&2
166
+ if [[ ! -f "$pack/native-shell/TokamakShell.swift" ]]; then
167
+ echo "Apple native shell source is missing: $pack/native-shell/TokamakShell.swift" >&2
160
168
  exit 1
161
169
  fi
162
170
 
@@ -196,7 +204,7 @@ swift_args=(
196
204
  -Osize
197
205
  -whole-module-optimization
198
206
  -module-cache-path "$module_cache"
199
- -F "$framework_root"
207
+ -F "$pack/frameworks"
200
208
  -framework TokamakRuntime
201
209
  -framework CoreFoundation
202
210
  -lc++
@@ -220,7 +228,5 @@ xcrun --sdk "$sdk" strip -x "$executable_dir/$app_slug"
220
228
  write_plist
221
229
 
222
230
  sign_bundle
223
- if [[ -n "${bundle_key:-}" ]]; then
224
- mkdir -p "$(dirname "$bundle_key_file")"
225
- printf '%s' "$bundle_key" > "$bundle_key_file"
226
- fi
231
+ mkdir -p "$(dirname "$bundle_key_file")"
232
+ printf '%s' "$bundle_key" > "$bundle_key_file"
@@ -1,19 +1,6 @@
1
1
  {
2
2
  "tokamakVersion": "0.1.1",
3
3
  "target": "ios-simulator-x64",
4
- "artifacts": [
5
- {
6
- "kind": "runtimeLibrary",
7
- "path": "frameworks/TokamakRuntime.framework"
8
- },
9
- {
10
- "kind": "nativeShellDirectory",
11
- "path": "native-shell"
12
- }
13
- ],
14
- "requiredTools": [
15
- "xcrun"
16
- ],
17
4
  "variables": {
18
5
  "build-number": {
19
6
  "kind": "string",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokamakdev/platform-ios-simulator-x64",
3
- "version": "0.1.1-beta.70",
3
+ "version": "0.1.1-beta.71",
4
4
  "description": "The tokamak platform pack for ios-simulator-x64",
5
5
  "repository": {
6
6
  "type": "git",