RFR: CODETOOLS-7903604: Provide Build.java to (eventually) replace `build.sh`
Jonathan Gibbons
jjg at openjdk.org
Tue Jan 16 18:56:21 UTC 2024
On Tue, 12 Dec 2023 15:10:36 GMT, Magnus Ihse Bursie <ihse at openjdk.org> wrote:
>> Please review a new, alternative way to download the dependencies needed to build `jtreg`.
>>
>> Currently, the generally recommended way to download or otherwise find the dependencies is to use the `make/build.sh` script. This PR provides an essentially equivalent alternative written in Java: `make/Build.java`, which is a single source file and so can be run with the standard support for running single source file programs in the Java launcher.
>>
>> old: sh make/build.sh options...
>> new: path/to/java make/Build.java options...
>>
>> The configuration values are essentially the same; in particular, the default configuration values in `make/build-support/version-numbers` are exactly the same as for `build.sh`. Configuration values may now also be given on the command-line or in a file specified on the command line. The primary configuration difference is that there is no longer support for downloading a version of JDK to build jtreg; the default is to use the same version of JDK as is used to run `Build.java` although an alternate version of JDK to build `jtreg` itself can be specified as an option to `Build.java`.
>>
>> As with `build.sh`, the new `Build.java` writes and optionally executes a shell script to run `make` with variables set up to point to the local version of the dependencies.
>>
>> There is no change to the makefiles, or to the functionality of `jtreg` itself.
>>
>> There are minor internal changes to the organization of the dependencies in the `build/deps` directory, and minor changes to the logging output written by the program.
>>
>> The old `build.sh` and related shell files remain in place for now, but may be removed at some point in the future.
>
> make/Build.java line 1605:
>
>> 1603:
>> 1604: try (PrintWriter out = new PrintWriter(Files.newBufferedWriter(file))) {
>> 1605: out.println("#!/bin/sh");
>
> Looks like a good place to use a text block instead...
1. The code is currently targeted as JDK 12 or later, so no text blocks.
2. More significantly, the computation on line 1606 (for the directory) is incompatible with text blocks
-------------
PR Review Comment: https://git.openjdk.org/jtreg/pull/177#discussion_r1424466194
More information about the jtreg-dev
mailing list