|
| 1 | +# APIDiff |
| 2 | + |
| 3 | +APIDiff is a utility to compare two or more versions of an API, each as |
| 4 | +defined by a series of options similar to those supported by `javac`. |
| 5 | + |
| 6 | +## Building `apidiff` |
| 7 | + |
| 8 | +`apidiff` uses the following dependencies: |
| 9 | + |
| 10 | +* _[Daisy Diff]_: an HTML comparison library, required when building `apidiff` |
| 11 | +* _[Java Diff Utils]_: a plain-text comparison library, required when building `apidiff` |
| 12 | +* _[TestNG]_: the testing framework, used to run some of the tests for `apidiff` |
| 13 | + |
| 14 | +Suitable versions of these dependencies can be downloaded by running |
| 15 | +`make/build.sh`. |
| 16 | + |
| 17 | +### Building with Apache Ant |
| 18 | + |
| 19 | +The default configuration assumes that dependencies have been downloaded |
| 20 | +into the `build/deps` directory. |
| 21 | +These values can be overridden with project-specific local configuration values |
| 22 | +in `build.properties`, if it exists in the root directory of the repo. |
| 23 | + |
| 24 | +```` |
| 25 | + ant -f make/build.xml <target> |
| 26 | +```` |
| 27 | + |
| 28 | +### Building with GNU Make |
| 29 | + |
| 30 | +The default configuration uses values provided in `make/dependencies.gmk`, |
| 31 | +unless these values have been overridden on the command line used to run `make`. |
| 32 | + |
| 33 | +```` |
| 34 | + make -C make Makefile <target> |
| 35 | +```` |
| 36 | + |
| 37 | +### Building with an IDE |
| 38 | + |
| 39 | +An IDE such as IntelliJ IDEA needs the following configuration: |
| 40 | + |
| 41 | +* Sources Root: `src` |
| 42 | +* TestNG Test Root: `test/testng` |
| 43 | +* Libraries: |
| 44 | + * _Daisy Diff_, _Java Diff Utils_ available for compilation |
| 45 | + * _TestNG_ available for testing |
| 46 | + |
| 47 | +In addition, some TestNG tests require access to internal classes in |
| 48 | +the `jdk.compiler` and `jdk.jdeps` modules: |
| 49 | + |
| 50 | +```` |
| 51 | +--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED |
| 52 | +--add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED |
| 53 | +--add-modules jdk.jdeps |
| 54 | +--add-exports jdk.jdeps/com.sun.tools.classfile=ALL-UNNAMED |
| 55 | +```` |
| 56 | + |
| 57 | +The following compiler options may also be desirable: |
| 58 | + |
| 59 | +```` |
| 60 | +-Xdoclint:missing/protected |
| 61 | +-Xlint:unchecked |
| 62 | +```` |
| 63 | + |
| 64 | +_Note:_ When working on the test files, be careful not to mark module source directories |
| 65 | +as `Test Sources Root` at the same time as any source directories that are not |
| 66 | +for a module. |
| 67 | + |
| 68 | +## Documentation |
| 69 | + |
| 70 | +A "man" page is generated as part of the build, and is the primary source |
| 71 | +of information for how to run `apidiff`. |
| 72 | + |
| 73 | +## ShowDocs |
| 74 | + |
| 75 | +`showDocs` is a small utility program that is a simple wrapper around the |
| 76 | +`APIReader` and `SerializedFormReader` classes in `apidiff`, that can provide |
| 77 | +filtered views of the files generated by `javadoc`, in order to view the |
| 78 | +parts of those files that will be compared by `apidiff`. |
| 79 | + |
| 80 | + |
| 81 | +[Daisy Diff]: https://github.com/DaisyDiff/DaisyDiff |
| 82 | +[Java Diff Utils]: https://github.com/java-diff-utils/java-diff-utils |
| 83 | +[TestNG]: https://testng.org/ |
0 commit comments