Skip to content

Commit 83e4d30

Browse files
7903859: add more details to the top-level README.md file
Reviewed-by: iris
1 parent db3c474 commit 83e4d30

File tree

2 files changed

+71
-7
lines changed

2 files changed

+71
-7
lines changed

README.md

Lines changed: 55 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,33 @@ defined by a series of options similar to those supported by `javac`.
88
`apidiff` uses the following dependencies:
99

1010
* _[Daisy Diff]_: an HTML comparison library, required when building `apidiff`
11+
* _[Equinox]_: the Eclipse Common Runtime, used by Daisy Diff; it is required
12+
when building Daisy Diff from source, but may already be included if using
13+
a precompiled copy of Daisy Diff in a JAR file.
14+
* _[HTMLCleaner]_ : a library to sanitize HTML prior to comparison with Daisy Diff
1115
* _[Java Diff Utils]_: a plain-text comparison library, required when building `apidiff`
1216
* _[JUnit]_: the testing framework, used to run some of the tests for `apidiff`
1317

1418
Suitable versions of these dependencies can be downloaded by running
15-
`make/build.sh`.
19+
`make/build.sh`, using configuration details in `make/build-support/version-numbers`.
1620

1721
### Building with GNU Make
1822

19-
The default configuration uses values provided in `make/dependencies.gmk`,
20-
unless these values have been overridden on the command line used to run `make`.
23+
If you have run `make/build.sh`, there will be a convenient shell script stored
24+
in `build/make.sh` that runs `make` with variables set to the locations of the
25+
downloaded dependencies. You may also run `make` directly, using _make_ variables
26+
to specify the locations of any necessary dependencies.
2127

2228
````
23-
make -C make Makefile <target>
29+
sh build/make.sh <target>
2430
````
2531

32+
Useful targets are:
33+
34+
* `sanity` -- to check settings of necessary _make_ variables,
35+
* `build` -- to build the files for a release, and
36+
* `test` -- to run all the available tests.
37+
2638
### Building with an IDE
2739

2840
An IDE such as IntelliJ IDEA needs the following configuration:
@@ -33,6 +45,13 @@ An IDE such as IntelliJ IDEA needs the following configuration:
3345
* _Daisy Diff_, _HTMLCleaner_, _Java Diff Utils_ available for compilation
3446
* _JUnit_ available for testing
3547

48+
_Note:_ when working in an IDE, it is strongly recommended that you use
49+
a precompiled JAR file for Daisy Diff. The source files refer to additional
50+
dependencies that are not required or downloaded for APIDiff. While these
51+
source files are ignored when building APIDiff with GNU Make, it may not
52+
be possible to exclude those source files when registering Daisy Diff as
53+
a source-file dependency in the IDE.
54+
3655
In addition, some JUnit tests require access to internal classes in
3756
the `jdk.compiler` and `jdk.jdeps` modules:
3857

@@ -51,22 +70,51 @@ The following compiler options may also be desirable:
5170
````
5271

5372
_Note:_ When working on the test files, be careful not to mark module source directories
54-
as `Test Sources Root` at the same time as any source directories that are not
73+
as `Test Sources Root` at the same time as any source directories that are not
5574
for a module.
5675

76+
## Testing `apidiff`
77+
78+
You can run the tests using the `test` target for GNU Make, using either
79+
`make/build.sh` or the subsequently generated `build/make.sh`. You can
80+
specify either the overall `test` target or the absolute path name of
81+
the `*.ok` file for any individual tests. That being said, most of the
82+
tests are written as JUnit tests, and can either be invoked as a group
83+
as part of the overall `test` target, or individually, by using JUnit
84+
directly, either using the JUnit command-line tool, or by using JUnit
85+
support within an IDE.
86+
87+
Just as some `--add-exports` options are needed to compile APIDiff,
88+
the same options will need to be provided in any IDE configuration used
89+
to run tests.
90+
5791
## Documentation
5892

5993
A "man" page is generated as part of the build, and is the primary source
60-
of information for how to run `apidiff`.
94+
of information for how to run `apidiff`. The tool also provides simple
95+
command-line help, listing the available options and a summary of their
96+
meaning.
97+
98+
You can see recent versions of the documentation on the APIDiff
99+
[project page][apidiff-project]:
100+
101+
* ["man" page][apidiff-man]
102+
* [command-line help][apidiff-cmdline-help]
103+
104+
[apidiff-project]: https://openjdk.org/projects/code-tools/apidiff/
105+
[apidiff-man]: https://openjdk.org/projects/code-tools/apidiff/apidiff.html
106+
[apidiff-cmdline-help]: https://openjdk.org/projects/code-tools/apidiff/cmdline-help.html
61107

62108
## ShowDocs
63109

64-
`showDocs` is a small utility program that is a simple wrapper around the
110+
`showDocs` is a small utility program that is a simple wrapper around the
65111
`APIReader` and `SerializedFormReader` classes in `apidiff`, that can provide
66112
filtered views of the files generated by `javadoc`, in order to view the
67113
parts of those files that will be compared by `apidiff`.
68114

69115

70116
[Daisy Diff]: https://github.com/DaisyDiff/DaisyDiff
117+
[Equinox]: https://projects.eclipse.org/projects/eclipse.equinox
118+
[HtmlCleaner]: https://htmlcleaner.sourceforge.net
71119
[Java Diff Utils]: https://github.com/java-diff-utils/java-diff-utils
72120
[JUnit]: https://junit.org/

src/share/doc/apidiff.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,13 @@ although that is not a requirement. To eliminate any false positive differences
349349
being introduced by changes to the `javadoc` tool itself, the same or equivalent
350350
versions of `javadoc` should be used for each API to be compared.
351351

352+
If you want to compare all the exported packages in a module, use
353+
`--include <module>/**`. If you want to compare the contents of
354+
specific packages in a module, use `--include <module>/<package>.*`
355+
or `--include <module>/<package>.**`. The `.**` form will also include
356+
the contents of any subpackages. You can use multiple `--include`
357+
options to include different parts of an API in the comparison.
358+
352359
### Configuring instances of JDK to be compared
353360

354361
`apidiff` can be used to compare different instances of JDK, but that can be
@@ -420,6 +427,15 @@ you can combine the recommended options for the two modes, specifying both
420427
`--patch-module` options for the source files and `--api-directory` for the
421428
generated documentation.
422429

430+
If you are using the `--jdk-build` option, and the corresponding `images`
431+
directory has multiple matches for `images/*docs*`, you will need to use
432+
the `--jdk-docs` option to disambiguate which documentation directory to use.
433+
The value that you give should be the name of one of those subdirectories
434+
of the `images` directory. The `--jdk-docs` option is not specific to any
435+
individual API, and need only be given once on the command-line.
436+
It will be used as needed to disambiguate the documentation directory to be
437+
used for any API that is defined by using the `--jdk-build` option.
438+
423439
If you want to see or understand how the options are used internally, you
424440
can use `--verbose options`, possibly implicitly as part of `--verbose all`.
425441

0 commit comments

Comments
 (0)