tools: fail the release build when Discord is configured but missing

2.6.6.8 shipped without Discord and it was only noticed after publication. The SDK is resolved
from $DISCORD_SDK_DIR at configure time and gated on include/discordpp.h existing, so with the
variable unset the build quietly omits it -- no error, no warning, nothing in the log to read
afterwards. Every check that already runs on these artifacts (both cores, alignment, signing,
package, MANAGE_EXTERNAL_STORAGE) would have caught this class of mistake if one had existed.

Both scripts now verify libdiscord_partner_sdk.so in the output. With DISCORD_SDK_DIR set and
the library absent, that is FATAL -- it means the staged directory was wrong, which is easy to
get wrong given the raw SDK download ships an x86-64 .so and only the .aar carries arm64. With
the variable unset it warns loudly instead of failing, because a Discord-less build is still a
legitimate thing to produce on purpose.
This commit is contained in:
jpolo1224
2026-08-23 10:49:41 -04:00
parent ce77e85dd6
commit fb80386cc8
2 changed files with 25 additions and 0 deletions
+12
View File
@@ -77,6 +77,18 @@ echo "-- both cores in AAB (expect 4k AND 16k) --"
n_cores=$(unzip -l "$OUTPUT_AAB" | grep -cE "base/lib/arm64-v8a/libemucore_(4k|16k)\.so$" || true)
unzip -l "$OUTPUT_AAB" | grep -E "libemucore_(4k|16k)\.so" || { echo "FATAL cores missing" >&2; exit 1; }
[[ "$n_cores" -eq 2 ]] || { echo "FATAL expected 2 cores, got $n_cores" >&2; exit 1; }
echo "-- Discord Social SDK --"
# Same trap as the sideload script: DISCORD_SDK_DIR is read from the environment and gated only
# on include/discordpp.h, so an unset variable silently produces a build with no Discord. 2.6.6.8
# shipped that way and it was caught only after publishing.
if [[ -n "${DISCORD_SDK_DIR:-}" ]]; then
unzip -l "$OUTPUT_AAB" | grep -q "libdiscord_partner_sdk.so" \
|| { echo "FATAL DISCORD_SDK_DIR is set but libdiscord_partner_sdk.so is not in the bundle" >&2; exit 1; }
echo " present"
else
echo " WARNING: DISCORD_SDK_DIR unset -- this bundle has NO Discord integration." >&2
echo " Set it to the staged dir (include/ + arm64-v8a/ + .aar) before a release." >&2
fi
echo "-- package (must be $PKG) --"
unzip -p "$OUTPUT_AAB" base/manifest/AndroidManifest.xml | strings | grep -oE "come\.nanodata\.armsx2" | head -1 \
|| { echo "FATAL wrong package" >&2; exit 1; }
@@ -130,6 +130,19 @@ rm -f "$OUTPUT_APK"
echo; echo "================= VERIFY ================="
echo "-- both cores present --"
unzip -l "$OUTPUT_APK" | grep -E "libemucore_(4k|16k)\.so" || { echo "FATAL cores missing" >&2; exit 1; }
echo "-- Discord Social SDK --"
# ★ The SDK is resolved from $DISCORD_SDK_DIR at configure time and gated only on
# include/discordpp.h existing, so with the variable unset the build simply omits Discord --
# no error, no warning, nothing in the log. A whole release shipped that way (2.6.6.8) and it
# was only noticed after publication. Make it impossible to do silently again.
if [[ -n "${DISCORD_SDK_DIR:-}" ]]; then
unzip -l "$OUTPUT_APK" | grep -q "libdiscord_partner_sdk.so" \
|| { echo "FATAL DISCORD_SDK_DIR is set but libdiscord_partner_sdk.so is not in the APK" >&2; exit 1; }
echo " present"
else
echo " WARNING: DISCORD_SDK_DIR unset -- this build has NO Discord integration." >&2
echo " Set it to the staged dir (include/ + arm64-v8a/ + .aar) before a release." >&2
fi
echo "-- 16k alignment --"
"$ZIPALIGN" -c -P 16 4 "$OUTPUT_APK" && echo " zipalign OK"
echo "-- signer certs (expect BOTH old debug + new release) --"