RFR: CODETOOLS-7903106: Reduce dependence on the "form" of dependencies
Jonathan Gibbons
jjg at openjdk.java.net
Wed Feb 23 03:02:15 UTC 2022
Please review a medium-sized refactoring of the `jtreg` build and top level of the code.
The underlying goal is to eliminate knowledge from the makefiles and source code of specific transitive dependencies for dependencies like JUnit and TestNG, so that it is easier/simpler to update the (versions of the) dependencies without having to update the makefiles or source code. It becomes sufficient to just update scripts like `build.sh` that download dependencies before invoking the makefiles. In particular, it isolates the makefiles and code from the choice to use discrete jars or "uber-jars" for the dependencies.
To this end, the makefile variables for a dependency and its dependencies are replace by a single variable that lists them all. For example, `TESTNG_JAR`, `GOOGLE_GUICE_JAR` and `JCOMMANDER_JAR` are combined into a single variable, `TESTNG_JARS`. Likewise `JUNIT_JAR` and `HAMCREST_JAR` are combined into `JUNIT_JARS`. Similarly, the makefile variables for the various legal notices are combined into `TESTNG_NOTICES` and `JUNIT_NOTICES`.
Code in `Tool.java` used to have specific knowledge of these dependencies and their transitive dependencies.
To address this, the makefiles now create a new `jar.properties` file, listing one or more jar files for each named dependency. Within the code, the old `JarFinder` class is replaced by a new `JarManager` class that reads the new `jar.properties` file to determine the set of jar files needed for each dependence.
For anyone building `jtreg` with `build.sh`, the change should be completely transparent.
For anyone running `jtreg`, the change should be completely transparent.
For anyone using custom scripts that invoke the makefiles directly, the set of variables that need to be specified has changed.
As part of this work, the README in the repo has been split into a list of references to other documentation, with the content about building `jtreg` moved and updated to a new file, `doc/building.md`.
A side effect of this work is that version numbers in the names of imported jar files are now preserved, where previously each file was renamed as it was imported, to eliminate the version. This has a (beneficial) ripple effect on the code for `-version` that reports the versions of dependencies; it also has a ripple effect into some tests that previously assumed simple names for these jar files.
-------------
Commit messages:
- CODETOOLS-7903106: Reduce dependence on the "form" of dependencies
Changes: https://git.openjdk.java.net/jtreg/pull/61/files
Webrev: https://webrevs.openjdk.java.net/?repo=jtreg&pr=61&range=00
Issue: https://bugs.openjdk.java.net/browse/CODETOOLS-7903106
Stats: 1288 lines in 18 files changed: 362 ins; 820 del; 106 mod
Patch: https://git.openjdk.java.net/jtreg/pull/61.diff
Fetch: git fetch https://git.openjdk.java.net/jtreg pull/61/head:pull/61
PR: https://git.openjdk.java.net/jtreg/pull/61
More information about the jtreg-dev
mailing list