| # _packages completes a comma separated list of packages |
| _packages() { |
| # packages are files without extensions in build/gn/ and */packages/ |
| _values -s , $(cd ${fuchsia_dir} && echo build/gn/^*.*(.N) */packages/^*.*(.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' |
| ) |
| |
| # arguments to fx set |
| _arguments '1:arch:{_describe "arch" archs}' '--release[release build]' \ |
| '--packages[packages to build]:packages:_packages' \ |
| '--goma[use goma]' "--no-goma[don't use goma]" \ |
| "--no-ensure-goma[don't make sure goma is running]" \ |
| "--ccache[use ccache]" "--no-ccache[don't use ccache]" \ |
| "--args[arguments for gn gen]:args:{_gn_args}" \ |
| '--goma-dir[goma directory to use]:directory:_files -/' |