| #!/bin/bash |
| # |
| # Helper script to run generate_gn from the CQ (and python scripts in general) |
| |
| function usage { |
| echo "Usage: generate_gn_helper.sh <path-to-chromecast_build_env.sh> <gn-root-dir>" |
| echo "chromecast_build_env.sh can be found at chromium/src/chromecast/internal/build" |
| echo "gn-root-dir is usually chromium/src (but in general is where the .gn file is)" |
| } |
| |
| function main { |
| |
| if [[ "$#" -ne 2 ]]; then |
| usage |
| exit 1 |
| fi |
| |
| local chromecast_build_env_script="$1" |
| local gn_root_dir="$2" |
| |
| if [[ ! -e "${chromecast_build_env_script}" ]]; then |
| echo "${chromecast_build_env_script} does not exist." |
| usage |
| exit 1 |
| fi |
| |
| if [[ ! -e "${gn_root_dir}" ]]; then |
| echo "${gn_root_dir} does not exist." |
| usage |
| exit 1 |
| fi |
| |
| ( |
| # Source chromecast_build_env.sh to get generate_gn and setup_chrome_env_* |
| . "${chromecast_build_env_script}" |
| |
| cd "${gn_root_dir}" |
| setup_chrome_env_clang_chromecast `pwd -P` Eng |
| generate_gn --check |
| ) |
| } |
| |
| main "$@" |