Skip to content

Commit 81580ad

Browse files
committed
Work around strip bug on rustc and cargo
1 parent cdb45d6 commit 81580ad

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

main.sh

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,20 @@ fi
252252

253253
workspace_root=$(jq <<<"${metadata}" -r '.workspace_root')
254254
# TODO: This is a somewhat rough check as it does not look at the type of profile.
255-
if ! grep -Eq '^strip\s*=' "${workspace_root}/Cargo.toml" && [[ -z "${CARGO_PROFILE_RELEASE_STRIP:-}" ]]; then
255+
if ! grep -Eq '^\s*strip\s*=' "${workspace_root}/Cargo.toml" && [[ -z "${CARGO_PROFILE_RELEASE_STRIP:-}" ]]; then
256256
# On pre-1.77, align to Cargo 1.77+'s default: https://github.com/rust-lang/cargo/pull/13257
257+
# However, set env on pre-1.79 because it is 1.79+ that actually works correctly due to https://github.com/rust-lang/cargo/issues/13617.
257258
# strip option builds requires Cargo 1.59
258-
if [[ "${rustc_minor_version}" -lt 77 ]] && [[ "${rustc_minor_version}" -ge 59 ]]; then
259-
export CARGO_PROFILE_RELEASE_STRIP=debuginfo
260-
fi
259+
case "${target}" in
260+
# Do not strip debuginfo on MSVC https://github.com/rust-lang/cargo/pull/13630
261+
# This is the same behavior as pre-1.19.0 upload-rust-binary-action.
262+
*-pc-windows-msvc) ;;
263+
*)
264+
if [[ "${rustc_minor_version}" -lt 79 ]] && [[ "${rustc_minor_version}" -ge 59 ]]; then
265+
export CARGO_PROFILE_RELEASE_STRIP=debuginfo
266+
fi
267+
;;
268+
esac
261269
fi
262270

263271
build() {

0 commit comments

Comments
 (0)