@geastack/apple 0.2.28 → 0.2.30
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.
|
|
3
|
+
"version": "0.2.30",
|
|
4
4
|
"description": "Generated Apple SDK bindings plus the macOS, iOS and tvOS native build targets for Gea apps.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -116,9 +116,9 @@
|
|
|
116
116
|
},
|
|
117
117
|
"dependencies": {
|
|
118
118
|
"@geastack/compiler": "^1.0.34",
|
|
119
|
-
"@geastack/core": "^0.1.
|
|
119
|
+
"@geastack/core": "^0.1.59",
|
|
120
120
|
"@geastack/elements": "^0.1.7",
|
|
121
|
-
"@geastack/engine": "^0.1.
|
|
121
|
+
"@geastack/engine": "^0.1.28",
|
|
122
122
|
"@geastack/geaos": "^0.1.3",
|
|
123
123
|
"@geastack/geatsc-plugin-apple-native": "^0.1.4",
|
|
124
124
|
"@geastack/geatsc-plugin-gea": "^0.1.28",
|
package/targets/ios/build-ios.sh
CHANGED
|
@@ -267,7 +267,12 @@ show_simulator_device() {
|
|
|
267
267
|
if [[ "${GEA_IOS_OPEN_SIMULATOR:-1}" != "1" ]]; then
|
|
268
268
|
return 0
|
|
269
269
|
fi
|
|
270
|
-
|
|
270
|
+
# Only a convenience: the device boots, installs and launches without the
|
|
271
|
+
# GUI. Xcode 27 replaced Simulator.app with DeviceHub.app (bundle id
|
|
272
|
+
# com.apple.dt.Devices), which shows every booted simulator.
|
|
273
|
+
/usr/bin/open -a Simulator --args -CurrentDeviceUDID "$udid" 2>/dev/null ||
|
|
274
|
+
/usr/bin/open -b com.apple.dt.Devices 2>/dev/null ||
|
|
275
|
+
echo "Could not open Simulator.app or DeviceHub.app; the simulator runs without a window." >&2
|
|
271
276
|
}
|
|
272
277
|
|
|
273
278
|
pick_device() {
|
|
@@ -895,6 +895,8 @@ if [[ ${#RESIDENT_IDS[@]} -eq 0 ]]; then
|
|
|
895
895
|
fi
|
|
896
896
|
|
|
897
897
|
CXX_DEFINES=(
|
|
898
|
+
# Workers and AudioWorklets run in their own runtime realms on macOS.
|
|
899
|
+
-DGEA_RUNTIME_REALMS=1
|
|
898
900
|
-DGEA_EMBEDDED_ENABLE_VIRTUAL_KEYBOARD=0
|
|
899
901
|
# Desktop screens exceed the embedded default of 512 nodes. Apply the
|
|
900
902
|
# capacity consistently to generated app code and every framework TU.
|
|
@@ -907,6 +909,10 @@ CXX_DEFINES=(
|
|
|
907
909
|
# builds keep their baked atlas: the runtime path tries first, finds no
|
|
908
910
|
# registered TTF bytes there, and falls through.
|
|
909
911
|
-DGEA_EMBEDDED_TTF_RUNTIME_FONTS=1
|
|
912
|
+
# Runtime TTF slots cover the glyphs the generated font TU declares
|
|
913
|
+
# (runtimeTtfDeclaredCodepoints: the baseline plus the app's
|
|
914
|
+
# --gea-font-charset names), not just ASCII and two extras.
|
|
915
|
+
-DGEA_EMBEDDED_TTF_RUNTIME_DECLARED_GLYPHS=128
|
|
910
916
|
)
|
|
911
917
|
if [[ "${GEA_NATIVE_DEBUGGER:-0}" == "1" ]]; then
|
|
912
918
|
[[ -f "${GEA_DEBUGGER_NATIVE_SOURCE:-}" ]] || { echo "GEA_DEBUGGER_NATIVE_SOURCE must name debugger/native/macos.mm" >&2; exit 2; }
|
|
@@ -1069,6 +1075,11 @@ if [[ ${#RESIDENT_IDS[@]} -eq 0 ]]; then
|
|
|
1069
1075
|
# apple-native mode — generated app modules may be Objective-C++, this never is.
|
|
1070
1076
|
if [[ "$THERMALRIGHT_DISPLAY_TARGET" == "1" && -f "$GENERATED_FONT_CPP" ]]; then
|
|
1071
1077
|
CXX_SOURCES+=("$GENERATED_FONT_CPP")
|
|
1078
|
+
elif [[ -f "$GENERATED_FONT_CPP" ]]; then
|
|
1079
|
+
# The windowed build skips the font TU, so carry its declared glyph set
|
|
1080
|
+
# (baseline + --gea-font-charset) to the runtime TTF slots on its own.
|
|
1081
|
+
node "$ROOT_DIR/targets/macos/runtime-glyphs.mjs" --out "$GENERATED_DIR/gea_runtime_glyphs_generated.cpp" "$GENERATED_FONT_CPP"
|
|
1082
|
+
CXX_SOURCES+=("$GENERATED_DIR/gea_runtime_glyphs_generated.cpp")
|
|
1072
1083
|
fi
|
|
1073
1084
|
[[ -f "$GENERATED_ASSETS_CPP" ]] && CXX_SOURCES+=("$GENERATED_ASSETS_CPP")
|
|
1074
1085
|
else
|
|
@@ -1079,6 +1090,12 @@ else
|
|
|
1079
1090
|
CXX_SOURCES+=("$RESIDENT_REGISTRY_CPP")
|
|
1080
1091
|
for f in "${RESIDENT_GEATSC_SOURCES[@]}"; do CXX_SOURCES+=("$f"); done
|
|
1081
1092
|
for f in "${RESIDENT_FONT_CPPS[@]}"; do CXX_SOURCES+=("$f"); done
|
|
1093
|
+
# Resident font TUs prefix their symbols; the runtime TTF slots read the
|
|
1094
|
+
# union of every resident's declared glyph set through the unprefixed hook.
|
|
1095
|
+
if [[ ${#RESIDENT_FONT_CPPS[@]} -gt 0 ]]; then
|
|
1096
|
+
node "$ROOT_DIR/targets/macos/runtime-glyphs.mjs" --out "$GENERATED_DIR/gea_runtime_glyphs_generated.cpp" "${RESIDENT_FONT_CPPS[@]}"
|
|
1097
|
+
CXX_SOURCES+=("$GENERATED_DIR/gea_runtime_glyphs_generated.cpp")
|
|
1098
|
+
fi
|
|
1082
1099
|
for f in "${RESIDENT_ASSET_CPPS[@]}"; do CXX_SOURCES+=("$f"); done
|
|
1083
1100
|
for f in "${RESIDENT_ENTRY_CPPS[@]}"; do CXX_SOURCES+=("$f"); done
|
|
1084
1101
|
fi
|
|
@@ -1145,6 +1162,13 @@ fi
|
|
|
1145
1162
|
|
|
1146
1163
|
OBJ_FILES=()
|
|
1147
1164
|
|
|
1165
|
+
# Resolve the compiler and SDK together through the selected Xcode. PATH may
|
|
1166
|
+
# contain a toolchain shim whose Clang cannot consume the selected SDK headers.
|
|
1167
|
+
MACOS_CLANG="$(xcrun --sdk macosx --find clang)"
|
|
1168
|
+
MACOS_CLANGXX="$(xcrun --sdk macosx --find clang++)"
|
|
1169
|
+
SDKROOT="$(xcrun --sdk macosx --show-sdk-path)"
|
|
1170
|
+
export SDKROOT
|
|
1171
|
+
|
|
1148
1172
|
CCACHE_PREFIX=()
|
|
1149
1173
|
if [[ "${GEA_MACOS_CCACHE:-1}" != "0" ]]; then
|
|
1150
1174
|
if command -v sccache >/dev/null 2>&1; then
|
|
@@ -1156,8 +1180,8 @@ fi
|
|
|
1156
1180
|
# macOS still ships Bash 3.2, where expanding an explicitly empty array under
|
|
1157
1181
|
# `set -u` raises "unbound variable". Keep the cache prefix genuinely
|
|
1158
1182
|
# optional so GEA_MACOS_CCACHE=0 can exercise an authoritative cold build.
|
|
1159
|
-
CLANG_CMD=(${CCACHE_PREFIX[@]+"${CCACHE_PREFIX[@]}"}
|
|
1160
|
-
CLANGXX_CMD=(${CCACHE_PREFIX[@]+"${CCACHE_PREFIX[@]}"}
|
|
1183
|
+
CLANG_CMD=(${CCACHE_PREFIX[@]+"${CCACHE_PREFIX[@]}"} "$MACOS_CLANG")
|
|
1184
|
+
CLANGXX_CMD=(${CCACHE_PREFIX[@]+"${CCACHE_PREFIX[@]}"} "$MACOS_CLANGXX")
|
|
1161
1185
|
MACOS_COMPILER_VERSION="$("${CLANGXX_CMD[@]}" --version 2>/dev/null | head -n 1 || true)"
|
|
1162
1186
|
|
|
1163
1187
|
# Mangle a source path into a unique object filename. Return through a global
|
|
@@ -1186,7 +1210,7 @@ compile_signature() {
|
|
|
1186
1210
|
printf '%s ' "${CLANG_CMD[@]}"
|
|
1187
1211
|
printf '\nclangxx='
|
|
1188
1212
|
printf '%s ' "${CLANGXX_CMD[@]}"
|
|
1189
|
-
printf '\ncompiler-version=%s\n' "$MACOS_COMPILER_VERSION"
|
|
1213
|
+
printf '\ncompiler-version=%s\nsdk=%s\n' "$MACOS_COMPILER_VERSION" "$SDKROOT"
|
|
1190
1214
|
printf 'defines='
|
|
1191
1215
|
printf '%s ' "${CXX_DEFINES[@]}"
|
|
1192
1216
|
printf '\nincludes='
|
|
@@ -2012,7 +2036,7 @@ LINK_OUTPUT_TMP="$LINK_OUTPUT.tmp.$$"
|
|
|
2012
2036
|
LINK_SIGNATURE_FILE="$BUILD_DIR/link.sig"
|
|
2013
2037
|
LINK_SIGNATURE_TMP="$LINK_SIGNATURE_FILE.tmp.$$"
|
|
2014
2038
|
{
|
|
2015
|
-
printf 'compiler=%s\n' "$MACOS_COMPILER_VERSION"
|
|
2039
|
+
printf 'compiler=%s\nsdk=%s\n' "$MACOS_COMPILER_VERSION" "$SDKROOT"
|
|
2016
2040
|
printf 'opt=%s\n' "$GEA_MACOS_OPT_LEVEL"
|
|
2017
2041
|
printf 'debug=%s\n' "${GEA_MACOS_DEBUG_INFO:-}"
|
|
2018
2042
|
printf 'link=%s\n' "${MACOS_LINK_FLAGS[@]}"
|
|
@@ -2041,7 +2065,7 @@ if (( LINK_NEEDED != 0 )); then
|
|
|
2041
2065
|
# address-taken ones included, and the runtime tells callables apart by
|
|
2042
2066
|
# entry address (CallableObject::callWithReceiver finds a method's receiver
|
|
2043
2067
|
# check by it), so a folded method template ran its twin's check.
|
|
2044
|
-
macos_run_tracked_child
|
|
2068
|
+
macos_run_tracked_child "$MACOS_CLANGXX" -std=c++20 -ObjC++ -fobjc-arc "$GEA_MACOS_OPT_LEVEL" ${GEA_MACOS_DEBUG_INFO} \
|
|
2045
2069
|
"${MACOS_LINK_FLAGS[@]}" \
|
|
2046
2070
|
"${LINK_FRAMEWORKS[@]}" \
|
|
2047
2071
|
"${OBJ_FILES[@]}" \
|
|
@@ -2096,6 +2120,7 @@ else
|
|
|
2096
2120
|
done
|
|
2097
2121
|
fi
|
|
2098
2122
|
for d in "${APP_DIRS_FOR_FONTS[@]}"; do
|
|
2123
|
+
GEA_FONT_MODULE_GRAPH="$GENERATED_DIR/module-graph/gea-module-graph.json" \
|
|
2099
2124
|
node -e "
|
|
2100
2125
|
const fs = require('fs');
|
|
2101
2126
|
const path = require('path');
|
|
@@ -2110,6 +2135,11 @@ for d in "${APP_DIRS_FOR_FONTS[@]}"; do
|
|
|
2110
2135
|
if (entry.name === 'node_modules' || entry.name === 'dist') continue;
|
|
2111
2136
|
walk(full);
|
|
2112
2137
|
} else if (entry.isFile() && entry.name.endsWith('.css')) {
|
|
2138
|
+
visit(full);
|
|
2139
|
+
}
|
|
2140
|
+
}
|
|
2141
|
+
}
|
|
2142
|
+
function visit(full) {
|
|
2113
2143
|
const css = fs.readFileSync(full, 'utf8').replace(/\/\*[\s\S]*?\*\//g, '');
|
|
2114
2144
|
const re = /@font-face\s*\{([^}]+)\}/gi;
|
|
2115
2145
|
let m;
|
|
@@ -2128,6 +2158,19 @@ for d in "${APP_DIRS_FOR_FONTS[@]}"; do
|
|
|
2128
2158
|
fs.copyFileSync(resolved, dest);
|
|
2129
2159
|
console.log(' copied font:', base);
|
|
2130
2160
|
}
|
|
2161
|
+
}
|
|
2162
|
+
// CSS the app imports from workspace packages lives outside its own dir;
|
|
2163
|
+
// the module graph names every stylesheet the bundle actually pulled in.
|
|
2164
|
+
const graph = process.env.GEA_FONT_MODULE_GRAPH;
|
|
2165
|
+
if (graph && fs.existsSync(graph)) {
|
|
2166
|
+
const seen = new Set();
|
|
2167
|
+
const modules = JSON.parse(fs.readFileSync(graph, 'utf8')).modules || [];
|
|
2168
|
+
const list = Array.isArray(modules) ? modules : Object.values(modules);
|
|
2169
|
+
for (const m of list) {
|
|
2170
|
+
for (const p of [m.file, m.id, ...((m.imports || []).map((i) => i && i.resolvedId))]) {
|
|
2171
|
+
if (typeof p !== 'string' || !p.endsWith('.css') || seen.has(p) || !fs.existsSync(p)) continue;
|
|
2172
|
+
seen.add(p);
|
|
2173
|
+
visit(p);
|
|
2131
2174
|
}
|
|
2132
2175
|
}
|
|
2133
2176
|
}
|
|
@@ -2167,6 +2210,12 @@ else
|
|
|
2167
2210
|
for d in ${APP_DIRS_FOR_FONTS[@]+"${APP_DIRS_FOR_FONTS[@]}"}; do
|
|
2168
2211
|
RESOURCE_SYNC_ARGS+=(--app-dir "$d")
|
|
2169
2212
|
done
|
|
2213
|
+
# Stylesheets imported from workspace packages sit outside every app dir;
|
|
2214
|
+
# the module graph lists each one the bundle pulled in.
|
|
2215
|
+
for graph in "$GENERATED_DIR/module-graph/gea-module-graph.json" \
|
|
2216
|
+
"$GENERATED_DIR"/residents/*/module-graph/gea-module-graph.json; do
|
|
2217
|
+
[[ -f "$graph" ]] && RESOURCE_SYNC_ARGS+=(--module-graph "$graph")
|
|
2218
|
+
done
|
|
2170
2219
|
RESOURCE_SYNC_RESULT="$(node "$ROOT_DIR/targets/macos/sync-resources.mjs" "${RESOURCE_SYNC_ARGS[@]}")"
|
|
2171
2220
|
if [[ "$RESOURCE_SYNC_RESULT" == *'changed=1'* ]]; then BUNDLE_CONTENT_CHANGED=1; fi
|
|
2172
2221
|
fi
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Writes the TU that tells the engine's runtime TTF slots which glyphs beyond
|
|
3
|
+
// printable ASCII to cover (generated::runtimeTtfDeclaredCodepoints).
|
|
4
|
+
//
|
|
5
|
+
// The font generator puts that set -- its raster baseline plus every
|
|
6
|
+
// `--gea-font-charset` the app's CSS names -- into gea_embedded_font_generated.cpp,
|
|
7
|
+
// but a windowed macOS build does not link that TU (it carries baked atlases the
|
|
8
|
+
// window never uses), and resident builds prefix its symbols. Without this file
|
|
9
|
+
// the engine's weak default applies and `·`, `€`, `–` render as `?`.
|
|
10
|
+
//
|
|
11
|
+
// usage: runtime-glyphs.mjs --out <file.cpp> <gea_embedded_font_generated.cpp>...
|
|
12
|
+
import fs from 'node:fs'
|
|
13
|
+
|
|
14
|
+
const args = process.argv.slice(2)
|
|
15
|
+
const outIndex = args.indexOf('--out')
|
|
16
|
+
if (outIndex < 0 || !args[outIndex + 1]) {
|
|
17
|
+
console.error('usage: runtime-glyphs.mjs --out <file.cpp> <font-generated.cpp>...')
|
|
18
|
+
process.exit(2)
|
|
19
|
+
}
|
|
20
|
+
const out = args[outIndex + 1]
|
|
21
|
+
const inputs = args.filter((_, i) => i !== outIndex && i !== outIndex + 1)
|
|
22
|
+
|
|
23
|
+
const codepoints = new Set()
|
|
24
|
+
for (const input of inputs) {
|
|
25
|
+
if (!fs.existsSync(input)) continue
|
|
26
|
+
const match = fs.readFileSync(input, 'utf8').match(/kRuntimeTtfDeclaredCodepoints\[\]\s*=\s*\{([^}]*)\}/)
|
|
27
|
+
if (!match) continue
|
|
28
|
+
for (const token of match[1].split(',')) {
|
|
29
|
+
const value = Number(token.trim())
|
|
30
|
+
if (Number.isInteger(value) && value > 0x7e) codepoints.add(value)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const list = [...codepoints].sort((a, b) => a - b)
|
|
34
|
+
const source = [
|
|
35
|
+
'// Generated by @geastack/apple targets/macos/runtime-glyphs.mjs. Do not edit.',
|
|
36
|
+
'namespace gea::framework::graphics::generated {',
|
|
37
|
+
'',
|
|
38
|
+
`static const int kDeclared[] = {${list.length > 0 ? list.map((cp) => `0x${cp.toString(16)}`).join(', ') : '0'}};`,
|
|
39
|
+
'',
|
|
40
|
+
'const int *runtimeTtfDeclaredCodepoints(int *count)',
|
|
41
|
+
'{',
|
|
42
|
+
` if (count) *count = ${list.length};`,
|
|
43
|
+
' return kDeclared;',
|
|
44
|
+
'}',
|
|
45
|
+
'',
|
|
46
|
+
'} // namespace gea::framework::graphics::generated',
|
|
47
|
+
'',
|
|
48
|
+
].join('\n')
|
|
49
|
+
if (!fs.existsSync(out) || fs.readFileSync(out, 'utf8') !== source) fs.writeFileSync(out, source)
|
|
@@ -30,9 +30,10 @@ const manifestPath = path.resolve(value('--manifest') || '')
|
|
|
30
30
|
const configDir = value('--config-dir') ? path.resolve(value('--config-dir')) : ''
|
|
31
31
|
const appDirs = values('--app-dir').map((item) => path.resolve(item))
|
|
32
32
|
const sharedCssDirs = values('--shared-css-dir').map((item) => path.resolve(item))
|
|
33
|
+
const moduleGraphs = values('--module-graph').map((item) => path.resolve(item))
|
|
33
34
|
|
|
34
35
|
if (!value('--resources-dir') || !value('--manifest')) {
|
|
35
|
-
fail('usage: sync-resources.mjs --resources-dir <dir> --manifest <file> [--config-dir <dir>] [--app-dir <dir> ...] [--shared-css-dir <dir> ...]')
|
|
36
|
+
fail('usage: sync-resources.mjs --resources-dir <dir> --manifest <file> [--config-dir <dir>] [--app-dir <dir> ...] [--shared-css-dir <dir> ...] [--module-graph <gea-module-graph.json> ...]')
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
fs.mkdirSync(resourcesDir, { recursive: true })
|
|
@@ -71,6 +72,28 @@ function isSafeBasename(value) {
|
|
|
71
72
|
return value !== '.' && value !== '..' && path.basename(value) === value && !value.includes('/') && !value.includes('\\')
|
|
72
73
|
}
|
|
73
74
|
|
|
75
|
+
// Every stylesheet the compiled app imports, from the module graph its build
|
|
76
|
+
// wrote. This is the authority on which @font-face rules the app uses:
|
|
77
|
+
// walking the app's own folder misses CSS reached through imports, such as a
|
|
78
|
+
// workspace package of shared styles (import "../../shared").
|
|
79
|
+
function moduleGraphCss(graphPath) {
|
|
80
|
+
let graph
|
|
81
|
+
try {
|
|
82
|
+
graph = JSON.parse(fs.readFileSync(graphPath, 'utf8'))
|
|
83
|
+
} catch {
|
|
84
|
+
return []
|
|
85
|
+
}
|
|
86
|
+
const files = new Set()
|
|
87
|
+
for (const module of Array.isArray(graph?.modules) ? graph.modules : []) {
|
|
88
|
+
for (const id of [module?.file, module?.id, ...(Array.isArray(module?.imports) ? module.imports.map((item) => item?.resolvedId) : [])]) {
|
|
89
|
+
if (typeof id !== 'string') continue
|
|
90
|
+
const file = id.split(/[?#]/, 1)[0]
|
|
91
|
+
if (file.endsWith('.css') && fs.existsSync(file) && fs.statSync(file).isFile()) files.add(file)
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return [...files]
|
|
95
|
+
}
|
|
96
|
+
|
|
74
97
|
function walkCss(root, visit) {
|
|
75
98
|
if (!root || !fs.existsSync(root)) return
|
|
76
99
|
for (const entry of fs.readdirSync(root, { withFileTypes: true })) {
|
|
@@ -87,8 +110,7 @@ function walkCss(root, visit) {
|
|
|
87
110
|
const desiredFonts = new Map()
|
|
88
111
|
const desiredFontLicenses = new Map()
|
|
89
112
|
const fontAliases = new Map()
|
|
90
|
-
|
|
91
|
-
walkCss(root, (cssPath) => {
|
|
113
|
+
function visitCss(cssPath) {
|
|
92
114
|
const css = fs.readFileSync(cssPath, 'utf8').replace(/\/\*[\s\S]*?\*\//g, '')
|
|
93
115
|
const facePattern = /@font-face\s*\{([^}]+)\}/gi
|
|
94
116
|
let face
|
|
@@ -119,9 +141,11 @@ for (const root of [...appDirs, ...sharedCssDirs]) {
|
|
|
119
141
|
}
|
|
120
142
|
}
|
|
121
143
|
}
|
|
122
|
-
})
|
|
123
144
|
}
|
|
124
145
|
|
|
146
|
+
for (const graph of moduleGraphs) for (const cssPath of moduleGraphCss(graph)) visitCss(cssPath)
|
|
147
|
+
for (const root of [...appDirs, ...sharedCssDirs]) walkCss(root, visitCss)
|
|
148
|
+
|
|
125
149
|
let previousFonts = []
|
|
126
150
|
try {
|
|
127
151
|
const previous = JSON.parse(fs.readFileSync(manifestPath, 'utf8'))
|