RFR: CODETOOLS-7903604: Provide Build.java to (eventually) replace `build.sh`
Magnus Ihse Bursie
ihse at openjdk.org
Tue Jan 16 18:56:20 UTC 2024
On Fri, 8 Dec 2023 23:20:37 GMT, Jonathan Gibbons <jjg 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 824:
> 822: void deleteDirectory(Path dir) throws Fault {
> 823: if (isWindows) {
> 824: exec("rmdir", "\\Q", "\\S", dir.toString());
Options on Windows are like /S, not \S, right..?
make/Build.java line 879:
> 877: config.out.flush();
> 878: config.err.flush();
> 879: // System.err.println("exec: " + cmd + " " + args);
Debug code
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...
make/Build.java line 1617:
> 1615: }
> 1616: }
> 1617: }
Why isn't jcheck complaining about the lack of newline at EOF? I thought it should do that.
-------------
PR Review Comment: https://git.openjdk.org/jtreg/pull/177#discussion_r1424142143
PR Review Comment: https://git.openjdk.org/jtreg/pull/177#discussion_r1424142990
PR Review Comment: https://git.openjdk.org/jtreg/pull/177#discussion_r1424147037
PR Review Comment: https://git.openjdk.org/jtreg/pull/177#discussion_r1424148183
More information about the jtreg-dev
mailing list