Skip to content

Commit

Permalink
Have gn_build.sh handle useful ninja command line options (project-ch…
Browse files Browse the repository at this point in the history
…ip#5080)

#### Problem

`gn_build.sh` is convenient for developers, but does not allow for
various useful `ninja` options (e.g. `-k 0` to collect many compiler
errors in a single run).

#### Summary of Changes

Accept and pass through the `ninja` options that make sense.
  • Loading branch information
kpschoedel authored Mar 2, 2021
1 parent 88e3115 commit 654dd88
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion gn_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,24 @@ echo ninja -C "$CHIP_ROOT/out/custom"

extra_args=""
user_args=""
ninja_args=()

while getopts :d:j:k:l:nt:vw: opt; do
case "$opt" in
[nv])
ninja_args+=("-$opt")
;;
[djkltw])
ninja_args+=("-$opt" "$OPTARG")
;;
'?')
printf '\nError: unknown option -%s\n' "$OPTARG"
printf 'Usage: %s [ninja-options] [gn-args]\n' "$0"
exit 1
;;
esac
done
shift $((OPTIND - 1))

for arg; do
case $arg in
Expand Down Expand Up @@ -141,4 +159,4 @@ gn --root="$CHIP_ROOT" gen --check --fail-on-unused-args "$CHIP_ROOT/out/release

_chip_banner "Build: Ninja build"

time ninja -C "$CHIP_ROOT/out/debug" all check
time ninja -C "$CHIP_ROOT/out/debug" "${ninja_args[@]}" all check

0 comments on commit 654dd88

Please sign in to comment.