Skip to content

Commit

Permalink
8189861: Refactor CacheFind
Browse files Browse the repository at this point in the history
Reviewed-by: tbell
  • Loading branch information
erikj79 committed Oct 24, 2017
1 parent 3880f3d commit 778fd08
Show file tree
Hide file tree
Showing 31 changed files with 480 additions and 236 deletions.
17 changes: 9 additions & 8 deletions make/Bundles.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ define SetupBundleFileBody

$(BUNDLES_OUTPUTDIR)/$$($1_BUNDLE_NAME): $$($1_FILES)
$$(call MakeTargetDir)
# If any of the files contain a space in the file name, CacheFind
# If any of the files contain a space in the file name, FindFiles
# will have replaced it with ?. Tar does not accept that so need to
# switch it back.
$$(foreach d, $$($1_BASE_DIRS), \
Expand Down Expand Up @@ -166,11 +166,12 @@ endif
################################################################################

ifneq ($(filter product-bundles legacy-bundles, $(MAKECMDGOALS)), )
$(eval $(call FillCacheFind, $(IMAGES_OUTPUTDIR)))

SYMBOLS_EXCLUDE_PATTERN := %.debuginfo %.diz %.pdb %.map

ALL_JDK_FILES := $(call CacheFind, $(JDK_IMAGE_DIR))
# There may be files with spaces in the names, so use ShellFindFiles
# explicitly.
ALL_JDK_FILES := $(call ShellFindFiles, $(JDK_IMAGE_DIR))

# Create special filter rules when dealing with unzipped .dSYM directories on
# macosx
Expand Down Expand Up @@ -201,11 +202,11 @@ ifneq ($(filter product-bundles legacy-bundles, $(MAKECMDGOALS)), )
$(ALL_JDK_FILES) \
) \
) \
$(call CacheFind, $(SYMBOLS_IMAGE_DIR))
$(call FindFiles, $(SYMBOLS_IMAGE_DIR))

TEST_DEMOS_BUNDLE_FILES := $(filter $(JDK_IMAGE_HOMEDIR)/demo/%, $(ALL_JDK_FILES))

ALL_JRE_FILES := $(call CacheFind, $(JRE_IMAGE_DIR))
ALL_JRE_FILES := $(call ShellFindFiles, $(JRE_IMAGE_DIR))

# Create special filter rules when dealing with unzipped .dSYM directories on
# macosx
Expand Down Expand Up @@ -266,7 +267,7 @@ endif
################################################################################

ifneq ($(filter test-bundles, $(MAKECMDGOALS)), )
TEST_BUNDLE_FILES := $(call CacheFind, $(TEST_IMAGE_DIR))
TEST_BUNDLE_FILES := $(call FindFiles, $(TEST_IMAGE_DIR))

