-
Notifications
You must be signed in to change notification settings - Fork 378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use QDox 2 to generate sugar class from a single pass of parsing source #66
Conversation
Download from Central rather than committing as a binary to avoid growing the repository on upgrade.
Upgrade the build and fix API changes.
- Make all sample matcher methods match the requirements for factory methods. - Move sample matchers into separate source, to work around QDox not considering annotations when parsing from loaded classes. - Assert that an expected item is there when testing.
…Test. To prepare for consolidating into a single reader, copy across all tests.
These are tests for things the reflective reader couldn't do. As QDox provides these, change them to positive tests.
…ective reader. Rely more on QDox 2.0 and ensure that the QDox reader passes all tests that the reflective reader does.
Copy over some structure from the original reader implementation, to clarify behaviour.
For running in builds, don't require clients to create the specified directory in advance.
👍 (Maven build) |
Looks good, but could you separate the change to use QDox2 from the change to download dependencies from another repo instead of having a self-contained repo? That's a more contentious issue and is therefore likely to delay acceptance of the rest of the changes which are an obvious improvement to the build, so the two changes would be best as two different pull requests |
From: https://repo1.maven.org/maven2/com/thoughtworks/qdox/qdox/2.0-M2/qdox-2.0-M2.jar sha1sum: fa5d16f9a3ab0bba30e37bd0881f32b2402bcb93
Fair point; it's an unrelated change, and there's no reason to make it here. I've pushed the binary in this branch and will make a separate PR for the more controversial change. |
Use QDox 2 to generate sugar class from a single pass of parsing source
hamcrest-generator
currently contains two separate reader classes, one which uses reflection and one which uses QDox, which work together to extract all information. This means that the sugar classes need to be generated after compilation, which complicates things when trying to make changes to the build.This change upgrades to a recent milestone of QDox 2 which has good enough generics parsing to cover all the cases that previously required reflection. It throws away
ReflectiveFactoryReader
for an improvedQDoxFactoryReader
that covers all the previous cases.All tests are carried across to the new implementation. Now there's a single Reader, they need to be marked as factory methods for all tests and parsed from files rather than taken from the classpath.
The primary motivation for this change is to allow for a Maven build (in a separate build-with-maven branch), where
Matchers.java
andCoreMatchers.java
can be generated in thegenerate-sources
phase. However, it also simplifies things by shrinking the codebase and moving to a single-pass model.~~In another step inspired by Ivy and Maven, it downloads the new version from Central rather than committing it as a blob. This saves growing the git repo by ~200K every time a new version is used.~~