[lworld] RFR: 8376528: [lworld] value class creation in CompileJavaModules.gmk leaves unnecessary files
Roger Riggs
rriggs at openjdk.org
Thu Jan 29 21:22:37 UTC 2026
On Tue, 27 Jan 2026 20:30:32 GMT, David Beaumont <duke at openjdk.org> wrote:
> Rework fix from JDK-8376088, which failed on MacOS.
>
> It solves JDK-8376088, but also simplifies the two-step process for creating the `META-INF/preview` class files.
>
> Summary of changes:
> * Remove JAR file creation (no longer needed, this is the proximal fix for JDK-8376088).
> * Stop adding the "intermediate" target for the compilation to the TARGETS list (rely on the subsequent copy).
> * Copy directories directly from the output directory to the preview directory (does not copy marker files).
> * Make the marker file appear alongside other markers for the module compilation.
> * Rename marker file to be consistent with other sibling marker files.
>
> The marker files in build/linux-x64/jdk/modules/java.base/ are now:
>
> _the.java.base_batch
> _the.java.base_batch.cmdline
> _the.java.base_batch.filelist
> _the.java.base_batch.log
> _the.java.base_batch.modfiles
> _the.java.base_batch.modfiles.fixed
> _the.java.base.config_vardeps
> _the.java.base_internalapi
> _the.java.base-javacserver.conf
> _the.java.base_pubapi
> _the.java.base.valueclasses <-- moved/renamed marker file
> _the.java.base.vardeps
>
> The difference between JDK-8376088 and this PR is the switch away from using a glob expression like `foo/*/` to attempt to match "directories immediately inside foo/". On MacOS, this results in an expansion of directory names with retains the trailing `/`, and in MacOS, that implies the contents of the directories, not just the directories themselves.
>
> For example, given directory/files:
>
> foo/x/hello.txt
> foo/y/world.txt
>
>
> The action `cp -R foo/*/ bar` expands to `cp -R foo/x/ foo/y/ bar` (with trailing `/`) and then we get:
>
> Linux/Windows:
>
> bar/x/hello.txt
> bar/y/world.txt
>
>
> MacOS:
>
> bar/hello.txt
> bar/world.txt
>
>
> This PR uses an explicit wildcard action and filtering to specify the correct directories to be copied.
Suggestions on the comments to improve readability, the rules look fine.
make/CompileJavaModules.gmk line 147:
> 145: # <tempdir>/<module>/<classpath>
> 146: # and then copy the class files into:
> 147: # <outdir>/<module>/META-INF/preview/<classpath>
"<tmpdir>" -> "TEMP_OUTPUTDIR"
No need to mention the copy here, its commented below.
make/CompileJavaModules.gmk line 178:
> 176:
> 177: # Copy compiled output from "<tempdir>/<module>/<classpath>/..." directories
> 178: # to "<outdir>/<module>/META-INF/preview/<classpath>/...".
"<output>" -> "$COMPILATION_OUTPUTDIR"
is more readable without having to translate variable name.
-------------
Marked as reviewed by rriggs (Committer).
PR Review: https://git.openjdk.org/valhalla/pull/1985#pullrequestreview-3725091682
PR Review Comment: https://git.openjdk.org/valhalla/pull/1985#discussion_r2743584483
PR Review Comment: https://git.openjdk.org/valhalla/pull/1985#discussion_r2743591913
More information about the valhalla-dev
mailing list