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

Erik Joelsson erikj at openjdk.org
Thu May 8 16:52:59 UTC 2025


On Wed, 7 May 2025 22:52:09 GMT, Magnus Ihse Bursie <ihse at openjdk.org> wrote:

>> 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.

It certainly works most of the time, but can have weird effects when there are `$` characters in strings and this deep into the implementation of a big macro I would prefer to avoid it if possible. I hope you verified that my version worked. :)

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

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


More information about the build-dev mailing list