Clean cruft out of envsetup.sh.

aninja and overrideflags moved to build/soong/bin

Bug: 340648588
Test: manual
Change-Id: I1d426b628f15674e142df4152661d3f4b9b56320
diff --git a/shell_utils.sh b/shell_utils.sh
index 9de5a50..15051e9 100644
--- a/shell_utils.sh
+++ b/shell_utils.sh
@@ -40,9 +40,7 @@
     fi
 }
 
-# Sets TOP, or if the root of the tree can't be found, prints a message and
-# exits.  Since this function exits, it should not be called from functions
-# defined in envsetup.sh.
+# Asserts that the root of the tree can be found.
 if [ -z "${IMPORTING_ENVSETUP:-}" ] ; then
 function require_top
 {
@@ -54,6 +52,17 @@
 }
 fi
 
+# Asserts that the lunch variables have been set
+if [ -z "${IMPORTING_ENVSETUP:-}" ] ; then
+function require_lunch
+{
+    if [[ ! $TARGET_PRODUCT || ! $TARGET_RELEASE || ! $TARGET_BUILD_VARIANT  ]] ; then
+        echo "Please run lunch and try again." >&2
+        exit 1
+    fi
+}
+fi
+
 function getoutdir
 {
     local top=$(gettop)