From 2e37e080b4dee4608c822164bdd91c3a6a9b6447 Mon Sep 17 00:00:00 2001 From: clanger Date: Tue, 24 Oct 2017 10:41:45 +0200 Subject: [PATCH] 8189861: Refactor CacheFind Reviewed-by: sgehwolf --- make/Bundles.gmk | 15 +- make/CompileDemos.gmk | 10 +- make/CompileJavaModules.gmk | 2 +- make/CopyImportModules.gmk | 16 +- make/CreateBuildJdkCopy.gmk | 6 +- make/CreateJmods.gmk | 20 +- make/Docs.gmk | 12 +- make/Images.gmk | 23 +- make/MacBundles.gmk | 6 +- make/ZipSource.gmk | 3 +- make/common/JarArchive.gmk | 8 +- make/common/JavaCompilation.gmk | 15 +- make/common/MakeBase.gmk | 177 +++++++---- make/common/NativeCompilation.gmk | 4 +- make/common/TestFilesCompilation.gmk | 4 +- make/common/TextFileProcessing.gmk | 4 +- make/common/ZipArchive.gmk | 12 +- make/copy/CopyCommon.gmk | 6 +- .../Gensrc-jdk.internal.vm.compiler.gmk | 4 +- ...rc-jdk.internal.vm.compiler.management.gmk | 4 +- make/gensrc/GensrcCommonLangtools.gmk | 4 +- make/gensrc/GensrcLocaleData.gmk | 20 +- make/gensrc/GensrcProperties.gmk | 4 +- make/hotspot/lib/JvmOverrideFiles.gmk | 4 +- make/lib/Lib-java.base.gmk | 4 +- make/lib/Lib-java.desktop.gmk | 4 +- test/make/TestCopyFiles.gmk | 4 +- test/make/TestMakeBase.gmk | 289 +++++++++++++++--- test/make/UtilsForTests.gmk | 17 +- 29 files changed, 474 insertions(+), 227 deletions(-) diff --git a/make/Bundles.gmk b/make/Bundles.gmk index be552cc6a3..9c8d6cccd0 100644 --- a/make/Bundles.gmk +++ b/make/Bundles.gmk @@ -71,7 +71,7 @@ define SetupBundleFileBody $$(call SetIfEmpty, $1_UNZIP_DEBUGINFO, false) $(BUNDLES_OUTPUTDIR)/$$($1_BUNDLE_NAME): $$($1_FILES) - # 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), \ @@ -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 @@ -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 @@ -338,7 +339,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), \ @@ -352,7 +353,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), \ diff --git a/make/CompileDemos.gmk b/make/CompileDemos.gmk index 16a02baa6a..64ecf48301 100644 --- a/make/CompileDemos.gmk +++ b/make/CompileDemos.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2016, 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 @@ -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 = @@ -237,11 +237,11 @@ $(SUPPORT_OUTPUTDIR)/demos/image/nbproject/%: $(DEMO_SHARE_SRC)/nbproject/% ifeq ($(OPENJDK_TARGET_OS), solaris) 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 ################################################################################ @@ -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) diff --git a/make/CompileJavaModules.gmk b/make/CompileJavaModules.gmk index 646aa1a4d0..2afaaf99ea 100644 --- a/make/CompileJavaModules.gmk +++ b/make/CompileJavaModules.gmk @@ -644,7 +644,7 @@ endif ifneq ($(wildcard $(IMPORT_MODULES_CLASSES)/$(MODULE)), ) $(JDK_OUTPUTDIR)/modules/$(MODULE)/_imported.marker: \ - $(call CacheFind, $(IMPORT_MODULES_CLASSES)/$(MODULE)) + $(call FindFiles, $(IMPORT_MODULES_CLASSES)/$(MODULE)) $(call MakeDir, $(@D)) # Do not delete marker and build meta data files $(RM) -r $(filter-out $(@D)/_%, $(wildcard $(@D)/*)) diff --git a/make/CopyImportModules.gmk b/make/CopyImportModules.gmk index 3ea6a134c8..e71d29c38d 100644 --- a/make/CopyImportModules.gmk +++ b/make/CopyImportModules.gmk @@ -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 @@ -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 ($(OPENJDK_TARGET_OS), windows) @@ -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 @@ -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), \ )) @@ -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 @@ -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 diff --git a/make/CreateBuildJdkCopy.gmk b/make/CreateBuildJdkCopy.gmk index 2f12d97e00..3f6321aca5 100644 --- a/make/CreateBuildJdkCopy.gmk +++ b/make/CreateBuildJdkCopy.gmk @@ -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 @@ -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)))) $(ECHO) $(LOG_INFO) "Copying java modules to buildjdk: $(MODULES_TO_COPY)" $(RM) -r $(BUILDJDK_OUTPUTDIR)/jdk/modules @@ -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)))), \ )) diff --git a/make/CreateJmods.gmk b/make/CreateJmods.gmk index 42ec04e37a..0f1dff11aa 100644 --- a/make/CreateJmods.gmk +++ b/make/CreateJmods.gmk @@ -51,33 +51,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 @@ -91,7 +91,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) @@ -145,7 +145,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 diff --git a/make/Docs.gmk b/make/Docs.gmk index 3b98ef17c1..461ef989c9 100644 --- a/make/Docs.gmk +++ b/make/Docs.gmk @@ -341,7 +341,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))))) # Javadoc creates a lot of files but use index.html as a marker @@ -496,7 +496,7 @@ JDK_INDEX_TARGETS += $(JDK_INDEX_HTML) 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) @@ -521,10 +521,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)) \ @@ -541,11 +541,11 @@ ifeq ($(ENABLE_FULL_DOCS), 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 := CONVERT_MARKDOWN_$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), \ )) \ diff --git a/make/Images.gmk b/make/Images.gmk index 10e3dc2d82..b911abf182 100644 --- a/make/Images.gmk +++ b/make/Images.gmk @@ -276,21 +276,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 @@ -323,10 +316,10 @@ else # On Macosx, if debug symbols have not been zipped, find all files inside *.dSYM # dirs. ifeq ($(OPENJDK_TARGET_OS), macosx) - $(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 diff --git a/make/MacBundles.gmk b/make/MacBundles.gmk index ccae70a578..d25a88f0d8 100644 --- a/make/MacBundles.gmk +++ b/make/MacBundles.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2017, 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 @@ -52,13 +52,13 @@ ifeq ($(OPENJDK_TARGET_OS), macosx) $(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)), \ )) $(eval $(call SetupCopyFiles, COPY_LIBJLI_JDK, \ diff --git a/make/ZipSource.gmk b/make/ZipSource.gmk index f2aefeb846..b4aabdacbb 100644 --- a/make/ZipSource.gmk +++ b/make/ZipSource.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2014, 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 @@ -87,6 +87,7 @@ ifeq ($(SRC_GENERATED), true) EXCLUDE_FILES := $(SRC_ZIP_EXCLUDE_FILES), \ SUFFIXES := .java, \ ZIP := $(SUPPORT_OUTPUTDIR)/src.zip, \ + FOLLOW_SYMLINKS := true, \ )) do-zip: $(BUILD_SRC_ZIP) diff --git a/make/common/JarArchive.gmk b/make/common/JarArchive.gmk index b6487913dd..e1ec1427a8 100644 --- a/make/common/JarArchive.gmk +++ b/make/common/JarArchive.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2016, 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 @@ -122,9 +122,9 @@ define SetupJarArchiveBody ifeq ($$($1_DEPENDENCIES), ) # Add all source roots to the find cache since we are likely going to run find # on these more than once. The cache will only be updated if necessary. - $$(eval $$(call FillCacheFind, $$($1_FIND_LIST))) + $$(call FillFindCache, $$($1_FIND_LIST)) $1_DEPENDENCIES:=$$(filter $$(addprefix %,$$($1_SUFFIXES)), \ - $$(call CacheFind,$$($1_SRCS))) + $$(call FindFiles,$$($1_SRCS))) ifneq (,$$($1_GREP_INCLUDE_PATTERNS)) $1_DEPENDENCIES:=$$(filter $$(addsuffix %,$$($1_GREP_INCLUDE_PATTERNS)),$$($1_DEPENDENCIES)) endif @@ -135,7 +135,7 @@ define SetupJarArchiveBody $1_DEPENDENCIES+=$$(wildcard $$(foreach src, $$($1_SRCS), \ $$(addprefix $$(src)/, $$($1_EXTRA_FILES))) $$($1_EXTRA_FILES)) ifeq (,$$($1_SKIP_METAINF)) - $1_DEPENDENCIES+=$$(call CacheFind,$$(wildcard $$(addsuffix /META-INF,$$($1_SRCS)))) + $1_DEPENDENCIES+=$$(call FindFiles,$$(wildcard $$(addsuffix /META-INF,$$($1_SRCS)))) endif endif # The dependency list should never be empty diff --git a/make/common/JavaCompilation.gmk b/make/common/JavaCompilation.gmk index a1cdd9264d..1664cc82ea 100644 --- a/make/common/JavaCompilation.gmk +++ b/make/common/JavaCompilation.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2017, 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 @@ -221,13 +221,12 @@ define SetupJavaCompilationBody ) \ ) $$(call MakeDir,$$($1_BIN)) - # Add all source roots to the find cache since we are likely going to run find - # on these more than once. The cache will only be updated if necessary. - $$(eval $$(call FillCacheFind, $$($1_SRC))) - # Find all files in the source trees. Preserve order of source roots so that - # the first version in case of multiple instances of the same file is selected. - # CacheFind does not preserve order so need to call it for each root. - $1_ALL_SRCS += $$($1_EXTRA_FILES) $$(foreach s, $$($1_SRC), $$(call CacheFind, $$s)) + # Order src files according to the order of the src dirs. Correct odering is + # needed for correct overriding between different source roots. + $1_ALL_SRC_RAW := $$(call FindFiles, $$($1_SRC)) + $1_ALL_SRCS := $$($1_EXTRA_FILES) \ + $$(foreach d, $$($1_SRC), $$(filter $$d%, $$($1_ALL_SRC_RAW))) + # Extract the java files. $1_SRCS := $$(filter %.java, $$($1_ALL_SRCS)) diff --git a/make/common/MakeBase.gmk b/make/common/MakeBase.gmk index 170c3ed0da..aa509c7f7e 100644 --- a/make/common/MakeBase.gmk +++ b/make/common/MakeBase.gmk @@ -64,10 +64,12 @@ define NEWLINE endef -# In GNU Make 4.0 and higher, there is a file function for writing to files. +# Certain features only work in newer version of GNU Make. The build will still +# function in 3.81, but will be less performant. ifeq (4.0, $(firstword $(sort 4.0 $(MAKE_VERSION)))) HAS_FILE_FUNCTION := true CORRECT_FUNCTION_IN_RECIPE_EVALUATION := true + RWILDCARD_WORKS := true endif ############################## @@ -466,8 +468,8 @@ endef ################################################################################ # Replace question marks with space in string. This macro needs to be called on -# files from CacheFind in case any of them contains space in their file name, -# since CacheFind replaces space with ?. +# files from FindFiles in case any of them contains space in their file name, +# since FindFiles replaces space with ?. # Param 1 - String to replace in DecodeSpace = \ $(subst ?,$(SPACE),$(strip $1)) @@ -685,73 +687,116 @@ uppercase = \ ################################################################################ -ifneq ($(DISABLE_CACHE_FIND), true) - # In Cygwin, finds are very costly, both because of expensive forks and because - # of bad file system caching. Find is used extensively in $(shell) commands to - # find source files. This makes rerunning make with no or few changes rather - # expensive. To speed this up, these two macros are used to cache the results - # of simple find commands for reuse. - # - # Runs a find and stores both the directories where it was run and the results. - # This macro can be called multiple times to add to the cache. Only finds files - # with no filters. - # - # Files containing space will get spaces replaced with ? because GNU Make - # cannot handle lists of files with space in them. By using ?, make will match - # the wildcard to space in many situations so we don't need to replace back - # to space on every use. While not a complete solution it does allow some uses - # of CacheFind to function with spaces in file names, including for - # SetupCopyFiles. - # - # Needs to be called with $(eval ) - # - # Even if the performance benifit is negligible on other platforms, keep the - # functionality active unless explicitly disabled to exercise it more. - # - # Initialize FIND_CACHE_DIRS with := to make it a non recursively-expanded variable - FIND_CACHE_DIRS := - # Param 1 - Dirs to find in - # Param 2 - (optional) specialization. Normally "-a \( ... \)" expression. - define FillCacheFind - # Filter out already cached dirs. The - is needed when FIND_CACHE_DIRS is empty - # since filter out will then return empty. - FIND_CACHE_NEW_DIRS := $$(filter-out $$(addsuffix /%,\ - - $(FIND_CACHE_DIRS)) $(FIND_CACHE_DIRS), $1) - ifneq ($$(FIND_CACHE_NEW_DIRS), ) - # Remove any trailing slash from dirs in the cache dir list - FIND_CACHE_DIRS += $$(patsubst %/,%, $$(FIND_CACHE_NEW_DIRS)) - FIND_CACHE := $$(sort $$(FIND_CACHE) \ - $$(shell $(FIND) $$(wildcard $$(FIND_CACHE_NEW_DIRS)) \ - \( -type f -o -type l \) $2 | $(TR) ' ' '?')) - endif - endef +# Recursive wildcard function. Walks down directories recursively and matches +# files with the search patterns. Patterns use standard file wildcards (* and +# ?). +# +# $1 - Directories to start search in +# $2 - Search patterns +rwildcard = \ + $(strip \ + $(foreach d, \ + $(patsubst %/,%,$(sort $(dir $(wildcard $(addsuffix /*/*, $(strip $1)))))), \ + $(call rwildcard,$d,$2) \ + ) \ + $(call DoubleDollar, $(wildcard $(foreach p, $2, $(addsuffix /$(strip $p), $(strip $1))))) \ + ) - # Mimics find by looking in the cache if all of the directories have been cached. - # Otherwise reverts to shell find. This is safe to call on all platforms, even if - # cache is deactivated. - # - # $1 can be either a directory or a file. If it's a directory, make - # sure we have exactly one trailing slash before the wildcard. - # The extra - is needed when FIND_CACHE_DIRS is empty but should be harmless. - # - # Param 1 - Dirs to find in - # Param 2 - (optional) specialization. Normally "-a \( ... \)" expression. - define CacheFind - $(if $(filter-out $(addsuffix /%,- $(FIND_CACHE_DIRS)) $(FIND_CACHE_DIRS),$1), \ - $(if $(wildcard $1), $(shell $(FIND) $(wildcard $1) \( -type f -o -type l \) $2 \ - | $(TR) ' ' '?')), \ - $(filter $(addsuffix /%,$(patsubst %/,%,$1)) $1,$(FIND_CACHE))) - endef +# Find non directories using recursive wildcard function. This function may +# be used directly when a small amount of directories is expected to be +# searched and caching is not expected to be of use. +# +# $1 - Directory to start search in +# $2 - Optional search patterns, defaults to '*'. +WildcardFindFiles = \ + $(sort $(strip \ + $(eval WildcardFindFiles_result := $(call rwildcard,$(patsubst %/,%,$1),$(if $(strip $2),$2,*))) \ + $(filter-out $(patsubst %/,%,$(sort $(dir $(WildcardFindFiles_result)))), \ + $(WildcardFindFiles_result) \ + ) \ + )) + +# Find non directories using the find utility in the shell. Safe to call for +# non existing directories, or directories containing wildcards. +# +# Files containing space will get spaces replaced with ? because GNU Make +# cannot handle lists of files with space in them. By using ?, make will match +# the wildcard to space in many situations so we don't need to replace back +# to space on every use. While not a complete solution it does allow some uses +# of FindFiles to function with spaces in file names, including for +# SetupCopyFiles. Unfortunately this does not work for WildcardFindFiles so +# if files with spaces are anticipated, use ShellFindFiles directly. +# +# $1 - Directories to start search in. +# $2 - Optional search patterns, empty means find everything. Patterns use +# standard file wildcards (* and ?) and should not be quoted. +# $3 - Optional options to find. +ShellFindFiles = \ + $(if $(wildcard $1), \ + $(sort \ + $(shell $(FIND) $3 $(patsubst %/,%,$(wildcard $1)) \( -type f -o -type l \) \ + $(if $(strip $2), -a \( -name "$(firstword $2)" \ + $(foreach p, $(filter-out $(firstword $2), $2), -o -name "$(p)") \)) \ + | $(TR) ' ' '?' \ + ) \ + ) \ + ) +# Find non directories using the method most likely to work best for the +# current build host +# +# $1 - Directory to start search in +# $2 - Optional search patterns, defaults to '*'. +ifeq ($(OPENJDK_BUILD_OS)-$(RWILDCARD_WORKS), windows-true) + DirectFindFiles = $(WildcardFindFiles) else - # If CacheFind is disabled, just run the find command. - # Param 1 - Dirs to find in - # Param 2 - (optional) specialization. Normally "-a \( ... \)" expression. - define CacheFind - $(if $(wildcard $1, \ - $(shell $(FIND) $(wildcard $1) \( -type f -o -type l \) $2 | $(TR) ' ' '?') \ + DirectFindFiles = $(ShellFindFiles) +endif + +# Finds files using a cache that is populated by FillFindCache below. If any of +# the directories given have not been cached, DirectFindFiles is used for +# everything. Caching is especially useful in Cygwin, where file finds are very +# costly. +# +# $1 - Directories to start search in. +# $2 - Optional search patterns. If used, no caching is done. +CacheFindFiles_CACHED_DIRS := +CacheFindFiles_CACHED_FILES := +CacheFindFiles = \ + $(if $2, \ + $(call DirectFindFiles, $1, $2) \ + , \ + $(if $(filter-out $(addsuffix /%, $(CacheFindFiles_CACHED_DIRS)) \ + $(CacheFindFiles_CACHED_DIRS), $1), \ + $(call DirectFindFiles, $1) \ + , \ + $(filter $(addsuffix /%,$(patsubst %/,%,$1)) $1,$(CacheFindFiles_CACHED_FILES)) \ + ) \ ) - endef + +# Explicitly adds files to the find cache used by CacheFindFiles. +# +# $1 - Directories to start search in +FillFindCache = \ + $(eval CacheFindFiles_NEW_DIRS := $$(filter-out $$(addsuffix /%,\ + $$(CacheFindFiles_CACHED_DIRS)) $$(CacheFindFiles_CACHED_DIRS), $1)) \ + $(if $(CacheFindFiles_NEW_DIRS), \ + $(eval CacheFindFiles_CACHED_DIRS += $$(patsubst %/,%,$$(CacheFindFiles_NEW_DIRS))) \ + $(eval CacheFindFiles_CACHED_FILES := $$(sort $$(CacheFindFiles_CACHED_FILES) \ + $$(call DirectFindFiles, $$(CacheFindFiles_NEW_DIRS)))) \ + ) + +# Findfiles is the default macro that should be used to find files in the file +# system. This function does not always support files with spaces in the names. +# If files with spaces are anticipated, use ShellFindFiles directly. +# +# $1 - Directories to start search in. +# $2 - Optional search patterns, empty means find everything. Patterns use +# standard file wildcards (* and ?) and should not be quoted. +ifeq ($(DISABLE_CACHE_FIND), true) + FindFiles = $(DirectFindFiles) +else + FindFiles = $(CacheFindFiles) endif ################################################################################ diff --git a/make/common/NativeCompilation.gmk b/make/common/NativeCompilation.gmk index 729ece2488..d5691d3fa9 100644 --- a/make/common/NativeCompilation.gmk +++ b/make/common/NativeCompilation.gmk @@ -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 @@ -519,7 +519,7 @@ define SetupNativeCompilationBody $$(error SRC specified to SetupNativeCompilation $1 contains missing directory $$d))) # Find all files in the source trees. Preserve order. - $1_SRCS := $$(foreach s, $$($1_SRC), $$(call CacheFind, $$(s))) + $1_SRCS := $$(foreach s, $$($1_SRC), $$(call FindFiles, $$(s))) $1_SRCS := $$(filter $$(NATIVE_SOURCE_EXTENSIONS), $$($1_SRCS)) # Extract the C/C++ files. ifneq ($$($1_EXCLUDE_PATTERNS), ) diff --git a/make/common/TestFilesCompilation.gmk b/make/common/TestFilesCompilation.gmk index e90921e70a..3659c9ab9e 100644 --- a/make/common/TestFilesCompilation.gmk +++ b/make/common/TestFilesCompilation.gmk @@ -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 @@ -75,7 +75,7 @@ define SetupTestFilesCompilationBody # Locate all files with the matching prefix $1_FILE_LIST := \ - $$(shell $$(FIND) $$($1_SOURCE_DIRS) -type f -name "$$($1_PREFIX)*.c") + $$(call FindFiles, $$($1_SOURCE_DIRS), $$($1_PREFIX)*.c) $1_EXCLUDE_PATTERN := $$(addprefix %/, $$($1_EXCLUDE)) $1_FILTERED_FILE_LIST := $$(filter-out $$($1_EXCLUDE_PATTERN), $$($1_FILE_LIST)) diff --git a/make/common/TextFileProcessing.gmk b/make/common/TextFileProcessing.gmk index 3fad0674a4..de6ca5cf99 100644 --- a/make/common/TextFileProcessing.gmk +++ b/make/common/TextFileProcessing.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013, 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 @@ -103,7 +103,7 @@ define SetupTextFileProcessingBody $$(error SOURCE_DIRS contains directory $$(src) outside \ SOURCE_BASE_DIR $$($1_SOURCE_BASE_DIR) (in $1)))) endif - $1_SOURCE_FILES := $$(sort $$(call CacheFind,$$($1_SOURCE_DIRS))) + $1_SOURCE_FILES := $$(sort $$(call FindFiles,$$($1_SOURCE_DIRS))) $1_EXCLUDE_FILES:=$$(foreach i,$$($1_SOURCE_DIRS),$$(addprefix $$i/,$$($1_EXCLUDE_FILES))) $1_INCLUDE_FILES:=$$(foreach i,$$($1_SOURCE_DIRS),$$(addprefix $$i/,$$($1_INCLUDE_FILES))) $1_SOURCE_FILES := $$(filter-out $$($1_EXCLUDE_FILES),$$($1_SOURCE_FILES)) diff --git a/make/common/ZipArchive.gmk b/make/common/ZipArchive.gmk index 4ced471d9a..de0b3e0a02 100644 --- a/make/common/ZipArchive.gmk +++ b/make/common/ZipArchive.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2014, 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 @@ -48,6 +48,8 @@ endif # src dir # SUFFIXES # EXTRA_DEPS +# FOLLOW_SYMLINKS - Set to explicitly follow symlinks. Affects performance of +# finding files. # ZIP_OPTIONS extra options to pass to zip SetupZipArchive = $(NamedParamsMacroTemplate) define SetupZipArchiveBody @@ -63,7 +65,13 @@ define SetupZipArchiveBody endif # Find all files in the source tree. - $1_ALL_SRCS := $$(call not-containing,_the.,$$(call CacheFind,$$($1_FIND_LIST))) + # If asked to, follow symlinks in this find since that is what zip does. To do + # this, we need to call ShellFindFiles directly. + ifeq ($$($1_FOLLOW_SYMLINKS), true) + $1_ALL_SRCS := $$(call not-containing,_the.,$$(call ShellFindFiles,$$($1_FIND_LIST), , -L)) + else + $1_ALL_SRCS := $$(call not-containing,_the.,$$(call FindFiles,$$($1_FIND_LIST))) + endif # Filter on suffixes if set ifneq ($$($1_SUFFIXES),) diff --git a/make/copy/CopyCommon.gmk b/make/copy/CopyCommon.gmk index 6450cb169f..ce281566ae 100644 --- a/make/copy/CopyCommon.gmk +++ b/make/copy/CopyCommon.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2017, 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 @@ -40,7 +40,7 @@ ifneq ($(wildcard $(INCLUDE_SOURCE_DIR)/*), ) $(eval $(call SetupCopyFiles, COPY_EXPORTED_INCLUDE, \ SRC := $(INCLUDE_SOURCE_DIR), \ DEST := $(INCLUDE_TARGET_DIR), \ - FILES := $(filter %.h, $(call CacheFind, $(INCLUDE_SOURCE_DIR))), \ + FILES := $(filter %.h, $(call FindFiles, $(INCLUDE_SOURCE_DIR))), \ )) TARGETS += $(COPY_EXPORTED_INCLUDE) @@ -56,7 +56,7 @@ ifneq ($(wildcard $(INCLUDE_SOURCE_OS_DIR)/*), ) $(eval $(call SetupCopyFiles, COPY_EXPORTED_INCLUDE_OS, \ SRC := $(INCLUDE_SOURCE_OS_DIR), \ DEST := $(INCLUDE_TARGET_DIR)/$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR), \ - FILES := $(filter %.h, $(call CacheFind, $(INCLUDE_SOURCE_OS_DIR))), \ + FILES := $(filter %.h, $(call FindFiles, $(INCLUDE_SOURCE_OS_DIR))), \ )) TARGETS += $(COPY_EXPORTED_INCLUDE_OS) diff --git a/make/gensrc/Gensrc-jdk.internal.vm.compiler.gmk b/make/gensrc/Gensrc-jdk.internal.vm.compiler.gmk index f4787934ba..4f9566a1cc 100644 --- a/make/gensrc/Gensrc-jdk.internal.vm.compiler.gmk +++ b/make/gensrc/Gensrc-jdk.internal.vm.compiler.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2016, 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 @@ -65,7 +65,7 @@ PROC_SRC_SUBDIRS := \ PROC_SRC_DIRS := $(patsubst %, $(SRC_DIR)/%/src, $(PROC_SRC_SUBDIRS)) -PROC_SRCS := $(filter %.java, $(call CacheFind, $(PROC_SRC_DIRS))) +PROC_SRCS := $(filter %.java, $(call FindFiles, $(PROC_SRC_DIRS))) ALL_SRC_DIRS := $(SRC_DIR) $(wildcard $(SRC_DIR)/*/src) SOURCEPATH := $(call PathList, $(ALL_SRC_DIRS)) diff --git a/make/gensrc/Gensrc-jdk.internal.vm.compiler.management.gmk b/make/gensrc/Gensrc-jdk.internal.vm.compiler.management.gmk index 83a0bec7a6..d9ea39f67c 100644 --- a/make/gensrc/Gensrc-jdk.internal.vm.compiler.management.gmk +++ b/make/gensrc/Gensrc-jdk.internal.vm.compiler.management.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2016, 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 @@ -39,7 +39,7 @@ PROC_SRC_SUBDIRS := \ PROC_SRC_DIRS := $(patsubst %, $(SRC_DIR)/%/src, $(PROC_SRC_SUBDIRS)) -PROC_SRCS := $(filter %.java, $(call CacheFind, $(PROC_SRC_DIRS))) +PROC_SRCS := $(filter %.java, $(call FindFiles, $(PROC_SRC_DIRS))) ALL_SRC_DIRS := $(SRC_DIR) $(wildcard $(SRC_DIR)/*/src) SOURCEPATH := $(call PathList, $(ALL_SRC_DIRS)) diff --git a/make/gensrc/GensrcCommonLangtools.gmk b/make/gensrc/GensrcCommonLangtools.gmk index 682808c37a..0e9a924392 100644 --- a/make/gensrc/GensrcCommonLangtools.gmk +++ b/make/gensrc/GensrcCommonLangtools.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2014, 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 @@ -64,7 +64,7 @@ endef define SetupCompileProperties # Lookup the properties that need to be compiled into resource bundles. PROPSOURCES := $2 \ - $$(shell $(FIND) $(TOPDIR)/src/$(MODULE)/share/classes -name "*.properties") + $$(call FindFiles, $(TOPDIR)/src/$(MODULE)/share/classes, *.properties) # Filter out any excluded translations PROPSOURCES := $$(call FilterExcludedTranslations, $$(PROPSOURCES), .properties) diff --git a/make/gensrc/GensrcLocaleData.gmk b/make/gensrc/GensrcLocaleData.gmk index 3235136b1e..a68da06964 100644 --- a/make/gensrc/GensrcLocaleData.gmk +++ b/make/gensrc/GensrcLocaleData.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2017, 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 @@ -28,16 +28,16 @@ # into LocaleDataMetaInfo.java # First go look for all locale files -LOCALE_FILES := $(shell $(FIND) \ +LOCALE_FILES := $(call FindFiles, \ $(TOPDIR)/src/$(MODULE)/share/classes/sun/text/resources \ - $(TOPDIR)/src/$(MODULE)/share/classes/sun/util/resources \ - -name "FormatData_*.java" -o -name "FormatData_*.properties" -o \ - -name "CollationData_*.java" -o -name "CollationData_*.properties" -o \ - -name "TimeZoneNames_*.java" -o -name "TimeZoneNames_*.properties" -o \ - -name "LocaleNames_*.java" -o -name "LocaleNames_*.properties" -o \ - -name "CurrencyNames_*.java" -o -name "CurrencyNames_*.properties" -o \ - -name "CalendarData_*.java" -o -name "CalendarData_*.properties" -o \ - -name "BreakIteratorInfo_*.java" -o -name "BreakIteratorRules_*.java") + $(TOPDIR)/src/$(MODULE)/share/classes/sun/util/resources, \ + FormatData_*.java FormatData_*.properties \ + CollationData_*.java CollationData_*.properties \ + TimeZoneNames_*.java TimeZoneNames_*.properties \ + LocaleNames_*.java LocaleNames_*.properties \ + CurrencyNames_*.java CurrencyNames_*.properties \ + CalendarData_*.java CalendarData_*.properties \ + BreakIteratorInfo_*.java BreakIteratorRules_*.java) # Then translate the locale files into for example: FormatData_sv LOCALE_RESOURCES := $(sort $(subst .properties,,$(subst .java,,$(notdir $(LOCALE_FILES))))) diff --git a/make/gensrc/GensrcProperties.gmk b/make/gensrc/GensrcProperties.gmk index c8d17a3553..33df382a6d 100644 --- a/make/gensrc/GensrcProperties.gmk +++ b/make/gensrc/GensrcProperties.gmk @@ -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 @@ -68,7 +68,7 @@ define SetupCompilePropertiesBody endif # Locate all properties files in the given source dirs. - $1_SRC_FILES := $$(filter %.properties, $$(call CacheFind, $$($1_SRC_DIRS))) + $1_SRC_FILES := $$(call FindFiles, $$($1_SRC_DIRS), *.properties) ifneq ($$($1_EXCLUDE), ) $1_SRC_FILES := $$(filter-out $$($1_EXCLUDE), $$($1_SRC_FILES)) diff --git a/make/hotspot/lib/JvmOverrideFiles.gmk b/make/hotspot/lib/JvmOverrideFiles.gmk index 3e32966fa1..8fca3b88d9 100644 --- a/make/hotspot/lib/JvmOverrideFiles.gmk +++ b/make/hotspot/lib/JvmOverrideFiles.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013, 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 @@ -65,7 +65,7 @@ ifeq ($(OPENJDK_TARGET_OS), linux) # significantly reduce the GC pause time on 32 bit Linux/Unix platforms by # compiling without the PIC flag (-fPIC on linux). # See 6454213 for more details. - ALL_SRC := $(filter %.cpp, $(call CacheFind, $(TOPDIR)/src/hotspot/share)) + ALL_SRC := $(call FindFiles, $(TOPDIR)/src/hotspot/share, *.cpp) NONPIC_FILTER := $(addsuffix %, $(addprefix $(TOPDIR)/src/hotspot/share/, \ memory oops gc)) # Due to what looks like a bug in the old build implementation of this, add a diff --git a/make/lib/Lib-java.base.gmk b/make/lib/Lib-java.base.gmk index 6e8712a031..7853c2a0df 100644 --- a/make/lib/Lib-java.base.gmk +++ b/make/lib/Lib-java.base.gmk @@ -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 @@ -29,7 +29,7 @@ include LibCommon.gmk $(eval $(call IncludeCustomExtension, lib/Lib-java.base.gmk)) # Prepare the find cache. -$(eval $(call FillCacheFind, $(wildcard $(TOPDIR)/src/java.base/*/native))) +$(call FillFindCache, $(wildcard $(TOPDIR)/src/java.base/*/native)) ################################################################################ # Create all the core libraries diff --git a/make/lib/Lib-java.desktop.gmk b/make/lib/Lib-java.desktop.gmk index 81f85fe28f..2bb02cdd75 100644 --- a/make/lib/Lib-java.desktop.gmk +++ b/make/lib/Lib-java.desktop.gmk @@ -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 @@ -29,7 +29,7 @@ include LibCommon.gmk $(eval $(call IncludeCustomExtension, lib/Lib-java.desktop.gmk)) # Prepare the find cache. -$(eval $(call FillCacheFind, $(wildcard $(TOPDIR)/src/java.desktop/*/native))) +$(call FillFindCache, $(wildcard $(TOPDIR)/src/java.desktop/*/native)) ################################################################################ # Create the AWT/2D libraries diff --git a/test/make/TestCopyFiles.gmk b/test/make/TestCopyFiles.gmk index fa1fcdb2ef..40853693b4 100644 --- a/test/make/TestCopyFiles.gmk +++ b/test/make/TestCopyFiles.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 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 @@ -63,7 +63,7 @@ $(OUTPUT_DIR)/_src_created: $(DEPS) $(eval $(call SetupCopyFiles, COPY_1, \ SRC := $(SRC_DIR), \ DEST := $(DEST_DIR), \ - FILES := $(call CacheFind, $(SRC_DIR)), \ + FILES := $(call ShellFindFiles, $(SRC_DIR)), \ )) # Optionally define a rule that deletes all the target files after the makefile diff --git a/test/make/TestMakeBase.gmk b/test/make/TestMakeBase.gmk index 8610eac36d..e61ae5b1ad 100644 --- a/test/make/TestMakeBase.gmk +++ b/test/make/TestMakeBase.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2014, 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 @@ -105,13 +105,13 @@ endif ################################################################################ # Test remove-prefixes -$(eval $(call assert-equals, \ +$(call AssertEquals, \ $(call remove-prefixes, pre, prefix postfix), fix postfix, \ - Prefixes not properly removed)) + Prefixes not properly removed) -$(eval $(call assert-equals, \ +$(call AssertEquals, \ $(call remove-prefixes, pre post, prefix postfix), fix fix, \ - Prefixes not properly removed)) + Prefixes not properly removed) ################################################################################ # Test ShellQuote @@ -204,19 +204,19 @@ VARDEP_VALUE_FILE := $(VARDEP_DIR)/value-file VARDEP_TEST_VAR2 := value3 VARDEP_RETURN_VALUE := $(call DependOnVariable, VARDEP_TEST_VAR2, $(VARDEP_VALUE_FILE)) -$(eval $(call assert-equals, $(VARDEP_RETURN_VALUE), $(VARDEP_VALUE_FILE), \ - Wrong filename returned)) +$(call AssertEquals, $(VARDEP_RETURN_VALUE), $(VARDEP_VALUE_FILE), \ + Wrong filename returned) -include $(VARDEP_VALUE_FILE) -$(eval $(call assert-equals, $(VARDEP_TEST_VAR2_old), $(VARDEP_TEST_VAR2), \ - Wrong contents in vardeps file)) +$(call AssertEquals, $(VARDEP_TEST_VAR2_old), $(VARDEP_TEST_VAR2), \ + Wrong contents in vardeps file) # Test with a variable value containing some problematic characters VARDEP_TEST_VAR3 := foo '""' "''" bar \$$ORIGIN &\#x00a9 VARDEP_VALUE_FILE := $(call DependOnVariable, VARDEP_TEST_VAR3) -include $(VARDEP_VALUE_FILE) -$(eval $(call assert-equals, $(call EscapeHash,$(VARDEP_TEST_VAR3_old)), \ +$(call AssertEquals, $(call EscapeHash,$(VARDEP_TEST_VAR3_old)), \ $(call EscapeHash,$(VARDEP_TEST_VAR3)), \ - Wrong contents in vardep file)) + Wrong contents in vardep file) TEST_TARGETS += test-vardep @@ -245,85 +245,86 @@ endif PATHLIST_INPUT := foo bar baz -$(eval $(call assert-equals, \ +$(call AssertEquals, \ $(call PathList, $(call PathList, $(PATHLIST_INPUT))), \ $(call PathList, $(PATHLIST_INPUT)), \ - PathList call not safe for calling twice)) + PathList call not safe for calling twice, \ +) ################################################################################ # Test FindCommonPathPrefix -$(eval $(call assert-equals, \ +$(call AssertEquals, \ $(call FindCommonPathPrefix, /foo/bar/baz, /foo/bar/banan), \ /foo/bar, \ FindCommonPathPrefix, \ -)) +) -$(eval $(call assert-equals, \ +$(call AssertEquals, \ $(call FindCommonPathPrefix, /foo/bar/baz, /foo/bar), \ /foo/bar, \ FindCommonPathPrefix, \ -)) +) -$(eval $(call assert-equals, \ +$(call AssertEquals, \ $(call FindCommonPathPrefix, /foo/bar/baz, /foo/bar/), \ /foo/bar, \ FindCommonPathPrefix, \ -)) +) -$(eval $(call assert-equals, \ +$(call AssertEquals, \ $(call FindCommonPathPrefix, foo/bar/baz, foo/bar/banan), \ foo/bar, \ FindCommonPathPrefix, \ -)) +) -$(eval $(call assert-equals, \ +$(call AssertEquals, \ $(call FindCommonPathPrefix, foo/bar/baz, /foo/bar/banan), \ , \ FindCommonPathPrefix, \ -)) +) ################################################################################ # DirToDotDot -$(eval $(call assert-equals, \ +$(call AssertEquals, \ $(call DirToDotDot, foo/bar/baz/), \ ../../.., \ DirToDotDot, \ -)) +) -$(eval $(call assert-equals, \ +$(call AssertEquals, \ $(call DirToDotDot, foo/bar), \ ../.., \ DirToDotDot, \ -)) +) -$(eval $(call assert-equals, \ +$(call AssertEquals, \ $(call DirToDotDot, /foo), \ .., \ DirToDotDot, \ -)) +) ################################################################################ # RelativePath -$(eval $(call assert-equals, \ +$(call AssertEquals, \ $(call RelativePath, foo/bar/baz, foo/bar/banan), \ ../baz, \ RelativePath, \ -)) +) -$(eval $(call assert-equals, \ +$(call AssertEquals, \ $(call RelativePath, foo/bar/baz/banan/kung, foo/bar/banan/kung), \ ../../baz/banan/kung, \ RelativePath, \ -)) +) -$(eval $(call assert-equals, \ +$(call AssertEquals, \ $(call RelativePath, /foo/bar/baz/banan/kung, /foo/bar/banan/kung/), \ ../../baz/banan/kung, \ RelativePath, \ -)) +) ################################################################################ # Test ParseKeywordVariable @@ -335,29 +336,29 @@ $(eval $(call ParseKeywordVariable, KWBASE, \ STRING_KEYWORDS := COUNT MANY_WORDS, \ )) -$(eval $(call assert-equals, \ +$(call AssertEquals, \ $(KWBASE_APA), \ banan, \ ParseKeywordVariable failed to parse APA, \ -)) +) -$(eval $(call assert-equals, \ +$(call AssertEquals, \ $(KWBASE_COUNT), \ 1 2 3 4 5, \ ParseKeywordVariable failed to parse COUNT, \ -)) +) -$(eval $(call assert-equals, \ +$(call AssertEquals, \ $(KWBASE_SUM), \ 1+2+3+4+5, \ ParseKeywordVariable failed to parse SUM, \ -)) +) -$(eval $(call assert-equals, \ +$(call AssertEquals, \ $(KWBASE_MANY_WORDS), \ I have the best words., \ ParseKeywordVariable failed to parse MANY_WORDS, \ -)) +) # Simulate variable set from command line by using "override" override KWBASE_WEIRD_GURKA := paprika @@ -368,17 +369,211 @@ $(eval $(call ParseKeywordVariable, KWBASE_WEIRD, \ STRING_KEYWORDS := COUNT, \ )) -$(eval $(call assert-equals, \ +$(call AssertEquals, \ $(KWBASE_WEIRD_APA), \ skansen, \ ParseKeywordVariable failed to overwrite APA, \ -)) +) -$(eval $(call assert-equals, \ +$(call AssertEquals, \ $(KWBASE_WEIRD_GURKA), \ paprika, \ ParseKeywordVariable failed to preserve GURKA, \ -)) +) + +################################################################################ +# Test recursive wildcard + +A_FOOBAR := $(OUTPUT_DIR)/wildcard/a/foo.bar +A_B_DOOBAR := $(OUTPUT_DIR)/wildcard/a/b/doo.bar +A_B_FOOBAR := $(OUTPUT_DIR)/wildcard/a/b/foo.bar +A_B_FOOBAZ := $(OUTPUT_DIR)/wildcard/a/b/foo.baz +X_Y_FOOBAR := $(OUTPUT_DIR)/wildcard/x/y/foo.bar +X_Y_FOOBAZ := $(OUTPUT_DIR)/wildcard/x/y/foo.baz +X_Y_FOODOLLAR := $(OUTPUT_DIR)/wildcard/x/y/foo$$foo + +$(call MakeDir, $(OUTPUT_DIR)/wildcard/a/b) +$(call MakeDir, $(OUTPUT_DIR)/wildcard/x/y) +$(shell $(TOUCH) $(A_FOOBAR) $(A_B_FOOBAR) $(A_B_DOOBAR) $(A_B_FOOBAZ) \ + $(X_Y_FOOBAR) $(X_Y_FOOBAZ) $(call ShellQuote, $(X_Y_FOODOLLAR))) + +ifeq ($(RWILDCARD_WORKS), true) + $(call AssertEquals, \ + $(sort $(call rwildcard, $(OUTPUT_DIR)/wildcard, *.bar)), \ + $(sort $(A_B_DOOBAR) $(A_B_FOOBAR) $(A_FOOBAR) $(X_Y_FOOBAR)), \ + Wrong files returned from rwildcard, \ + ) + + $(call AssertEquals, \ + $(sort $(call rwildcard, $(OUTPUT_DIR)/wildcard, doo.*)), \ + $(A_B_DOOBAR), \ + Wrong files returned from rwildcard, \ + ) + + $(call AssertEquals, \ + $(sort $(call rwildcard, $(OUTPUT_DIR)/wildcard, *.bar *.baz)), \ + $(sort $(A_B_DOOBAR) $(A_FOOBAR) $(A_B_FOOBAR) $(A_B_FOOBAZ) \ + $(X_Y_FOOBAR) $(X_Y_FOOBAZ)), \ + Wrong files returned from rwildcard, \ + ) + + $(call AssertEquals, \ + $(sort $(call WildcardFindFiles, $(OUTPUT_DIR)/wildcard)), \ + $(sort $(A_B_DOOBAR) $(A_FOOBAR) $(A_B_FOOBAR) $(A_B_FOOBAZ) \ + $(X_Y_FOOBAR) $(X_Y_FOOBAZ) $(X_Y_FOODOLLAR)), \ + Wrong files returned from WildcardFindFiles, \ + ) + + $(call AssertEquals, \ + $(sort $(call WildcardFindFiles, $(OUTPUT_DIR)/wildcard/x/y)), \ + $(sort $(X_Y_FOOBAR) $(X_Y_FOOBAZ) $(X_Y_FOODOLLAR)), \ + Wrong files returned from WildcardFindFiles, \ + ) + + $(call AssertEquals, \ + $(sort $(call WildcardFindFiles, $(OUTPUT_DIR)/wildcard/a/b $(OUTPUT_DIR)/wildcard/x)), \ + $(sort $(A_B_DOOBAR) $(A_B_FOOBAR) $(A_B_FOOBAZ) \ + $(X_Y_FOOBAR) $(X_Y_FOOBAZ) $(X_Y_FOODOLLAR)), \ + Wrong files returned from WildcardFindFiles, \ + ) +endif + +$(call AssertEquals, \ + $(sort $(call ShellFindFiles, $(OUTPUT_DIR)/wildcard)), \ + $(sort $(A_B_DOOBAR) $(A_FOOBAR) $(A_B_FOOBAR) $(A_B_FOOBAZ) \ + $(X_Y_FOOBAR) $(X_Y_FOOBAZ) $(X_Y_FOODOLLAR)), \ + Wrong files returned from ShellFindFiles, \ +) + +$(call AssertEquals, \ + $(sort $(call ShellFindFiles, $(OUTPUT_DIR)/wildcard/x/y)), \ + $(sort $(X_Y_FOOBAR) $(X_Y_FOOBAZ) $(X_Y_FOODOLLAR)), \ + Wrong files returned from ShellFindFiles, \ +) + +$(call AssertEquals, \ + $(sort $(call ShellFindFiles, $(OUTPUT_DIR)/wildcard/a/b $(OUTPUT_DIR)/wildcard/x)), \ + $(sort $(A_B_DOOBAR) $(A_B_FOOBAR) $(A_B_FOOBAZ) \ + $(X_Y_FOOBAR) $(X_Y_FOOBAZ) $(X_Y_FOODOLLAR)), \ + Wrong files returned from ShellFindFiles, \ +) + +$(call AssertEquals, \ + $(sort $(call ShellFindFiles, $(OUTPUT_DIR)/wildcard, *.bar)), \ + $(sort $(A_B_DOOBAR) $(A_B_FOOBAR) $(A_FOOBAR) $(X_Y_FOOBAR)), \ + Wrong files returned from ShellFindFiles, \ +) + +$(call AssertEquals, \ + $(sort $(call ShellFindFiles, $(OUTPUT_DIR)/wildcard, doo.*)), \ + $(A_B_DOOBAR), \ + Wrong files returned from ShellFindFiles, \ +) + +$(call AssertEquals, \ + $(sort $(call ShellFindFiles, $(OUTPUT_DIR)/wildcard, *.bar *.baz)), \ + $(sort $(A_B_DOOBAR) $(A_FOOBAR) $(A_B_FOOBAR) $(A_B_FOOBAZ) \ + $(X_Y_FOOBAR) $(X_Y_FOOBAZ)), \ + Wrong files returned from ShellFindFiles, \ +) + +################################################################################ + +$(call AssertEquals, \ + $(sort $(call CacheFindFiles, $(OUTPUT_DIR)/wildcard/a/b)), \ + $(sort $(A_B_DOOBAR) $(A_B_FOOBAR) $(A_B_FOOBAZ)), \ + CacheFindFiles test 1, \ +) +$(call FillFindCache, $(OUTPUT_DIR)/wildcard/a/b) +$(call AssertEquals, \ + $(CacheFindFiles_CACHED_DIRS), $(OUTPUT_DIR)/wildcard/a/b, \ + Wrong files in find cache dirs, \ +) +$(call AssertEquals, \ + $(sort $(CacheFindFiles_CACHED_FILES)), \ + $(sort $(A_B_DOOBAR) $(A_B_FOOBAR) $(A_B_FOOBAZ)), \ + Wrong files in find cache files, \ +) +$(call AssertEquals, \ + $(sort $(call CacheFindFiles, $(OUTPUT_DIR)/wildcard/a/b)), \ + $(sort $(A_B_DOOBAR) $(A_B_FOOBAR) $(A_B_FOOBAZ)), \ + CacheFindFiles test 1, \ +) + +$(call AssertEquals, \ + $(sort $(call CacheFindFiles, $(OUTPUT_DIR)/wildcard/a)), \ + $(sort $(A_B_DOOBAR) $(A_B_FOOBAR) $(A_B_FOOBAZ) $(A_FOOBAR)), \ + CacheFindFiles test 2, \ +) +$(call FillFindCache, $(OUTPUT_DIR)/wildcard/a) +$(call AssertEquals, \ + $(CacheFindFiles_CACHED_DIRS), \ + $(OUTPUT_DIR)/wildcard/a/b $(OUTPUT_DIR)/wildcard/a, \ + Wrong files in find cache dirs, \ +) +$(call AssertEquals, \ + $(sort $(CacheFindFiles_CACHED_FILES)), \ + $(sort $(A_B_DOOBAR) $(A_B_FOOBAR) $(A_B_FOOBAZ) $(A_FOOBAR)), \ + Wrong files in find cache files, \ +) +$(call AssertEquals, \ + $(words $(CacheFindFiles_CACHED_FILES)), 4, \ + Wrong files in find cache files >$(CacheFindFiles_CACHED_FILES)<, \ +) +$(call AssertEquals, \ + $(sort $(call CacheFindFiles, $(OUTPUT_DIR)/wildcard/a)), \ + $(sort $(A_B_DOOBAR) $(A_B_FOOBAR) $(A_B_FOOBAZ) $(A_FOOBAR)), \ + CacheFindFiles test 2, \ +) + +$(call AssertEquals, \ + $(sort $(call CacheFindFiles, $(OUTPUT_DIR)/wildcard/x)), \ + $(sort $(X_Y_FOOBAR) $(X_Y_FOOBAZ) $(X_Y_FOODOLLAR)), \ + CacheFindFiles test 3, \ +) +$(call FillFindCache, $(OUTPUT_DIR)/wildcard/x) +$(call AssertEquals, \ + $(CacheFindFiles_CACHED_DIRS), \ + $(OUTPUT_DIR)/wildcard/a/b $(OUTPUT_DIR)/wildcard/a $(OUTPUT_DIR)/wildcard/x, \ + Wrong files in find cache dirs, \ +) +$(call AssertEquals, \ + $(sort $(CacheFindFiles_CACHED_FILES)), \ + $(sort $(A_B_DOOBAR) $(A_B_FOOBAR) $(A_B_FOOBAZ) $(A_FOOBAR) \ + $(X_Y_FOOBAR) $(X_Y_FOOBAZ) $(X_Y_FOODOLLAR)), \ + Wrong files in find cache files, \ +) +$(call AssertEquals, \ + $(words $(CacheFindFiles_CACHED_FILES)), 7, \ + Wrong files in find cache files, \ +) +$(call AssertEquals, \ + $(sort $(call CacheFindFiles, $(OUTPUT_DIR)/wildcard/x)), \ + $(sort $(X_Y_FOOBAR) $(X_Y_FOOBAZ) $(X_Y_FOODOLLAR)), \ + CacheFindFiles test 3, \ +) + +$(call AssertEquals, \ + $(sort $(call CacheFindFiles, $(OUTPUT_DIR)/wildcard/x/y)), \ + $(sort $(X_Y_FOOBAR) $(X_Y_FOOBAZ) $(X_Y_FOODOLLAR)), \ + CacheFindFiles test 4, \ +) +$(call FillFindCache, $(OUTPUT_DIR)/wildcard/x/y) +$(call AssertEquals, \ + $(CacheFindFiles_CACHED_DIRS), \ + $(OUTPUT_DIR)/wildcard/a/b $(OUTPUT_DIR)/wildcard/a $(OUTPUT_DIR)/wildcard/x, \ + Wrong files in find cache dirs, \ +) +$(call AssertEquals, \ + $(sort $(CacheFindFiles_CACHED_FILES)), \ + $(sort $(A_B_DOOBAR) $(A_B_FOOBAR) $(A_B_FOOBAZ) $(A_FOOBAR) \ + $(X_Y_FOOBAR) $(X_Y_FOOBAZ) $(X_Y_FOODOLLAR)), \ + Wrong files in find cache files, \ +) +$(call AssertEquals, \ + $(words $(CacheFindFiles_CACHED_FILES)), 7, \ + Wrong files in find cache files, \ +) ################################################################################ diff --git a/test/make/UtilsForTests.gmk b/test/make/UtilsForTests.gmk index a59bb693f7..0c50cb8c3c 100644 --- a/test/make/UtilsForTests.gmk +++ b/test/make/UtilsForTests.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 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 @@ -29,11 +29,16 @@ # 1 - Tested value # 2 - Exepected value # 3 - Error message -define assert-equals - ifneq ($$(strip $1),$$(strip $2)) - $$(error $3 - Expected >$$(strip $2)< - Got >$$(strip $1)<) - endif -endef +AssertEquals = \ + $(if $(call equals, $(strip $1), $(strip $2)), , \ + $(info FAILURE: $3) \ + $(info Expected: >$(strip $2)<) \ + $(info Actual: >$(strip $1)<) \ + $(error $3) \ + ) + +CreateFile = $(shell $(MKDIR) -p $(call ShellQuote, $(dir $1)) \ + && $(TOUCH) $(call ShellQuote, $1)) # On macosx, file system timestamps only have 1 second resultion so must add # sleeps to properly test dependencies. -- GitLab