$(eval $(call SetupBundleFile, BUILD_TEST_BUNDLE, \
BUNDLE_NAME := $(TEST_BUNDLE_NAME), \
Expand All @@ -280,7 +281,7 @@ endif
################################################################################

ifneq ($(filter docs-bundles, $(MAKECMDGOALS)), )
DOCS_BUNDLE_FILES := $(call CacheFind, $(DOCS_IMAGE_DIR))
DOCS_BUNDLE_FILES := $(call FindFiles, $(DOCS_IMAGE_DIR))

$(eval $(call SetupBundleFile, BUILD_DOCS_BUNDLE, \
BUNDLE_NAME := $(DOCS_BUNDLE_NAME), \
Expand All @@ -295,7 +296,7 @@ endif
################################################################################

ifneq ($(filter jcov-bundles, $(MAKECMDGOALS)), )
JCOV_BUNDLE_FILES := $(call CacheFind, $(JCOV_IMAGE_DIR))
JCOV_BUNDLE_FILES := $(call FindFiles, $(JCOV_IMAGE_DIR))

$(eval $(call SetupBundleFile, BUILD_JCOV_BUNDLE, \
BUNDLE_NAME := $(JCOV_BUNDLE_NAME), \
Expand Down
10 changes: 5 additions & 5 deletions make/CompileDemos.gmk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -43,7 +43,7 @@ $(eval $(call IncludeCustomExtension, CompileDemos-pre.gmk))
# Prepare the find cache.
DEMO_SRC_DIRS += $(TOPDIR)/src/demo

$(eval $(call FillCacheFind, $(wildcard $(DEMO_SRC_DIRS))))
$(call FillFindCache, $(DEMO_SRC_DIRS))

# Append demo goals to this variable.
TARGETS =
Expand Down Expand Up @@ -237,11 +237,11 @@ $(SUPPORT_OUTPUTDIR)/demos/image/nbproject/%: $(DEMO_SHARE_SRC)/nbproject/%
ifeq ($(call isTargetOs, solaris), true)
TARGETS += $(patsubst $(DEMO_SHARE_SRC)/nbproject/%, \
$(SUPPORT_OUTPUTDIR)/demos/image/nbproject/%, \
$(call CacheFind, $(DEMO_SHARE_SRC)/nbproject))
$(call FindFiles, $(DEMO_SHARE_SRC)/nbproject))
else
TARGETS += $(patsubst $(DEMO_SHARE_SRC)/nbproject/%, \
$(SUPPORT_OUTPUTDIR)/demos/image/nbproject/%, \
$(call CacheFind, $(DEMO_SHARE_SRC)/nbproject))
$(call FindFiles, $(DEMO_SHARE_SRC)/nbproject))
endif

################################################################################
Expand All @@ -250,7 +250,7 @@ ifneq ($(filter images, $(MAKECMDGOALS)), )
$(eval $(call SetupCopyFiles, COPY_TO_TEST_IMAGE, \
SRC := $(SUPPORT_OUTPUTDIR)/demos/image, \
DEST := $(TEST_IMAGE_DIR)/jdk/demos, \
FILES := $(call CacheFind, $(SUPPORT_OUTPUTDIR)/demos/image), \
FILES := $(call FindFiles, $(SUPPORT_OUTPUTDIR)/demos/image), \
))

IMAGES_TARGETS := $(COPY_TO_TEST_IMAGE)
Expand Down
2 changes: 1 addition & 1 deletion make/CompileJavaModules.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ endif

ifneq ($(wildcard $(IMPORT_MODULE_DIR)), )
$(JDK_OUTPUTDIR)/modules/$(MODULE)/_imported.marker: \
$(call CacheFind, $(IMPORT_MODULE_DIR))
$(call FindFiles, $(IMPORT_MODULE_DIR))
$(call MakeDir, $(@D))
# Do not delete marker and build meta data files
$(RM) -r $(filter-out $(@D)/_%, $(wildcard $(@D)/*))
Expand Down
16 changes: 8 additions & 8 deletions make/CopyImportModules.gmk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -35,7 +35,7 @@ LIBS_DIR := $(wildcard $(addsuffix /$(MODULE), $(IMPORT_MODULES_LIBS)))
CMDS_DIR := $(wildcard $(addsuffix /$(MODULE), $(IMPORT_MODULES_CMDS)))
CONF_DIR := $(wildcard $(addsuffix /$(MODULE), $(IMPORT_MODULES_CONF)))

$(eval $(call FillCacheFind, $(LIBS_DIR) $(CMDS_DIR) $(CONF_DIR)))
$(call FillFindCache, $(LIBS_DIR) $(CMDS_DIR) $(CONF_DIR))

ifneq ($(LIBS_DIR), )
ifeq ($(call isTargetOs, windows), true)
Expand All @@ -45,21 +45,21 @@ ifneq ($(LIBS_DIR), )
SRC := $(LIBS_DIR), \
DEST := $(JDK_OUTPUTDIR)/bin, \
FILES := $(filter $(TO_BIN_FILTER), \
$(call CacheFind, $(LIBS_DIR))) \
$(call FindFiles, $(LIBS_DIR))) \
))

$(eval $(call SetupCopyFiles, COPY_LIBS_TO_LIB, \
SRC := $(LIBS_DIR), \
DEST := $(JDK_OUTPUTDIR)/lib, \
FILES := $(filter-out $(TO_BIN_FILTER), \
$(call CacheFind, $(LIBS_DIR))) \
$(call FindFiles, $(LIBS_DIR))) \
))
TARGETS += $(COPY_LIBS_TO_BIN) $(COPY_LIBS_TO_LIB)
else
$(eval $(call SetupCopyFiles, COPY_LIBS, \
SRC := $(LIBS_DIR), \
DEST := $(JDK_OUTPUTDIR)/lib, \
FILES := $(filter %$(SHARED_LIBRARY_SUFFIX), $(call CacheFind, $(LIBS_DIR))), \
FILES := $(filter %$(SHARED_LIBRARY_SUFFIX), $(call FindFiles, $(LIBS_DIR))), \
))

# Use relative links if the import dir is inside the OUTPUTDIR, otherwise
Expand All @@ -75,7 +75,7 @@ ifneq ($(LIBS_DIR), )
$(eval $(call SetupCopyFiles, LINK_LIBS, \
SRC := $(LIBS_DIR), \
DEST := $(JDK_OUTPUTDIR)/lib, \
FILES := $(filter-out %$(SHARED_LIBRARY_SUFFIX), $(call CacheFind, $(LIBS_DIR))), \
FILES := $(filter-out %$(SHARED_LIBRARY_SUFFIX), $(call FindFiles, $(LIBS_DIR))), \
MACRO := $(LINK_MACRO), \
LOG_ACTION := $(LOG_ACTION), \
))
Expand All @@ -87,7 +87,7 @@ ifneq ($(CMDS_DIR), )
$(eval $(call SetupCopyFiles, COPY_CMDS, \
SRC := $(CMDS_DIR), \
DEST := $(JDK_OUTPUTDIR)/bin, \
FILES := $(call CacheFind, $(CMDS_DIR)), \
FILES := $(call FindFiles, $(CMDS_DIR)), \
))
TARGETS += $(COPY_CMDS)
endif
Expand All @@ -96,7 +96,7 @@ ifneq ($(CONF_DIR), )
$(eval $(call SetupCopyFiles, COPY_CONF, \
SRC := $(CONF_DIR), \
DEST := $(JDK_OUTPUTDIR)/lib, \
FILES := $(call CacheFind, $(CONF_DIR)), \
FILES := $(call FindFiles, $(CONF_DIR)), \
))
TARGETS += $(COPY_CONF)
endif
Expand Down
6 changes: 3 additions & 3 deletions make/CreateBuildJdkCopy.gmk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -39,7 +39,7 @@ MODULES_TO_COPY := $(sort \

COPY_CLASSES_TARGET := $(BUILDJDK_OUTPUTDIR)/jdk/modules/java.base/_the.buildjdk-copy-marker

$(COPY_CLASSES_TARGET): $(call CacheFind, $(wildcard \
$(COPY_CLASSES_TARGET): $(call FindFiles, $(wildcard \
$(addprefix $(JDK_OUTPUTDIR)/modules/, $(MODULES_TO_COPY))))
$(call LogInfo, Copying java modules to buildjdk: $(MODULES_TO_COPY))
$(RM) -r $(BUILDJDK_OUTPUTDIR)/jdk/modules
Expand All @@ -56,7 +56,7 @@ TARGETS += $(COPY_CLASSES_TARGET)
$(eval $(call SetupCopyFiles, COPY_SUPPORT_HEADERS, \
SRC := $(OUTPUTDIR), \
DEST := $(BUILDJDK_OUTPUTDIR), \
FILES := $(call CacheFind, $(wildcard \
FILES := $(call FindFiles, $(wildcard \
$(addprefix $(SUPPORT_OUTPUTDIR)/headers/, $(MODULES_TO_COPY)))), \
))

Expand Down
20 changes: 10 additions & 10 deletions make/CreateJmods.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -53,33 +53,33 @@ INCLUDE_HEADERS_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
MAN_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
$(SUPPORT_OUTPUTDIR)/modules_man $(IMPORT_MODULES_MAN))))

$(eval $(call FillCacheFind, \
$(call FillFindCache, \
$(LIBS_DIR) $(CMDS_DIR) $(CONF_DIR) $(CLASSES_DIR) \
))
)

ifneq ($(LIBS_DIR), )
JMOD_FLAGS += --libs $(LIBS_DIR)
DEPS += $(call CacheFind, $(LIBS_DIR))
DEPS += $(call FindFiles, $(LIBS_DIR))
endif
ifneq ($(CMDS_DIR), )
JMOD_FLAGS += --cmds $(CMDS_DIR)
DEPS += $(call CacheFind, $(CMDS_DIR))
DEPS += $(call FindFiles, $(CMDS_DIR))
endif
ifneq ($(CONF_DIR), )
JMOD_FLAGS += --config $(CONF_DIR)
DEPS += $(call CacheFind, $(CONF_DIR))
DEPS += $(call FindFiles, $(CONF_DIR))
endif
ifneq ($(CLASSES_DIR), )
JMOD_FLAGS += --class-path $(CLASSES_DIR)
DEPS += $(call CacheFind, $(CLASSES_DIR))
DEPS += $(call FindFiles, $(CLASSES_DIR))
endif
ifneq ($(INCLUDE_HEADERS_DIR), )
JMOD_FLAGS += --header-files $(INCLUDE_HEADERS_DIR)
DEPS += $(call CacheFind, $(INCLUDE_HEADERS_DIR))
DEPS += $(call FindFiles, $(INCLUDE_HEADERS_DIR))
endif
ifneq ($(MAN_DIR), )
JMOD_FLAGS += --man-pages $(MAN_DIR)
DEPS += $(call CacheFind, $(MAN_DIR))
DEPS += $(call FindFiles, $(MAN_DIR))
endif

# If a specific modules_legal dir exists for this module, only pick up files
Expand All @@ -93,7 +93,7 @@ LEGAL_NOTICES := \
)

LEGAL_NOTICES_PATH := $(call PathList, $(LEGAL_NOTICES))
DEPS += $(call CacheFind, $(LEGAL_NOTICES))
DEPS += $(call FindFiles, $(LEGAL_NOTICES))

JMOD_FLAGS += --legal-notices $(LEGAL_NOTICES_PATH)

Expand Down Expand Up @@ -147,7 +147,7 @@ endif
# the actual command. Filter that out using wildcard before adding to DEPS.
DEPS += $(wildcard $(JMOD_CMD))
ifeq ($(EXTERNAL_BUILDJDK), false)
DEPS += $(call CacheFind, $(JDK_OUTPUTDIR)/modules/jdk.jlink/jdk/tools/jmod)
DEPS += $(call FindFiles, $(JDK_OUTPUTDIR)/modules/jdk.jlink/jdk/tools/jmod)
endif

# If creating interim versions of jmods, certain files need to be filtered out
Expand Down
16 changes: 8 additions & 8 deletions make/Docs.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ define SetupApiDocsGenerationBody
$$(SUPPORT_OUTPUTDIR)/docs/$1.vardeps)

# Get a list of all files in all the source dirs for all included modules
$1_SOURCE_DEPS := $$(call CacheFind, $$(wildcard $$(foreach module, \
$1_SOURCE_DEPS := $$(call FindFiles, $$(wildcard $$(foreach module, \
$$($1_ALL_MODULES), $$(call FindModuleSrcDirs, $$(module)))))

$$(eval $$(call SetupExecute, javadoc_$1, \
Expand Down Expand Up @@ -484,7 +484,7 @@ $(eval $(call SetupApiDocsGeneration, REFERENCE_API, \
GLOBAL_SPECS_RESOURCES_DIR := $(TOPDIR)/make/data/docs-resources/
$(eval $(call SetupCopyFiles, COPY_GLOBAL_RESOURCES, \
SRC := $(GLOBAL_SPECS_RESOURCES_DIR), \
FILES := $(call CacheFind, $(GLOBAL_SPECS_RESOURCES_DIR)), \
FILES := $(call FindFiles, $(GLOBAL_SPECS_RESOURCES_DIR)), \
DEST := $(DOCS_OUTPUTDIR), \
))
JDK_INDEX_TARGETS += $(COPY_GLOBAL_RESOURCES)
Expand All @@ -509,10 +509,10 @@ COPY_SPEC_FILTER := %.html %.gif %.jpg %.mib %.css
$(foreach m, $(ALL_MODULES), \
$(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \
$(foreach d, $(SPECS_$m), \
$(if $(filter $(COPY_SPEC_FILTER), $(call CacheFind, $d)), \
$(if $(filter $(COPY_SPEC_FILTER), $(call FindFiles, $d)), \
$(eval $(call SetupCopyFiles, COPY_$m, \
SRC := $d, \
FILES := $(filter $(COPY_SPEC_FILTER), $(call CacheFind, $d)), \
FILES := $(filter $(COPY_SPEC_FILTER), $(call FindFiles, $d)), \
DEST := $(DOCS_OUTPUTDIR)/specs/, \
)) \
$(eval JDK_SPECS_TARGETS += $(COPY_$m)) \
Expand All @@ -529,11 +529,11 @@ ifeq ($(ENABLE_PANDOC), true)
$(foreach m, $(ALL_MODULES), \
$(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \
$(foreach d, $(SPECS_$m), \
$(if $(filter %.md, $(call CacheFind, $d)), \
$(if $(filter %.md, $(call FindFiles, $d)), \
$(eval $m_$d_NAME := SPECS_TO_HTML_$m_$(strip $(call RelativePath, $d, $(TOPDIR)))) \
$(eval $(call SetupProcessMarkdown, $($m_$d_NAME), \
SRC := $d, \
FILES := $(filter %.md, $(call CacheFind, $d)), \
FILES := $(filter %.md, $(call FindFiles, $d)), \
DEST := $(DOCS_OUTPUTDIR)/specs/, \
CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \
)) \
Expand All @@ -556,11 +556,11 @@ ifeq ($(ENABLE_PANDOC), true)
$(foreach m, $(ALL_MODULES), \
$(eval MAN_$m := $(call FindModuleManDirs, $m)) \
$(foreach d, $(MAN_$m), \
$(if $(filter %.md, $(call CacheFind, $d)), \
$(if $(filter %.md, $(call FindFiles, $d)), \
$(eval $m_$d_NAME := MAN_TO_HTML_$m_$(strip $(call RelativePath, $d, $(TOPDIR)))) \
$(eval $(call SetupProcessMarkdown, $($m_$d_NAME), \
SRC := $d, \
FILES := $(filter %.md, $(call CacheFind, $d)), \
FILES := $(filter %.md, $(call FindFiles, $d)), \
DEST := $(DOCS_OUTPUTDIR)/specs/man, \
FILTER := $(PANDOC_HTML_MANPAGE_FILTER), \
CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \
Expand Down
23 changes: 8 additions & 15 deletions make/Images.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -183,21 +183,14 @@ endif

ifeq ($(GCOV_ENABLED), true)

GCOV_FIND_EXPR := -type f -name "*.gcno"

$(eval $(call SetupCopyFiles,COPY_HOTSPOT_GCOV_GCNO, \
SRC := $(OUTPUTDIR), \
DEST := $(SYMBOLS_IMAGE_DIR)/gcov, \
FILES := $(shell $(FIND) $(HOTSPOT_OUTPUTDIR) $(GCOV_FIND_EXPR))))

SYMBOLS_TARGETS += $(COPY_HOTSPOT_GCOV_GCNO)

$(eval $(call SetupCopyFiles,COPY_JDK_GCOV_GCNO, \
$(eval $(call SetupCopyFiles,COPY_GCOV_GCNO, \
SRC := $(OUTPUTDIR), \
DEST := $(SYMBOLS_IMAGE_DIR)/gcov, \
FILES := $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/native $(GCOV_FIND_EXPR))))
FILES := $(call FindFiles, $(HOTSPOT_OUTPUTDIR) \
$(SUPPORT_OUTPUTDIR)/native, *.gcno) \
))

SYMBOLS_TARGETS += $(COPY_JDK_GCOV_GCNO)
SYMBOLS_TARGETS += $(COPY_GCOV_GCNO)

endif

Expand Down Expand Up @@ -230,10 +223,10 @@ else
# On Macosx, if debug symbols have not been zipped, find all files inside *.dSYM
# dirs.
ifeq ($(call isTargetOs, macosx), true)
$(eval $(call FillCacheFind, \
$(SUPPORT_OUTPUTDIR)/modules_cmds $(SUPPORT_OUTPUTDIR)/modules_libs))
$(call FillFindCache, \
$(SUPPORT_OUTPUTDIR)/modules_cmds $(SUPPORT_OUTPUTDIR)/modules_libs)
FindDebuginfoFiles = \
$(if $(wildcard $1), $(call containing, .dSYM/, $(call CacheFind, $1)))
$(if $(wildcard $1), $(call containing, .dSYM/, $(call FindFiles, $1)))
endif
endif

Expand Down
6 changes: 3 additions & 3 deletions make/MacBundles.gmk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -52,13 +52,13 @@ ifeq ($(call isTargetOs, macosx), true)
$(eval $(call SetupCopyFiles, COPY_JDK_IMAGE, \
SRC := $(JDK_IMAGE_DIR), \
DEST := $(JDK_MACOSX_CONTENTS_DIR)/Home, \
FILES := $(call CacheFind, $(JDK_IMAGE_DIR)), \
FILES := $(call FindFiles, $(JDK_IMAGE_DIR)), \
))

$(eval $(call SetupCopyFiles, COPY_JRE_IMAGE, \
SRC := $(JRE_IMAGE_DIR), \
DEST := $(JRE_MACOSX_CONTENTS_DIR)/Home, \
FILES := $(call CacheFind, $(JRE_IMAGE_DIR)), \
FILES := $(call FindFiles, $(JRE_IMAGE_DIR)), \
))

$(JDK_MACOSX_CONTENTS_DIR)/MacOS/libjli.dylib:
Expand Down
Loading

0 comments on commit 778fd08

Please sign in to comment.