RFR: 8334391: JDK build should exclude *-files directories for Java source

Erik Joelsson erikj at openjdk.org
Wed May 7 21:15:51 UTC 2025


On Fri, 4 Apr 2025 14:44:07 GMT, Magnus Ihse Bursie <ihse at openjdk.org> wrote:

> We should always exclude `doc-files` and `snippet-files` when compiling java code. To generalize this, exclude all `*-files` directories.
> 
> (The usage of EXCLUDES and EXCLUDE_FILES is a bit weird. In essence, EXCLUDE_FILES prepends a `%` wildchar match to the filenames given, which we use here, while EXCLUDES matches only strict directory names in the path. These should probably be clarified/redesigned for more intuitive exclusion.)

make/common/JavaCompilation.gmk line 342:

> 340:     $1_SRCS_WITHOUT_ROOTS := $$($1_SRCS)
> 341:     $$(foreach i, $$($1_SRC), $$(eval $1_SRCS_WITHOUT_ROOTS := $$(patsubst \
> 342:         $$i/%,%, $$($1_SRCS_WITHOUT_ROOTS))))

Using eval like this can sometimes have weird consequences. I would recommend rewriting this without eval. I think something like this should work. It may change the order of elements, but that shouldn't matter here.


    $1_SRCS_WITHOUT_ROOTS := $$(foreach i, $$($1_SRC), \
        $$(patsubst $$i/%,%, $$(filter $$i/%, $$($1_SRCS))))

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/24449#discussion_r2078501336


More information about the build-dev mailing list