Skip to content

Commit 768b5e3

Browse files
committed
Find slice frameworks by glob, not by the xcframework's name
xcf_slice_frameworks located each slice's bundle as <slice>/<xcframework basename>.framework. Everything this repo publishes has matching names, but the assumption fails silently rather than loudly when it does not hold: serious_python stages Python.xcframework as Python-<platform>.xcframework, and an unsigned inner framework in a renamed copy would be reported as "no slice frameworks found" instead of as unsigned. Globbing <slice>/*.framework removes the assumption. xcf_signing_identifier now walks the same enumerator instead of repeating the name-keyed lookup. Verification only -- signed output is unchanged. Keeps this helper byte-identical to dart-bridge's copy (flet-dev/dart-bridge#15).
1 parent be07a83 commit 768b5e3

1 file changed

Lines changed: 19 additions & 14 deletions

File tree

‎darwin/xcframework_signing.sh‎

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -124,16 +124,13 @@ xcf_find() {
124124
# depends on the consuming application.
125125
xcf_signing_identifier() {
126126
local xcf=$1
127-
local name plist ident
128-
name=$(basename "$xcf" .xcframework)
127+
local fw plist ident
129128

130-
local slice
131-
for slice in "$xcf"/*/; do
132-
[ -d "$slice$name.framework" ] || continue
129+
while IFS= read -r fw; do
130+
[ -n "$fw" ] || continue
133131
# Flat (iOS) layout, then versioned (macOS). Versions/Current is a
134132
# symlink to the real version directory, so skip it.
135-
for plist in "$slice$name.framework/Info.plist" \
136-
"$slice$name.framework"/Versions/*/Resources/Info.plist; do
133+
for plist in "$fw/Info.plist" "$fw"/Versions/*/Resources/Info.plist; do
137134
[ -f "$plist" ] || continue
138135
case "$plist" in */Versions/Current/*) continue ;; esac
139136
ident=$(plutil -extract CFBundleIdentifier raw -o - "$plist" 2>/dev/null) || continue
@@ -142,19 +139,27 @@ xcf_signing_identifier() {
142139
return 0
143140
fi
144141
done
145-
done
142+
done <<EOF
143+
$(xcf_slice_frameworks "$xcf")
144+
EOF
146145
return 1
147146
}
148147

149-
# Emit the per-slice <Name>.framework bundles inside an xcframework.
148+
# Emit the per-slice .framework bundles inside an xcframework.
149+
#
150+
# Found by globbing each slice directory rather than by assuming the framework is
151+
# named after the xcframework. The two normally match, but a consumer may stage a
152+
# copy under a different name -- serious_python renames Python.xcframework to
153+
# Python-<platform>.xcframework -- and a name-keyed lookup silently finds nothing
154+
# there, which would let an unsigned slice pass as "no slices to check".
150155
xcf_slice_frameworks() {
151156
local xcf=$1
152-
local name
153-
name=$(basename "$xcf" .xcframework)
154-
155-
local slice
157+
local slice fw
156158
for slice in "$xcf"/*/; do
157-
[ -d "$slice$name.framework" ] && printf '%s\n' "$slice$name.framework"
159+
[ -d "$slice" ] || continue
160+
for fw in "$slice"*.framework; do
161+
[ -d "$fw" ] && printf '%s\n' "$fw"
162+
done
158163
done
159164
return 0
160165
}

0 commit comments

Comments
 (0)