Uhhh It's Still Failing, Let's Try Printing Debug Info?
This commit is contained in:
parent
229cbd056e
commit
bdfb50f7c4
@ -41,11 +41,15 @@ usage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Tests that the grep implementation works as expected (older OSX grep fails)
|
# Tests that the grep implementation works as expected (older OSX grep fails)
|
||||||
test_grep() {
|
test_deps() {
|
||||||
if ! echo '#include "foo"' | grep -Eq '^\s*#\s*include\s*".+"'; then
|
if ! echo '#include "foo"' | grep -Eq '^\s*#\s*include\s*".+"'; then
|
||||||
echo "Aborting: the grep implementation fails to parse include lines"
|
echo "Aborting: the grep implementation fails to parse include lines"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
if ! echo '"foo.h"' | sed 's/"\([^"]\+\)"/\1/' | grep -Eq '^foo\.h$'; then
|
||||||
|
echo "Aborting: sed is unavailable or non-functional"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Tests if list $1 has item $2 (returning zero on a match)
|
# Tests if list $1 has item $2 (returning zero on a match)
|
||||||
@ -66,6 +70,10 @@ write_line() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log_line() {
|
||||||
|
echo $@ >&2
|
||||||
|
}
|
||||||
|
|
||||||
# Find this file!
|
# Find this file!
|
||||||
resolve_include() {
|
resolve_include() {
|
||||||
local srcdir=$1
|
local srcdir=$1
|
||||||
@ -104,10 +112,7 @@ resolve_include() {
|
|||||||
add_file() {
|
add_file() {
|
||||||
local file=$1
|
local file=$1
|
||||||
if [ -n "$file" ]; then
|
if [ -n "$file" ]; then
|
||||||
if [ -n "$DESTN" ]; then
|
log_line "Processing: $file"
|
||||||
# Log but only if not writing to stdout
|
|
||||||
echo "Processing: $file"
|
|
||||||
fi
|
|
||||||
# Get directory of the current so we can resolve relative includes
|
# Get directory of the current so we can resolve relative includes
|
||||||
local srcdir="$(dirname "$file")"
|
local srcdir="$(dirname "$file")"
|
||||||
# Read the file
|
# Read the file
|
||||||
@ -120,6 +125,7 @@ add_file() {
|
|||||||
if list_has_item "$XINCS" "$inc"; then
|
if list_has_item "$XINCS" "$inc"; then
|
||||||
# The file was excluded so error if the source attempts to use it
|
# The file was excluded so error if the source attempts to use it
|
||||||
write_line "#error Using excluded file: $inc"
|
write_line "#error Using excluded file: $inc"
|
||||||
|
log_line "Excluding: $res_inc ($inc)"
|
||||||
else
|
else
|
||||||
if ! list_has_item "$FOUND" "$res_inc"; then
|
if ! list_has_item "$FOUND" "$res_inc"; then
|
||||||
# The file was not previously encountered
|
# The file was not previously encountered
|
||||||
@ -128,6 +134,7 @@ add_file() {
|
|||||||
# But the include was flagged to keep as included
|
# But the include was flagged to keep as included
|
||||||
write_line "/**** *NOT* inlining $inc ****/"
|
write_line "/**** *NOT* inlining $inc ****/"
|
||||||
write_line "$line"
|
write_line "$line"
|
||||||
|
log_line "Not Inlining: $res_inc ($inc)"
|
||||||
else
|
else
|
||||||
# The file was neither excluded nor seen before so inline it
|
# The file was neither excluded nor seen before so inline it
|
||||||
write_line "/**** start inlining $inc ****/"
|
write_line "/**** start inlining $inc ****/"
|
||||||
@ -136,6 +143,7 @@ add_file() {
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
write_line "/**** skipping file: $inc ****/"
|
write_line "/**** skipping file: $inc ****/"
|
||||||
|
log_line "Skipping: $res_inc ($inc)"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
@ -153,10 +161,7 @@ add_file() {
|
|||||||
done < "$file"
|
done < "$file"
|
||||||
else
|
else
|
||||||
write_line "#error Unable to find \"$1\""
|
write_line "#error Unable to find \"$1\""
|
||||||
if [ -n "$DESTN" ]; then
|
log_line "Error: Unable to find: \"$1\""
|
||||||
# Log but only if not writing to stdout
|
|
||||||
echo "Error: Unable to find: \"$1\""
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,7 +194,7 @@ if [ -n "$1" ]; then
|
|||||||
if [ -n "$DESTN" ]; then
|
if [ -n "$DESTN" ]; then
|
||||||
printf "" > "$DESTN"
|
printf "" > "$DESTN"
|
||||||
fi
|
fi
|
||||||
test_grep
|
test_deps
|
||||||
add_file "$1"
|
add_file "$1"
|
||||||
else
|
else
|
||||||
echo "Input file not found: \"$1\""
|
echo "Input file not found: \"$1\""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user