Merge "Add GYP as a target type that requires 2nd arch."
diff --git a/core/main.mk b/core/main.mk
index 6e9f75a..ec5721e 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -103,7 +103,7 @@
 # Include the google-specific config
 -include vendor/google/build/config.mk
 
-VERSION_CHECK_SEQUENCE_NUMBER := 3
+VERSION_CHECK_SEQUENCE_NUMBER := 4
 -include $(OUT_DIR)/versions_checked.mk
 ifneq ($(VERSION_CHECK_SEQUENCE_NUMBER),$(VERSIONS_CHECKED))
 
@@ -151,20 +151,26 @@
 endif
 endif
 
+java_version_str := $(shell java -version 2>&1)
+javac_version_str := $(shell javac -version 2>&1)
+
+# Check for the current jdk
 ifeq ($(requires_openjdk), true)
-ifeq ($(shell java -version 2>&1 | grep -i openjdk),)
+# The user asked for java7 openjdk, so check that the host
+# java version is really openjdk
+ifeq ($(shell echo '$(java_version_str)' | grep -i openjdk),)
 $(info ************************************************************)
 $(info You are attempting to build with an unsupported JDK.)
 $(info $(space))
 $(info This build requires OpenJDK, but you are using:)
-$(info $(shell java -version 2>&1 | head -n 2).)
+$(info $(java_version_str).)
 $(info Please follow the machine setup instructions at)
 $(info $(space)$(space)$(space)$(space)https://source.android.com/source/download.html)
 $(info ************************************************************)
 $(error stop)
 endif # java version is not OpenJdk
 else # if requires_openjdk
-ifneq ($(shell java -version 2>&1 | grep -i openjdk),)
+ifneq ($(shell echo '$(java_version_str)' | grep -i openjdk),)
 $(info ************************************************************)
 $(info You are attempting to build with an unsupported JDK.)
 $(info $(space))
@@ -180,20 +186,41 @@
 # EXPERIMENTAL_USE_JAVA7 is set, 1.6 otherwise.
 ifneq ($(EXPERIMENTAL_USE_JAVA7),)
 required_version := "1.7.x"
-java_version := $(shell java -version 2>&1 | grep '^java .*[ "]1\.7[\. "$$]' | head -n 1)
-javac_version := $(shell javac -version 2>&1 | grep '[ "]1\.7[\. "$$]' | head -n 1 )
+required_javac_version := "1.7"
+java_version := $(shell echo '$(java_version_str)' | grep '^java .*[ "]1\.7[\. "$$]' | head -n 1)
+javac_version := $(shell echo '$(javac_version_str)' | grep '[ "]1\.7[\. "$$]' | head -n 1)
 else # if EXPERIMENTAL_USE_JAVA7
 required_version := "1.6.x"
-java_version := $(shell java -version 2>&1 | grep '^java .*[ "]1\.6[\. "$$]' | head -n 1)
-javac_version := $(shell javac -version 2>&1 | grep '[ "]1\.6[\. "$$]' | head -n 1)
+required_javac_version := "1.6"
+java_version := $(shell echo '$(java_version_str)' | grep '^java .*[ "]1\.6[\. "$$]' | head -n 1)
+javac_version := $(shell echo '$(javac_version_str)' | head -n 1 | grep '[ "]1\.6[\. "$$]' | head -n 1)
 endif # if EXPERIMENTAL_USE_JAVA7
 
+ifeq ($(required_javac_version), "1.6")
+$(info ************************************************************)
+$(info You are attempting to build with java 1.6.)
+$(info Java6 support for master builds will be dropped shortly,)
+$(info please upgrade to Java7 as soon as possible.)
+$(info $(space))
+$(info Visit http://source.android.com/source/initializing.html#installing-the-jdk for details. )
+$(info $(space))
+$(info To build using java-7:)
+$(info $(space))
+$(info $$ export EXPERIMENTAL_USE_JAVA7=true)
+$(info $$ . build/envsetup.sh)
+$(info $$ lunch <target>)
+$(info $$ make clobber)
+$(info $$ make -j8)
+$(info $(space))
+$(info ************************************************************)
+endif
+
 ifeq ($(strip $(java_version)),)
 $(info ************************************************************)
 $(info You are attempting to build with the incorrect version)
 $(info of java.)
 $(info $(space))
-$(info Your version is: $(shell java -version 2>&1 | grep '^java' | head -n 1).)
+$(info Your version is: $(java_version_str).)
 $(info The required version is: $(required_version))
 $(info $(space))
 $(info Please follow the machine setup instructions at)
@@ -208,8 +235,8 @@
 $(info You are attempting to build with the incorrect version)
 $(info of javac.)
 $(info $(space))
-$(info Your version is: $(shell javac -version 2>&1 | grep '^javac' | head -n 1).)
-$(info The required version is: $(required_java_version))
+$(info Your version is: $(javac_version_str).)
+$(info The required version is: $(required_javac_version))
 $(info $(space))
 $(info Please follow the machine setup instructions at)
 $(info $(space)$(space)$(space)$(space)https://source.android.com/source/download.html)
@@ -217,6 +244,7 @@
 $(error stop)
 endif
 
+
 ifndef BUILD_EMULATOR
 ifeq (darwin,$(HOST_OS))
 GCC_REALPATH = $(realpath $(shell which $(HOST_CC)))