Switch the required host Java environment to 1.6.

The path to the Java toolchain is now explicitly
specified so no manual configuration should be
required.

Change-Id: I84abc122c557372e77e4579e9a9efe56af2b412c

The java version changed, and we made envsetup automatically find the right JAVA_HOME.

This change forces everyone to re-source envsetup.sh

Change-Id: Ieb9512d5725cca26a83debf9b0480bc20e19d5ee

Fix javadoc for Java 6.

If you don't set bootclasspath, there would be errors like:
javadoc: error - In doclet class DroidDoc, method start has thrown an exception java.lang.reflect.InvocationTargetException

Change-Id: I1b83360cb595d50577c6043d6e91b0f92e4c04d6

Avoid inheriting PRIVATE_BOOTCLASSPATH from moduels that depend on api-stubs-timestamp

The inherited value has caused build breakage on Mac build.

Change-Id: I8a1b1d6c6d411f6aaaee2d8dbd0297e3d60ab5c2

Ignore STAY_OFF_MY_LAWN when setting JAVA_HOME.

Don't check STAY_OFF_MY_LAWN in set_java_home.  That function already
refuses to update JAVA_HOME if it's set to something, which should
be sufficient for anybody who doesn't want the script to mess with it.

With this change, you can get the benefits of the 1.5/1.6 auto-selection
without having to suffer through window title changes.

Change-Id: I5cfc5d6fdf26a10b42b52925f877012c0506b9a5
diff --git a/buildspec.mk.default b/buildspec.mk.default
index 6303efc..c568a82 100644
--- a/buildspec.mk.default
+++ b/buildspec.mk.default
@@ -115,4 +115,4 @@
 # variable will be changed.  After you have modified this file with the new
 # changes (see buildspec.mk.default), update this to the new value from
 # buildspec.mk.default.
-BUILD_ENV_SEQUENCE_NUMBER := 9
+BUILD_ENV_SEQUENCE_NUMBER := 10
diff --git a/core/droiddoc.mk b/core/droiddoc.mk
index 03ffa55..ba4857b 100644
--- a/core/droiddoc.mk
+++ b/core/droiddoc.mk
@@ -57,6 +57,13 @@
 $(full_target): PRIVATE_CLASSPATH:=$(LOCAL_CLASSPATH)
 full_java_lib_deps :=
 
+$(full_target): PRIVATE_BOOTCLASSPATH :=
+ifeq ($(BUILD_OS),linux)
+# You have to set bootclasspath for javadoc manually on linux since Java 6.
+host_jdk_rt_jar := $(dir $(HOST_JDK_TOOLS_JAR))../jre/lib/rt.jar
+$(full_target): PRIVATE_BOOTCLASSPATH := $(host_jdk_rt_jar)
+endif
+
 ifneq ($(LOCAL_IS_HOST_MODULE),true)
 
 ifeq ($(LOCAL_JAVA_LIBRARIES),)
@@ -165,6 +172,7 @@
                 -templatedir $(PRIVATE_CUSTOM_TEMPLATE_DIR) \
                 -templatedir $(PRIVATE_TEMPLATE_DIR) \
                 $(PRIVATE_DROIDDOC_HTML_DIR) \
+                $(addprefix -bootclasspath ,$(PRIVATE_BOOTCLASSPATH)) \
                 $(addprefix -classpath ,$(PRIVATE_CLASSPATH)) \
                 -sourcepath $(PRIVATE_SOURCE_PATH)$(addprefix :,$(PRIVATE_CLASSPATH)) \
                 -d $(PRIVATE_OUT_DIR) \
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 86aa2f3..5f2e8bb 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -16,7 +16,7 @@
 # people who haven't re-run those will have to do so before they
 # can build.  Make sure to also update the corresponding value in
 # buildspec.mk.default and envsetup.sh.
-CORRECT_BUILD_ENV_SEQUENCE_NUMBER := 9
+CORRECT_BUILD_ENV_SEQUENCE_NUMBER := 10
 
 # ---------------------------------------------------------------
 # The product defaults to generic on hardware and sim on sim
diff --git a/core/main.mk b/core/main.mk
index a045992..09f8e5a 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -98,18 +98,15 @@
 endif
 
 
-# The windows build server currently uses 1.6.  This will be fixed.
-ifneq ($(HOST_OS),windows)
-
 # Check for the correct version of java
