# HG changeset patch # User igor # Date 1283884108 25200 # Node ID 0451bcf8dfa957e355bce2067aea59ef6e3aabd7 # Parent 7388434c2fa8e608e0ba9f354786ff29fdc61cd4 6982499: ant detection is fragile on windows. especially using cygwin Reviewed-by: ohair diff -r 7388434c2fa8 -r 0451bcf8dfa9 jdk/make/common/shared/Defs.gmk --- a/jdk/make/common/shared/Defs.gmk Tue Sep 07 11:24:28 2010 -0700 +++ b/jdk/make/common/shared/Defs.gmk Tue Sep 07 11:28:28 2010 -0700 @@ -578,10 +578,23 @@ ANT_HOME := $(call DirExists,$(JDK_DEVTOOLS_DIR)/share/ant/latest,,) endif endif + +# There are few problems with ant we need to workaround: +# 1) ant is using temporary directory java.io.tmpdir +# However, this directory is not unique enough and two separate ant processes +# can easily end up using the exact same temp directory. This may lead to weird build failures +# To workaround this we will define tmp dir explicitly +# 2) ant attempts to detect JDK location based on java.exe location +# This is fragile as developer may have JRE first on the PATH. +# To workaround this we will specify JAVA_HOME explicitly + +ANT_TMPDIR = $(ABS_OUTPUTDIR)/tmp +ANT_WORKAROUNDS = ANT_OPTS=-Djava.io.tmpdir='$(ANT_TMPDIR)' JAVA_HOME='$(BOOTDIR)' + ifeq ($(ANT_HOME),) - ANT = ant + ANT = $(ANT_WORKAROUNDS) ant else - ANT = $(ANT_HOME)/bin/ant + ANT = $(ANT_WORKAROUNDS) $(ANT_HOME)/bin/ant endif ifdef ALT_COPYRIGHT_YEAR