Lines Matching +full:ninja +full:- +full:bin
1 #!/bin/bash
3 set -eu
11 # http://www.apache.org/licenses/LICENSE-2.0
19 # Tool to evaluate the transitive closure of the ninja dependency graph of the
28 Evaluate the reverse transitive closure of ninja targets depending on one or
33 -(no)quiet Suppresses progress output to stderr and interactive
34 alias -(no)q prompts. By default, when stderr is a tty, progress gets
39 -sep=<delim> Use 'delim' as output field separator between notice
43 -csv Shorthand for -sep=','
49 to setup the build environment, choose a target platform, and build the ninja
53 function die() { echo -e "${*}" >&2; exit 2; }
57 # output target is a ninja target that the input target depends on
62 (tr '\n' '\0' | xargs -0 "${ninja_bin}" -f "${ninja_file}" -t query) \
63 | awk -v depth="${1}" '
80 if [ -z "${ANDROID_BUILD_TOP}" ]; then
84 if [ -z "${TARGET_PRODUCT}" ]; then
88 ninja_file="${ANDROID_BUILD_TOP}/out/combined-${TARGET_PRODUCT}.ninja"
89 if [ ! -f "${ninja_file}" ]; then
93 ninja_bin="${ANDROID_BUILD_TOP}/prebuilts/build-tools/linux-x86/bin/ninja"
94 if [ ! -x "${ninja_bin}" ]; then
95 die "${me}: Cannot find ninja executable expected at ${ninja_bin}"
99 # parse the command-line
101 declare -a targets # one or more targets to evaluate
107 use_stdin=false # whether to read targets from stdin i.e. target -
109 while [ $# -gt 0 ]; do
110 case "${1:-}" in
111 -)
114 -*)
115 flag=$(expr "${1}" : '^-*\(.*\)$')
116 case "${flag:-}" in
135 targets+=("${1:-}")
141 if [ ! -v targets[0] ] && ! ${use_stdin}; then
146 if [ -t 2 ] && ! ${quiet}; then
153 if ${showProgress} && [ -t 0 ]; then
160 readonly tmpFiles=$(mktemp -d "${TMPDIR}.tdeps.XXXXXXXXX")
161 if [ -z "${tmpFiles}" ]; then
166 # isnotice in {0,1} with 1 when ninja target `target` is a license or notice.
181 # extend deps by appending targets from command-line
187 sort -u <"${newDeps}" >"${allDeps}"
194 while [ $(wc -l < "${newDeps}") -gt 0 ]; do
196 echo "depth ${depth} has "$(wc -l < "${newDeps}")" targets" >&2
200 cut -d\ -f1 "${newDeps}" | getDeps "${depth}"
202 ) | sort -n | awk '
218 diff "${oldDeps}" "${allDeps}" --old-line-format='' \
219 --new-line-format='%L' --unchanged-line-format='' > "${newDeps}"
220 set -e
225 # found all deps -- clean up last iteration of old and new
226 rm -f "${oldDeps}"
227 rm -f "${newDeps}"
230 echo $(wc -l < "${allDeps}")" targets" >&2
233 awk -v sep="${sep}" '{
238 }' "${allDeps}" | sort -n
241 echo -n "$(date '+%F %-k:%M:%S') Delete ${tmpFiles} ? [n] " >&2
243 case "${answer}" in [yY]*) rm -fr "${tmpFiles}";; esac
245 rm -fr "${tmpFiles}"