freemarker
freemarker copied to clipboard
FREEMARKER-204 Change build from Ant to Gradle
For easier review:
- Many files were moved around for easier compilation (i.e., there is no need to add file filters due to different dependencies)
- Most files were just moved without any changes
- Some tests were added a @RunWith annotation, because otherwise Gradle would skip those JUnit 3 tests.
- A few java files had their mode changed from 755 to 644
- The findbugs dependency of SuppressFBWarnings was removed from the normal source compile time classpath, and new package private annotations were created (since spotbugs only cares about the name, not the package). This change was made to avoid fooling up-to-date checks, and to simplify the build considerably.
- FileTestCase.java was adjusted because of the resource path change. The current solution is still a hack, but a correct solution would require a change in many places (in tests only).
- TemplateTest.java needed a small Javadoc change since it can no longer access TemplateTestSuite.
- Other than the above, the osgi.bnd and rat-excludes files had to be adjusted due to file path changes (and new files).
The project can be build by executing:
./gradlew build -PsignPublication=false
The above command will build all packages and run all checks and tests.
To build with signatures, you can omit the "signPublication" property setting, and have to configure the gpg keys in ~/.gradle/gradle.properties like this:
signing.keyId=xxxxxx
signing.password=xxxxxx
signing.secretKeyRingFile=xxxxxx
A small improvement is that you can set the "developmentBuild" property to "true" in ~/.gradle/gradle.properties. In which case the timestamp will be set to the EPOCH (instead of the current time). This is beneficial to avoid preventing the jar task from being up-to-date. However, if this is made, then the official release has to pass -PdevelopmentBuild=false (a further improvement could be added to make a check depend on a task checking that this flag is not true).
To publish the artifacts to the Apache repository, the publish task has to be run as well (preferably in the same command as the "build" command).