Skip to content

Commit ec9261d

Browse files
committed
ci: package debug symbols in archives
1 parent f6aa272 commit ec9261d

File tree

1 file changed

+104
-5
lines changed

1 file changed

+104
-5
lines changed

ci/pack_artifacts.sh

Lines changed: 104 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,113 @@ ls "./${REL_BINARIES_DIR}"imageflow_* | cat
9494
ls bindings/headers/*.h | cat
9595
ls bindings/headers/imageflow_default.h | cat
9696
echo "--------------------------------"
97-
cp -R "./${REL_BINARIES_DIR}"libimageflow* ./artifacts/staging/ || true
98-
cp -R "./${REL_BINARIES_DIR}"imageflow_* ./artifacts/staging/
99-
cp -R "./${REL_BINARIES_DIR}"${LIBIMAGEFLOW_DYNAMIC} ./artifacts/staging/
100-
# tool should always exist
101-
cp -R "./${REL_BINARIES_DIR}"${IMAGEFLOW_TOOL} ./artifacts/staging/
10297
cp bindings/headers/*.h ./artifacts/staging/headers/
10398
cp bindings/headers/imageflow_default.h ./artifacts/staging/imageflow.h
10499

100+
# either static or dynamic library should exist
101+
cp -R "./${REL_BINARIES_DIR}"${LIBIMAGEFLOW_DYNAMIC} ./artifacts/staging/ || cp -R "./${REL_BINARIES_DIR}"${LIBIMAGEFLOW_STATIC} ./artifacts/staging/
102+
# tool should always exist
103+
cp -R "./${REL_BINARIES_DIR}"${IMAGEFLOW_TOOL} ./artifacts/staging/
104+
105+
106+
# Copy imageflow.dll.lib if it exists
107+
if [[ "${LIBIMAGEFLOW_DYNAMIC}" == "imageflow.dll" ]]; then
108+
cp -R "./${REL_BINARIES_DIR}"imageflow.dll.lib ./artifacts/staging/ || true
109+
fi
110+
111+
# Function to handle debug symbols for a specific binary
112+
handle_debug_symbols() {
113+
local binary="$1"
114+
local platform="$2"
115+
local symbol_type="$3"
116+
local symbol_ext="$4"
117+
118+
local source_dir="./${REL_BINARIES_DIR}"
119+
local dest_dir="./artifacts/staging"
120+
121+
case "$platform" in
122+
"macos")
123+
local symbol_path="${source_dir}${binary}.${symbol_ext}"
124+
if [ -d "$symbol_path" ]; then
125+
echo "Found ${symbol_type} directory: $symbol_path"
126+
cp -R "$symbol_path" "${dest_dir}/"
127+
fi
128+
;;
129+
"linux")
130+
local symbol_path="${source_dir}${binary}.${symbol_ext}"
131+
if [ -f "$symbol_path" ]; then
132+
echo "Found ${symbol_type} file: $symbol_path"
133+
cp "$symbol_path" "${dest_dir}/"
134+
fi
135+
;;
136+
"windows")
137+
local symbol_path="${source_dir}${binary%.*}.${symbol_ext}"
138+
if [ -f "$symbol_path" ]; then
139+
echo "Found ${symbol_type} file: $symbol_path"
140+
cp "$symbol_path" "${dest_dir}/"
141+
fi
142+
;;
143+
esac
144+
}
145+
146+
# Function to verify debug symbols for a specific binary
147+
verify_debug_symbols() {
148+
local binary="$1"
149+
local platform="$2"
150+
local symbol_type="$3"
151+
local symbol_ext="$4"
152+
153+
local dest_dir="./artifacts/staging"
154+
155+
case "$platform" in
156+
"macos")
157+
local symbol_path="${dest_dir}/${binary}.${symbol_ext}"
158+
if [ -d "$symbol_path" ]; then
159+
echo "✓ Verified ${symbol_type} directory: $symbol_path"
160+
ls -R "$symbol_path"
161+
else
162+
echo "✗ Missing ${symbol_type} directory for $binary"
163+
fi
164+
;;
165+
"linux"|"windows")
166+
local symbol_path="${dest_dir}/${binary%.*}.${symbol_ext}"
167+
if [ -f "$symbol_path" ]; then
168+
echo "✓ Verified ${symbol_type} file: $symbol_path"
169+
ls -l "$symbol_path"
170+
else
171+
echo "✗ Missing ${symbol_type} file for $binary"
172+
fi
173+
;;
174+
esac
175+
}
176+
177+
# Handle debug symbols based on platform
178+
if [[ "${LIBIMAGEFLOW_DYNAMIC}" == "libimageflow.dylib" ]]; then
179+
echo "Copying debug symbols for macOS build..."
180+
handle_debug_symbols "libimageflow.dylib" "macos" ".dSYM" "dSYM"
181+
handle_debug_symbols "imageflow_tool" "macos" ".dSYM" "dSYM"
182+
183+
echo "Verifying debug symbols in staging..."
184+
verify_debug_symbols "libimageflow.dylib" "macos" ".dSYM" "dSYM"
185+
verify_debug_symbols "imageflow_tool" "macos" ".dSYM" "dSYM"
186+
elif [[ "${LIBIMAGEFLOW_DYNAMIC}" == "libimageflow.so" ]]; then
187+
echo "Copying debug symbols for Linux build..."
188+
handle_debug_symbols "libimageflow.so" "linux" ".dwp" "dwp"
189+
handle_debug_symbols "imageflow_tool" "linux" ".dwp" "dwp"
190+
191+
echo "Verifying debug symbols in staging..."
192+
verify_debug_symbols "libimageflow.so" "linux" ".dwp" "dwp"
193+
verify_debug_symbols "imageflow_tool" "linux" ".dwp" "dwp"
194+
elif [[ "${LIBIMAGEFLOW_DYNAMIC}" == "imageflow.dll" ]]; then
195+
echo "Copying debug symbols for Windows build..."
196+
handle_debug_symbols "imageflow.dll" "windows" ".pdb" "pdb"
197+
handle_debug_symbols "imageflow_tool.exe" "windows" ".pdb" "pdb"
198+
199+
echo "Verifying debug symbols in staging..."
200+
verify_debug_symbols "imageflow.dll" "windows" ".pdb" "pdb"
201+
verify_debug_symbols "imageflow_tool.exe" "windows" ".pdb" "pdb"
202+
fi
203+
105204
# Verify and copy installation scripts, IF LIBIMAGEFLOW_DYNAMIC!=imageflow.dll
106205
if [ "${LIBIMAGEFLOW_DYNAMIC}" != "imageflow.dll" ]; then
107206
for script in "./ci/packaging_extras/"{install,uninstall}.sh; do

0 commit comments

Comments
 (0)