< prev index next >

make/common/JavaCompilation.gmk

Print this page

        

@@ -1,7 +1,7 @@
 #
-# Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2017, 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
 # under the terms of the GNU General Public License version 2 only, as
 # published by the Free Software Foundation.  Oracle designates this

@@ -220,16 +220,17 @@
         $$(error SRC specified to SetupJavaCompilation $1 contains missing directory >$$d<) \
       ) \
     ) \
   )
   $$(call MakeDir,$$($1_BIN))
-  # 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)))
-
+  # 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))
   # Extract the java files.
   $1_SRCS := $$(filter %.java, $$($1_ALL_SRCS))
 
   # Translate include/exclude into patterns
   ifneq ($$($1_EXCLUDE_FILES), )
< prev index next >