From b94a868049b0f30df1bd80eab48b6098ec1eb8de Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Thu, 4 Jun 2015 18:27:42 +0200 Subject: [PATCH] 8081814: Modularize the deploy build Reviewed-by: ihse, ddehaven --- common/bin/compare.sh | 67 ++++++++++++++----------------------- make/CompileJavaModules.gmk | 12 ++++--- make/Images.gmk | 7 ++-- make/MacBundles.gmk | 12 +++---- make/Main.gmk | 28 ++++++++++------ make/MainSupport.gmk | 2 +- make/StripBinaries.gmk | 9 +++-- make/common/MakeBase.gmk | 11 ++++++ 8 files changed, 79 insertions(+), 69 deletions(-) diff --git a/common/bin/compare.sh b/common/bin/compare.sh index 8c7095296bb..ce527af478d 100644 --- a/common/bin/compare.sh +++ b/common/bin/compare.sh @@ -1188,28 +1188,11 @@ if [ "$SKIP_DEFAULT" != "true" ]; then OTHER_JDK="$OTHER/install/jdk" OTHER_JRE="$OTHER/install/jre" echo "Selecting install images for compare" - elif [ -d "$THIS/deploy/jdk" -o -d "$THIS/deploy/images/jdk" ] \ - && [ -d "$OTHER/deploy/jdk" -o -d "$OTHER/deploy/images/jdk" ]; then - if [ -d "$THIS/deploy/images/jdk" ]; then - THIS_JDK="$THIS/deploy/images/jdk" - THIS_JRE="$THIS/deploy/images/jre" - else - THIS_JDK="$THIS/deploy/jdk" - THIS_JRE="$THIS/deploy/jre" - fi - if [ -d "$OTHER/deploy/images/jdk" ]; then - OTHER_JDK="$OTHER/deploy/images/jdk" - OTHER_JRE="$OTHER/deploy/images/jre" - else - OTHER_JDK="$OTHER/deploy/jdk" - OTHER_JRE="$OTHER/deploy/jre" - fi - echo "Selecting deploy images for compare" - elif [ -d "$THIS/deploy/images/jdk" ] && [ -d "$OTHER/deploy/jdk" ]; then - THIS_JDK="$THIS/deploy/jdk" - THIS_JRE="$THIS/deploy/jre" - OTHER_JDK="$OTHER/deploy/jdk" - OTHER_JRE="$OTHER/deploy/jre" + elif [ -d "$THIS/images/jdk" ] && [ -d "$OTHER/deploy/images/jdk" ]; then + THIS_JDK="$THIS/images/jdk" + THIS_JRE="$THIS/images/jre" + OTHER_JDK="$OTHER/deploy/images/jdk" + OTHER_JRE="$OTHER/deploy/images/jre" echo "Selecting deploy images for compare" elif [ -d "$THIS/images/jdk" ] && [ -d "$OTHER/images/jdk" ]; then THIS_JDK="$THIS/images/jdk" @@ -1221,30 +1204,28 @@ if [ "$SKIP_DEFAULT" != "true" ]; then echo "No common images found." exit 1 fi + echo " $THIS_JDK" + echo " $OTHER_JDK" - if [ -d "$THIS/deploy/jdk-bundle" -o -d "$THIS/deploy/images/jdk-bundle" ] \ - && [ -d "$OTHER/deploy/jdk-bundle" -o -d "$OTHER/deploy/images/jdk-bundle" ]; then + if [ -d "$THIS/images/jdk-bundle" -o -d "$THIS/deploy/images/jdk-bundle" ] \ + && [ -d "$OTHER/images/jdk-bundle" -o -d "$OTHER/deploy/images/jdk-bundle" ]; then if [ -d "$THIS/deploy/images/jdk-bundle" ]; then THIS_JDK_BUNDLE="$THIS/deploy/images/jdk-bundle" THIS_JRE_BUNDLE="$THIS/deploy/images/jre-bundle" else - THIS_JDK_BUNDLE="$THIS/deploy/jdk-bundle" - THIS_JRE_BUNDLE="$THIS/deploy/jre-bundle" + THIS_JDK_BUNDLE="$THIS/images/jdk-bundle" + THIS_JRE_BUNDLE="$THIS/images/jre-bundle" fi if [ -d "$OTHER/deploy/images/jdk-bundle" ]; then OTHER_JDK_BUNDLE="$OTHER/deploy/images/jdk-bundle" OTHER_JRE_BUNDLE="$OTHER/deploy/images/jre-bundle" else - OTHER_JDK_BUNDLE="$OTHER/deploy/jdk-bundle" - OTHER_JRE_BUNDLE="$OTHER/deploy/jre-bundle" + OTHER_JDK_BUNDLE="$OTHER/images/jdk-bundle" + OTHER_JRE_BUNDLE="$OTHER/images/jre-bundle" fi - echo "Also comparing deploy macosx bundles" - elif [ -d "$THIS/images/jdk-bundle" ] && [ -d "$OTHER/images/jdk-bundle" ]; then - THIS_JDK_BUNDLE="$THIS/images/jdk-bundle" - THIS_JRE_BUNDLE="$THIS/images/jre-bundle" - OTHER_JDK_BUNDLE="$OTHER/images/jdk-bundle" - OTHER_JRE_BUNDLE="$OTHER/images/jre-bundle" echo "Also comparing macosx bundles" + echo " $THIS_JDK_BUNDLE" + echo " $OTHER_JDK_BUNDLE" fi if [ -d "$THIS/deploy/bundles" -o -d "$THIS/deploy/images/bundles" ] \ @@ -1262,19 +1243,21 @@ if [ "$SKIP_DEFAULT" != "true" ]; then echo "Also comparing deploy javadoc bundles" fi - if [ -d "$THIS/deploy/JavaAppletPlugin.plugin" -o -d "$THIS/deploy/images/JavaAppletPlugin.plugin" ] \ - && [ -d "$OTHER/deploy/JavaAppletPlugin.plugin" -o -d "$OTHER/deploy/images/JavaAppletPlugin.plugin" ]; then - if [ -d "$THIS/deploy/images/bundles" ]; then + if [ -d "$THIS/images/JavaAppletPlugin.plugin" ] \ + && [ -d "$OTHER/images/JavaAppletPlugin.plugin" -o -d "$OTHER/deploy/images/JavaAppletPlugin.plugin" ]; then + if [ -d "$THIS/images/JavaAppletPlugin.plugin" ]; then + THIS_DEPLOY_APPLET_PLUGIN_DIR="$THIS/images/JavaAppletPlugin.plugin" + else THIS_DEPLOY_APPLET_PLUGIN_DIR="$THIS/deploy/images/JavaAppletPlugin.plugin" - else - THIS_DEPLOY_APPLET_PLUGIN_DIR="$THIS/deploy/JavaAppletPlugin.plugin" fi - if [ -d "$OTHER/deploy/images/bundles" ]; then - OTHER_DEPLOY_APPLET_PLUGIN_DIR="$OTHER/deploy/images/JavaAppletPlugin.plugin" + if [ -d "$OTHER/images/JavaAppletPlugin.plugin" ]; then + OTHER_DEPLOY_APPLET_PLUGIN_DIR="$OTHER/images/JavaAppletPlugin.plugin" else - OTHER_DEPLOY_APPLET_PLUGIN_DIR="$OTHER/deploy/JavaAppletPlugin.plugin" + OTHER_DEPLOY_APPLET_PLUGIN_DIR="$OTHER/deploy/images/JavaAppletPlugin.plugin" fi echo "Also comparing deploy applet image" + echo " $THIS_DEPLOY_APPLET_PLUGIN_DIR" + echo " $OTHER_DEPLOY_APPLET_PLUGIN_DIR" fi if [ -d "$OTHER/images" ]; then diff --git a/make/CompileJavaModules.gmk b/make/CompileJavaModules.gmk index dfe24dfdc45..af91a283696 100644 --- a/make/CompileJavaModules.gmk +++ b/make/CompileJavaModules.gmk @@ -517,7 +517,8 @@ define SetupModuleCompilation # Find the module dependencies by parsing modules.list file $1_DEPS := $$(call FindDepsForModule, $1) - $1_CLASSPATH := $$(addprefix $(JDK_OUTPUTDIR)/modules/,$$($1_DEPS)) + $1_CLASSPATH := $$(foreach d,$$($1_DEPS), $$(if $$($$d_BIN), $$($$d_BIN), \ + $(JDK_OUTPUTDIR)/modules/$$d)) # When crypto classes are prebuilt, need to look for classes already in # output dir. ifneq ($(BUILD_CRYPTO), true) @@ -534,10 +535,10 @@ define SetupModuleCompilation $$(eval $$(call SetupJavaCompilation,$1, \ SETUP := $$(if $$($1_SETUP), $$($1_SETUP), GENERATE_JDKBYTECODE), \ SRC := $$(wildcard $$(call ALL_SRC_DIRS,$1)), \ - INCLUDES:=$(JDK_USER_DEFINED_FILTER),\ - BIN := $(JDK_OUTPUTDIR)/modules/$1, \ + INCLUDES := $(JDK_USER_DEFINED_FILTER),\ + BIN := $$(if $$($1_BIN), $$($1_BIN), $(JDK_OUTPUTDIR)/modules/$1), \ HEADERS := $(SUPPORT_OUTPUTDIR)/headers/$1, \ - ADD_JAVAC_FLAGS := $$($1_JAVAC_FLAGS))) + ADD_JAVAC_FLAGS := $$($1_ADD_JAVAC_FLAGS) $$($1_JAVAC_FLAGS))) $1: $$($1) $$($1_COPY_EXTRA) @@ -548,7 +549,8 @@ define SetupModuleCompilation # Only the javac compilation actually depends on other modules so limit # dependency declaration to that by using the *_COMPILE_TARGET variable. $$($1_COMPILE_TARGETS): $$(foreach d,$$($1_DEPS), \ - $$(call SetupJavaCompilationCompileTarget, $$d, $(JDK_OUTPUTDIR)/modules/$$d)) + $$(call SetupJavaCompilationCompileTarget, $$d, \ + $$(if $$($$d_BIN), $$($$d_BIN), $(JDK_OUTPUTDIR)/modules/$$d))) endef # Setup compilation for each module diff --git a/make/Images.gmk b/make/Images.gmk index a174a9854a4..80147ccf9d9 100644 --- a/make/Images.gmk +++ b/make/Images.gmk @@ -104,6 +104,7 @@ JIMAGE_TOOL := $(JAVA_SMALL) \ MODULES_XML += $(SRC_ROOT)/modules.xml DEPENDENCIES := $(call CacheFind, \ $(SUPPORT_OUTPUTDIR)/modules_cmds \ + $(SUPPORT_OUTPUTDIR)/modules_conf \ $(SUPPORT_OUTPUTDIR)/modules_libs) \ $(wildcard $(JDK_OUTPUTDIR)/modules/*/_*) \ $(MODULES_XML) @@ -452,10 +453,10 @@ endif # /sample dir $(eval $(call SetupCopyFiles,COPY_SAMPLES, \ - SRC := $(SUPPORT_OUTPUTDIR)/sample, \ + SRC := $(SUPPORT_OUTPUTDIR)/sample/image, \ DEST := $(JDK_IMAGE_DIR)/sample, \ - FILES := $(if $(wildcard $(SUPPORT_OUTPUTDIR)/sample), \ - $(call CacheFind,$(SUPPORT_OUTPUTDIR)/sample)))) + FILES := $(if $(wildcard $(SUPPORT_OUTPUTDIR)/sample/image), \ + $(call CacheFind,$(SUPPORT_OUTPUTDIR)/sample/image)))) JDK_TARGETS += $(COPY_SAMPLES) diff --git a/make/MacBundles.gmk b/make/MacBundles.gmk index af017d05107..a32373c8b8e 100644 --- a/make/MacBundles.gmk +++ b/make/MacBundles.gmk @@ -37,9 +37,9 @@ ifeq ($(OPENJDK_TARGET_OS), macosx) MACOSX_PLIST_SRC := $(JDK_TOPDIR)/make/data/bundle - BUNDLE_ID := $(MACOSX_BUNDLE_ID_BASE).$(JDK_MINOR_VERSION)u$(JDK_UPDATE_VERSION) + BUNDLE_ID := $(MACOSX_BUNDLE_ID_BASE).$(JDK_MINOR_VERSION)u$(JDK_UPDATE_VERSION) BUNDLE_NAME := $(MACOSX_BUNDLE_NAME_BASE) $(JDK_MINOR_VERSION) - BUNDLE_INFO := $(MACOSX_BUNDLE_NAME_BASE) $(JDK_VERSION) + BUNDLE_INFO := $(MACOSX_BUNDLE_NAME_BASE) $(JDK_VERSION) BUNDLE_PLATFORM_VERSION := $(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION) BUNDLE_VERSION := $(JDK_VERSION) ifeq ($(COMPANY_NAME), N/A) @@ -56,23 +56,23 @@ ifeq ($(OPENJDK_TARGET_OS), macosx) # Copy empty directories (jre/lib/applet). $(JDK_MACOSX_BUNDLE_DIR)/Home/%: $(JDK_IMAGE_DIR)/% - $(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@) + $(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@) $(LOG_INFO) $(MKDIR) -p $(@D) if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi $(JRE_MACOSX_BUNDLE_DIR)/Home/%: $(JRE_IMAGE_DIR)/% - $(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@) + $(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@) $(LOG_INFO) $(MKDIR) -p $(@D) if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi $(JDK_MACOSX_BUNDLE_DIR)/MacOS/libjli.dylib: - $(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@) + $(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@) $(LOG_INFO) $(MKDIR) -p $(@D) $(RM) $@ $(LN) -s ../Home/lib/jli/libjli.dylib $@ $(JRE_MACOSX_BUNDLE_DIR)/MacOS/libjli.dylib: - $(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@) + $(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@) $(LOG_INFO) $(MKDIR) -p $(@D) $(RM) $@ $(LN) -s ../Home/lib/jli/libjli.dylib $@ diff --git a/make/Main.gmk b/make/Main.gmk index 8423864ed57..13997430bb4 100644 --- a/make/Main.gmk +++ b/make/Main.gmk @@ -140,7 +140,7 @@ JAVA_TARGETS := $(addsuffix -java, $(JAVA_MODULES)) define DeclareCompileJavaRecipe $1-java: +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CompileJavaModules.gmk \ - $1 JAVA_MODULES=$1) + $1 JAVA_MODULES=$1 MODULE=$1) endef $(foreach m, $(filter-out jdk.scripting.nashorn, $(JAVA_MODULES)), \ @@ -198,13 +198,13 @@ ALL_TARGETS += hotspot ################################################################################ # Build demos and samples targets -demos: +demos-jdk: +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileDemos.gmk) -samples: +samples-jdk: +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopySamples.gmk) -ALL_TARGETS += demos samples +ALL_TARGETS += demos-jdk samples-jdk ################################################################################ # Image targets @@ -241,11 +241,11 @@ jimages: profiles: +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk profiles) -mac-bundles: +mac-bundles-jdk: +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f MacBundles.gmk) ALL_TARGETS += source-tips bootcycle-images zip-security zip-source strip-binaries \ - jrtfs-jar jimages profiles mac-bundles + jrtfs-jar jimages profiles mac-bundles-jdk ################################################################################ # Docs targets @@ -359,6 +359,8 @@ else $(RMIC_TARGETS): interim-langtools interim-corba interim-rmic + $(JAVA_TARGETS): interim-langtools + import-hotspot: hotspot $(LIBS_TARGETS): import-hotspot @@ -368,7 +370,7 @@ else # The demos are currently linking to libjvm and libjava, just like all other # jdk libs, even though they don't need to. To avoid warnings, make sure they # aren't built until after libjava and libjvm are available to link to. - demos: $(JAVA_TARGETS) + demos-jdk: $(JAVA_TARGETS) # Declare dependency from -java to -gensrc $(foreach m, $(GENSRC_MODULES), $(eval $m-java: $m-gensrc)) @@ -428,7 +430,7 @@ else profiles: exploded-image strip-binaries source-tips - mac-bundles: jimages + mac-bundles-jdk: jimages bootcycle-images: jimages @@ -489,9 +491,15 @@ $(foreach m, $(COPY_MODULES), $(eval $m: $m-copy)) ALL_MODULE_TARGETS := $(sort $(GENSRC_MODULES) $(JAVA_MODULES) \ $(GENDATA_MODULES) $(LIBS_MODULES) $(LAUNCHER_MODULES) $(COPY_MODULES)) +demos: demos-jdk + +samples: samples-jdk + # The "exploded image" is a locally runnable JDK in $(BUILD_OUTPUT)/jdk. exploded-image: $(ALL_MODULE_TARGETS) +mac-bundles: mac-bundles-jdk + # The $(BUILD_OUTPUT)/images directory contain the resulting deliverables, # and in line with this, our targets for creating these are named *-image[s]. @@ -514,8 +522,8 @@ test-image: prepare-test-image test-image-hotspot-jtreg-native \ all-images: product-images test-image docs-image ALL_TARGETS += buildtools gensrc gendata copy java rmic libs launchers \ - jdk.jdwp.agent-gensrc $(ALL_MODULE_TARGETS) exploded-image \ - product-images docs-image test-image all-images + jdk.jdwp.agent-gensrc $(ALL_MODULE_TARGETS) demos samples exploded-image \ + mac-bundles product-images docs-image test-image all-images ################################################################################ diff --git a/make/MainSupport.gmk b/make/MainSupport.gmk index bbd7b817df8..3564f8bc794 100644 --- a/make/MainSupport.gmk +++ b/make/MainSupport.gmk @@ -65,7 +65,7 @@ define Clean-java @$(PRINTF) "Cleaning java $(if $1,for $(strip $1) )..." @$(PRINTF) "\n" $(LOG_DEBUG) $(RM) -r $(JDK_OUTPUTDIR)/modules/$(strip $1) - $(RM) -r $(SUPPORT_OUTPUTDIR)/misc/$(strip $1) + $(RM) -r $(SUPPORT_OUTPUTDIR)/special_classes/$(strip $1) $(PRINTF) " done\n" $(PRINTF) "Cleaning headers $(if $1,for $(strip $1)) ..." $(RM) -r $(SUPPORT_OUTPUTDIR)/headers/$(strip $1) diff --git a/make/StripBinaries.gmk b/make/StripBinaries.gmk index c7fb8f105f1..5b1d6aaf04a 100644 --- a/make/StripBinaries.gmk +++ b/make/StripBinaries.gmk @@ -28,6 +28,9 @@ default: all include $(SPEC) include MakeBase.gmk +# Hook to include the corresponding custom file, if present. +$(eval $(call IncludeCustomExtension, , StripBinaries.gmk)) + ################################################################################ # Copy native libraries and executables to a secondary location to strip them # and filter out files that shouldn't go into the image. @@ -51,11 +54,13 @@ else endef endif +NO_STRIP_CMDS_FILTER += %.cgi + # Don't include debug info for executables. ALL_CMDS_SRC := $(filter-out %.bc %.debuginfo %.diz %.map %.pdb, \ $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_cmds -type f -o -type l)) -COPY_CMDS_SRC := $(filter %.cgi, $(ALL_CMDS_SRC)) -STRIP_CMDS_SRC := $(filter-out $(COPY_CMDS_SRC), $(ALL_CMDS_SRC)) +COPY_CMDS_SRC := $(filter $(NO_STRIP_CMDS_FILTER), $(ALL_CMDS_SRC)) +STRIP_CMDS_SRC := $(filter-out $(NO_STRIP_CMDS_FILTER), $(ALL_CMDS_SRC)) # Make sure symbolic links are copied and not stripped COPY_LIBS_SRC := \ diff --git a/make/common/MakeBase.gmk b/make/common/MakeBase.gmk index 4a88442e643..7c435dad0c1 100644 --- a/make/common/MakeBase.gmk +++ b/make/common/MakeBase.gmk @@ -753,6 +753,17 @@ DependOnVariableHelper = \ DependOnVariable = \ $(call DependOnVariableHelper,$(strip $1),$(strip $2)) +################################################################################ +# Find lib dir for module +# Param 1 - module name +ifeq ($(OPENJDK_TARGET_OS_TYPE), unix) + FindLibDirForModule = \ + $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1)$(OPENJDK_TARGET_CPU_LIBDIR) +else + FindLibDirForModule = \ + $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1) +endif + ################################################################################ # Hook to include the corresponding custom file, if present.