| # _fx_set__board completes a board name |
| _fx_set__board() { |
| compadd ${(u)$(cd ${fuchsia_dir} >/dev/null 2>&1;echo */boards/*.gni(N:t:r) vendor/*/boards/*.gni(N:t:r))} |
| } |
| |
| # _fx_set__product completes a product name |
| _fx_set__product() { |
| compadd ${(u)$(cd ${fuchsia_dir} >/dev/null 2>&1;echo */products/*.gni(N:t:r) vendor/*/products/*.gni(N:t:r))} |
| } |
| |
| # _fx_set__package completes a package name |
| _fx_set__package() { |
| compadd $(cd ${fuchsia_dir} >/dev/null 2>&1 && echo */packages/**/^*.*(.N) vendor/*/packages/**/^*.*(.N)) |
| } |
| |
| # _packages completes a comma separated list of packages |
| _packages() { |
| # packages are files without extensions in */packages/ and vendor/*/packages/ |
| _values -s , $(cd ${fuchsia_dir} >/dev/null 2>&1 && echo */packages/**/^*.*(.N) vendor/*/packages/**/^*.*(.N)) |
| } |
| |
| # _products completes a comma separated list of products |
| _products() { |
| # products are .gni files in */products/ and vendor/*/products/ |
| _values -s , $(cd ${fuchsia_dir} >/dev/null 2>&1 && echo */products/**/*.gni(.N) vendor/*/products/**/*.gni(.N)) |
| } |
| |
| _gn_args_caching_policy() { |
| test ${ninja_file} -nt $1 |
| } |
| |
| _gn_args() { |
| if [ -z ${fuchsia_build_dir} ]; then |
| return |
| fi |
| |
| # apply a default caching policy if one isn't configured |
| local cache_policy |
| zstyle -s ":completion:${curcontext}:" cache-policy cache_policy |
| zstyle ":completion:${curcontext}:" cache-policy \ |
| ${cache_policy:-_gn_args_caching_policy} |
| |
| # if this file is newer than the cache file then the cache is stale |
| local ninja_file=${fuchsia_dir}/${fuchsia_build_dir}/build.ninja |
| |
| local -a gn_args |
| if ! _retrieve_cache gn_args ; then |
| gn_args=( $(${fuchsia_dir}/buildtools/gn args ${fuchsia_dir}/${fuchsia_build_dir} --list --short|sed -e 's/ .*//') ) |
| _store_cache gn_args gn_args |
| fi |
| |
| # complete the list of gn args with an = suffix |
| compadd -S = ${gn_args} |
| } |
| |
| # list of supported fuchsia architectures |
| local -a archs |
| archs=( |
| 'x64:64 bit Intel' |
| 'arm64:64 bit ARM' |
| ) |
| |
| # TODO: --help-args --zircon-arg |
| |
| # arguments to fx set |
| _arguments '1:arch:{_describe "arch" archs}' \ |
| '2::build_dir:{__fx_build_dir}' \ |
| '(:)--board[Use the listed board configuration]:board:_fx_set__board' \ |
| '(:)--product[Include the listed product in the build]:product:_fx_set__product' \ |
| '(:)*--available[Package to be available for pushing]:package:_fx_set__package' \ |
| '(:)*--preinstall[Package to be included in the system image]:package:_fx_set__package' \ |
| '(:)*--monolith[Package to be included in the monolithic system image]:package:_fx_set__package' \ |
| '(:)*--variant[Pass a select_variant GN arg]: ' \ |
| '(:)*--fuzz-with[A sanitizer name to fuzz with]: ' \ |
| '(:)--args[Arguments for GN gen]:args:{_gn_args}' \ |
| '(:)--goma[Use GOMA]' \ |
| "(:)--no-goma[Don't use GOMA]" \ |
| "(:)--no-ensure-goma[Don't make sure GOMA is running]" \ |
| '(:)--goma-dir[GOMA directory to use]:directory:_files -/' \ |
| "(:)--ccache[Use ccache]" \ |
| "(:)--no-ccache[Don't use ccache]" \ |
| '(:)--ide[Generate files for an IDE]:ide:(eclipse vs vs2013 vs2015 vs2017 xcode qcreator json)' \ |
| '(:)--release[Release build]' |