-
Notifications
You must be signed in to change notification settings - Fork 75
fix: Include TestGlobals.hpp is using <> instead of quotations #2618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
075eba9
81d40a7
e5ae775
5c56c35
1b15b14
69e2890
4f5e31a
f19df9e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,16 @@ else | |
| main_src_dirs=$(find ./src -maxdepth 1 -type d -exec basename {} \; | paste -sd '|' | sed 's/|/\\|/g') | ||
| fi | ||
|
|
||
| # Get a list of all header filenames in src/ and tests/ (recursively, unique) | ||
| all_local_headers=$(find ./src ./tests -type f \( -name '*.hpp' -o -name '*.h' \) -exec basename {} \; | sort -u) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need 2 implementations? |
||
|
|
||
| # Generate a sed script for batch replacements | ||
| sed_script=$(mktemp) | ||
| for header in $all_local_headers; do | ||
| escaped_header=$(printf '%s\n' "$header" | sed 's/[\/&]/\\&/g') | ||
| echo "s|#include[[:space:]]*[\"<]$escaped_header[\">]|#include \"$header\"|g" >> "$sed_script" | ||
| done | ||
|
Comment on lines
+23
to
+27
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it possible to make replacements directly, instead of generating code to make replacements? |
||
|
|
||
| fix_includes() { | ||
| file_path="$1" | ||
|
|
||
|
|
@@ -29,6 +39,9 @@ fix_includes() { | |
| sed -E "s|#include <(($main_src_dirs)/.*)>|#include \"\1\"|g" "$file_path_all_global" > "$file_path_fixed" | ||
| rm "$file_path_all_global" | ||
|
|
||
| # Make local includes without prefix to be "..." style | ||
| sed -i -f "$sed_script" "$file_path_fixed" | ||
|
|
||
| # Check if the temporary file is different from the original file | ||
| if ! cmp -s "$file_path" "$file_path_fixed"; then | ||
| # Replace the original file with the temporary file | ||
|
|
@@ -42,3 +55,6 @@ fix_includes() { | |
| for file in $files; do | ||
| fix_includes "$file" | ||
| done | ||
|
|
||
| # Remove the temporary sed script | ||
| rm "$sed_script" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have
*.hfiles