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

Magnus Ihse Bursie ihse at openjdk.org
Wed May 7 22:54:51 UTC 2025


On Wed, 7 May 2025 21:12:54 GMT, Erik Joelsson <erikj 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))))

I agree that this looks a bit wonky. I just copied it from SetupNativeCompilation, since it has worked well there.

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

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


More information about the build-dev mailing list