-
-
Notifications
You must be signed in to change notification settings - Fork 312
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6976 from roc-lang/debug-flags
Debug flags
- Loading branch information
Showing
3 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
# https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/ | ||
set -euo pipefail | ||
|
||
# Extract vars from .cargo/config.toml | ||
config_vars=$(grep -E "^ROC_.*= \"[01]\"" .cargo/config.toml | cut -d'=' -f1 | tr -d ' ') | ||
|
||
# Extract vars from crates/compiler/debug_flags/src/lib.rs | ||
lib_vars=$(grep -E "^ ROC_.*" crates/compiler/debug_flags/src/lib.rs | tr -d ' ') | ||
|
||
# Sort both lists | ||
sorted_config_vars=$(echo "$config_vars" | sort) | ||
sorted_lib_vars=$(echo "$lib_vars" | sort) | ||
|
||
# Compare the sorted lists | ||
if diff <(echo "$sorted_config_vars") <(echo "$sorted_lib_vars") > /dev/null; then | ||
echo "The flags in both files are identical." | ||
else | ||
echo "Looks like some flags are out of sync between .cargo/config.toml and crates/compiler/debug_flags/src/lib.rs:" | ||
diff <(echo "$sorted_config_vars") <(echo "$sorted_lib_vars") | ||
fi |