From 90758f6735620776fcb60da9e0e2c91a4f53aaf1 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Thu, 23 May 2024 14:36:23 +0000 Subject: [PATCH] 8332808: Always set java.io.tmpdir to a suitable value in the build Reviewed-by: erikj --- make/InitSupport.gmk | 3 +++ make/autoconf/spec.gmk.template | 5 ++++- make/common/JavaCompilation.gmk | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/make/InitSupport.gmk b/make/InitSupport.gmk index c59e685bf4f..b6a0a8d5d6f 100644 --- a/make/InitSupport.gmk +++ b/make/InitSupport.gmk @@ -501,9 +501,12 @@ else # $(HAS_SPEC)=true # Failure logs are only supported for "parallel" main targets, not the # (trivial) sequential make targets (such as clean and reconfigure), # since the failure-logs directory creation will conflict with clean. + # We also make sure the javatmp directory exists, which is needed if a java + # process (like javac) is using java.io.tmpdir. define PrepareFailureLogs $(RM) -r $(MAKESUPPORT_OUTPUTDIR)/failure-logs 2> /dev/null && \ $(MKDIR) -p $(MAKESUPPORT_OUTPUTDIR)/failure-logs + $(MKDIR) -p $(JAVA_TMP_DIR) $(RM) $(MAKESUPPORT_OUTPUTDIR)/exit-with-error 2> /dev/null endef diff --git a/make/autoconf/spec.gmk.template b/make/autoconf/spec.gmk.template index 7ce4038f641..7ef1aee861a 100644 --- a/make/autoconf/spec.gmk.template +++ b/make/autoconf/spec.gmk.template @@ -353,6 +353,8 @@ BUNDLES_OUTPUTDIR = $(OUTPUTDIR)/bundles TESTMAKE_OUTPUTDIR = $(OUTPUTDIR)/test-make MAKESUPPORT_OUTPUTDIR = $(OUTPUTDIR)/make-support +JAVA_TMP_DIR = $(SUPPORT_OUTPUTDIR)/javatmp + # This does not get overridden in a bootcycle build CONFIGURESUPPORT_OUTPUTDIR := @CONFIGURESUPPORT_OUTPUTDIR@ BUILDJDK_OUTPUTDIR = $(OUTPUTDIR)/buildjdk @@ -634,7 +636,8 @@ STATIC_BUILD := @STATIC_BUILD@ STRIPFLAGS := @STRIPFLAGS@ -JAVA_FLAGS := @JAVA_FLAGS@ +JAVA_FLAGS_TMPDIR := -Djava.io.tmpdir=$(JAVA_TMP_DIR) +JAVA_FLAGS := @JAVA_FLAGS@ $(JAVA_FLAGS_TMPDIR) JAVA_FLAGS_BIG := @JAVA_FLAGS_BIG@ JAVA_FLAGS_SMALL := @JAVA_FLAGS_SMALL@ BUILD_JAVA_FLAGS_SMALL := @BUILD_JAVA_FLAGS_SMALL@ diff --git a/make/common/JavaCompilation.gmk b/make/common/JavaCompilation.gmk index 259c1834da3..1503c86aff1 100644 --- a/make/common/JavaCompilation.gmk +++ b/make/common/JavaCompilation.gmk @@ -197,7 +197,7 @@ define SetupJavaCompilationBody ifeq ($$($1_COMPILER), bootjdk) # Javac server is not available when using the bootjdk compiler. - $1_JAVAC_CMD := $$(JAVAC) + $1_JAVAC_CMD := $$(JAVAC) -J$$(JAVA_FLAGS_TMPDIR) ifeq ($$($1_SMALL_JAVA), true) $1_FLAGS += $$(addprefix -J, $$(JAVA_FLAGS_SMALL)) @@ -211,7 +211,7 @@ define SetupJavaCompilationBody $1_TARGET_RELEASE := $$(TARGET_RELEASE_BOOTJDK) endif else ifeq ($$($1_COMPILER), buildjdk) - $1_JAVAC_CMD := $$(BUILD_JAVAC) + $1_JAVAC_CMD := $$(BUILD_JAVAC) -J$$(JAVA_FLAGS_TMPDIR) ifeq ($$($1_TARGET_RELEASE), ) # If unspecified, default to the new jdk we're building