-java_version := $(shell java -version 2>&1 | head -n 1 | grep '[ "]1\.5[\. "$$]')
+java_version := $(shell java -version 2>&1 | head -n 1 | grep '[ "]1\.6[\. "$$]')
 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 | head -n 1).)
-$(info The correct version is: 1.5.)
+$(info The correct version is: 1.6.)
 $(info $(space))
 $(info Please follow the machine setup instructions at)
 $(info $(space)$(space)$(space)$(space)http://source.android.com/download)
@@ -118,14 +115,14 @@
 endif
 
 # Check for the correct version of javac
-javac_version := $(shell javac -version 2>&1 | head -n 1 | grep '[ "]1\.5[\. "$$]')
+javac_version := $(shell javac -version 2>&1 | head -n 1 | grep '[ "]1\.6[\. "$$]')
 ifeq ($(strip $(javac_version)),)
 $(info ************************************************************)
 $(info You are attempting to build with the incorrect version)
 $(info of javac.)
 $(info $(space))
 $(info Your version is: $(shell javac -version 2>&1 | head -n 1).)
-$(info The correct version is: 1.5.)
+$(info The correct version is: 1.6.)
 $(info $(space))
 $(info Please follow the machine setup instructions at)
 $(info $(space)$(space)$(space)$(space)http://source.android.com/download)
@@ -133,8 +130,6 @@
 $(error stop)
 endif
 
-endif # windows
-
 $(shell echo 'VERSIONS_CHECKED := $(VERSION_CHECK_SEQUENCE_NUMBER)' \
         > $(OUT_DIR)/versions_checked.mk)
 endif
diff --git a/envsetup.sh b/envsetup.sh
index 21a66c1..48003d7 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -99,6 +99,9 @@
     if [ -n $ANDROID_BUILD_PATHS ] ; then
         export PATH=${PATH/$ANDROID_BUILD_PATHS/}
     fi
+    if [ -n $ANDROID_PRE_BUILD_PATHS ] ; then
+        export PATH=${PATH/$ANDROID_PRE_BUILD_PATHS/}
+    fi
 
     # and in with the new
     CODE_REVIEWS=
@@ -109,6 +112,15 @@
     export ANDROID_BUILD_PATHS=:$(get_build_var ANDROID_BUILD_PATHS):$ANDROID_QTOOLS:$ANDROID_TOOLCHAIN:$ANDROID_EABI_TOOLCHAIN$CODE_REVIEWS
     export PATH=$PATH$ANDROID_BUILD_PATHS
 
+    unset ANDROID_JAVA_TOOLCHAIN
+    if [ -n "$JAVA_HOME" ]; then
+        export ANDROID_JAVA_TOOLCHAIN=$JAVA_HOME/bin
+    fi
+    export ANDROID_PRE_BUILD_PATHS=$ANDROID_JAVA_TOOLCHAIN
+    if [ -n "$ANDROID_PRE_BUILD_PATHS" ]; then
+        export PATH=$ANDROID_PRE_BUILD_PATHS:$PATH
+    fi
+
     unset ANDROID_PRODUCT_OUT
     export ANDROID_PRODUCT_OUT=$(get_abs_build_var PRODUCT_OUT)
     export OUT=$ANDROID_PRODUCT_OUT
@@ -134,6 +146,7 @@
 function set_stuff_for_environment()
 {
     settitle
+    set_java_home
     setpaths
     set_sequence_number
 
@@ -145,7 +158,7 @@
 
 function set_sequence_number()
 {
-    export BUILD_ENV_SEQUENCE_NUMBER=9
+    export BUILD_ENV_SEQUENCE_NUMBER=10
 }
 
 function settitle()
@@ -1056,19 +1069,19 @@
     cd $T/$pathname
 }
 
-# Force JAVA_HOME to point to java 1.5 if it isn't already set
-if [ "$STAY_OFF_MY_LAWN" = "" ]; then
+# Force JAVA_HOME to point to java 1.6 if it isn't already set
+function set_java_home() {
     if [ ! "$JAVA_HOME" ]; then
         case `uname -s` in
             Darwin)
-                export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home
+                export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
                 ;;
             *)
-                export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun
+                export JAVA_HOME=/usr/lib/jvm/java-6-sun
                 ;;
         esac
     fi
-fi
+}
 
 # determine whether arrays are zero-based (bash) or one-based (zsh)
 _xarray=(a b c)