-
Notifications
You must be signed in to change notification settings - Fork 14
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
build: add execute of bear tool on top of build #140
base: master
Are you sure you want to change the base?
Conversation
If `bear` executable is available, execute it on top of build to generate compilation database. The database is stored in _build/$TARGET as compile_commands.json. JIRA: CI-127
I'm goin to add bear to phoenixrtos/build image. |
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.
some nitpicks
@@ -103,6 +103,22 @@ for i in "${ARGS[@]}"; do | |||
esac; | |||
done | |||
|
|||
if ! command -v /bin/bear &> /dev/null; then | |||
echo "'bear' executable not found. Compilation database will not be built" | |||
elif [ -z "${DO_NOT_EXEC_BEAR+x}" ]; then |
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.
i think +x
should not be needed (you're setting it to non-empty string), but this is also ok (just less common so more knowledge of how bash works is needed)
elif [ -z "${DO_NOT_EXEC_BEAR+x}" ]; then | ||
b_log "Running bear on top of build script" | ||
|
||
OUTPUT_FILE=_build/"$TARGET"/compile_commands.json |
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.
maybe put full value in "
OUTPUT_FILE=_build/"$TARGET"/compile_commands.json | |
OUTPUT_FILE="_build/$TARGET/compile_commands.json" |
b_log "Running bear on top of build script" | ||
|
||
OUTPUT_FILE=_build/"$TARGET"/compile_commands.json | ||
|
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.
maybe: ln -sf "$OUTPUT_FILE" ./compile_commands.json
to provide compilation database in project root for other tools to reuse it.
Also: if You do it, there is no need to pass OUTPUT_FILE
to the bear directly (will be handled by symlink).
If You decide on doing the global symlink please add it to .gitignore
and probably clean it up on clean
command
@@ -103,6 +103,22 @@ for i in "${ARGS[@]}"; do | |||
esac; | |||
done | |||
|
|||
if ! command -v /bin/bear &> /dev/null; then |
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.
not sure if this (re-exec) shouldn't be a first thing in the file. If build.project
would contain eg. CFLAGS="$CFLAGS -O2"
we will append -O2
twice (source + export + re-exec + second source)
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.
also: don't assume bear
is installed in bin
Description
If
bear
executable is available, execute it on top of build to generate compilation database. The database is stored in _build/$TARGET as compile_commands.json.Types of changes
How Has This Been Tested?
Checklist:
Special treatment