cpp-define-generator: presubmit hook prints better error message
Test: cd art && ../tools/repohooks/pre-upload.py
Bug: 35381554
Change-Id: Ia8536631c8c3117aeb0bf79862757717842b3a2b
diff --git a/tools/cpp-define-generator/presubmit-check-files-up-to-date b/tools/cpp-define-generator/presubmit-check-files-up-to-date
index 67a702a..0301a3e 100755
--- a/tools/cpp-define-generator/presubmit-check-files-up-to-date
+++ b/tools/cpp-define-generator/presubmit-check-files-up-to-date
@@ -22,7 +22,11 @@
GEN_TOOL=cpp-define-generator-data
if ! which "$GEN_TOOL"; then
- echo "ERROR: Please build cpp-define-generator-data or source build/envsetup.sh" >&2
+ if [[ -z $ANDROID_BUILD_TOP ]]; then
+ echo "ERROR: Can't find '$GEN_TOOL' in \$PATH. Perhaps try 'source build/envsetup.sh' ?" >&2
+ else
+ echo "ERROR: Can't find '$GEN_TOOL' in \$PATH. Perhaps try 'make $GEN_TOOL' ?" >&2
+ fi
exit 1
fi