-
Notifications
You must be signed in to change notification settings - Fork 267
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
FREEMARKER-204 Change build from Ant to Gradle #79
Conversation
06fd637
to
33dd617
Compare
884a3d1
to
e694c49
Compare
e694c49
to
7283c15
Compare
25e1632
to
34c0334
Compare
There were a few changes in the 2.3-gae (Ant) branch since then, because of which this PR will have to be updated (maybe after the other PR-s were merged).
|
All other pending PR-s (that we afraid to break) has been merged. So, if the above were addressed, we can merge this. |
34c0334
to
57bc571
Compare
I have rebased the branch on top of "2.3-gae", but I haven't done meticulous validation yet after the rebase (only basic checks that it is not obviously broken). Anyway, I have pushed it so that you can review it (in the mean time, I will do more comparisons between the Ant and Gradle builds). Also, I don't think I fully understood what you meant by "default Java 16 HTML lint rules" for Javadoc, because I have not seen anything special in the build.xml. So, please do check, if the current Javadoc settings are fine or not. |
As the Java version used for javadoc was increased to 16, the javadoc HTML lint rules become stricter, and therefore the javadoc comments were corrected (not |
Great, because as a coincidence I applied the same flags as well (though I can't see them anywhere in build.xml, maybe I'm just blind). Also - just for reference - the new build applies a (lot) newer version of bnd, and thus generates a different manifest. If it turns out to be an issue, then I do have a local branch where I tested it with an older version (same as the Ant build), and that generates the same manifest (though it makes the build more awkward since I have to call the Ant plugin in that case, which is inconvenient to parameterize). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added some thoughts on reproducible builds @kelemen
@@ -21,16 +21,13 @@ | |||
# imports by examining the class files, and generates the OSGi meta-info | |||
# based on that and this file. | |||
|
|||
-classpath: build/classes | |||
-failok: false | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, but in this PR, my goal is to reproduce the Ant build the best I can. So, I think it would be better to have such changes be done in a separate PR (after merging this). And I guess, then it would be better, if someone more competent in OSGI (I myself have very limited experience and knowledge) did that (I assume you are a lot more competent than me in OSGI).
into("META-INF") | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kelemen
also about reproducible builds (see my other comment)
Something like this might be worth considering for a reproducible build.
tasks.withType<AbstractArchiveTask>().configureEach {
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
filePermissions {
unix("rw-r--r--")
}
dirPermissions {
unix("rwxr-xr-x")
}
}
Background info here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to your other comment, I think this would make sense in another PR as another request. It would also be less to verify in one go. Though, isReproducibleFileOrder = true
might be something that would go well in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kelemen Sure, no problem, it can go in another PR. Just wanted to add my thoughts as it came to mind when reading this here and I thought it might be an idea "while you are on it" :) But sure there is already a lot in this PR, so feel free to do whenever you see fit.
There's no |
I did some deeper checks on the output of the Gradle build by comparing it to the output of the Ant build. The differences are the following:
|
It's of course better that here we build with real JDK 8 (except The javadoc we are using is from JDK 8 currently, but it should be the JDK 16 one (that has the search field, etc.). Signing: Not sure how people enter/store safely their private key password (like maybe have a
(Haven't tested publishing to the Apache Maven repo yet. That also will get the extra credentials from somewhere. Will see...) Some minimal comments/explanation here and there would be good. Like is's a quite tricky build with the "fake" subprojects for example. Also, in the 3 branch I had comments about the Serlvet/JSP testing dependencies, that weren't copied over. The build section of the README.md needs to be updated. I can do it after merge, or maybe you want to provide some information yourself there. |
Right, I forgot to allow configuring credentials for the actual release repository ... I will fix that. Javadoc JDK version: That is what I had in mind, just a couple of things became obsolete after the drop for Java 7 support, and I didn't reorganize those versions (and properties). I will clean this up, and will put a I personally just keep a copy of my I didn't see your comments (didn't even check) on branch 3, but I will do so, and will copy the relevant ones. As for the README: I can update things from branch 3, and whatever you find missing you can update it after merge (it is probably easier than going back and forth in the PR for the README only). |
I have added the possibility to configure the credentials for publishing into the Apache repository by setting the Also cleaned up the JDK version configurations (the default values are in Instead of having a I have checked branch 3, but couldn't find your comments. Anyway, I have updated the README (the Eclipse part was a bit lazy, because I don't have Eclipse installed at the moment, I just simply wrote "Import the project as any other Gradle project", since - as I remember - there was nothing special when I tried last time. |
e36da24
to
54820b3
Compare
The artifact name on this branch should be Other than that, it seems mergeable. (Also tried publishing to the snapshot repo of Apache.) That comment on 3 branch is here (but obviously I can add it after merge too):
|
- SuppressFBWarnings is not commented. - Versions might still be mixed up here and there (i.e. "version" and "mavenVersion") OSGI differences: - OSGI plugin adds "Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"" - "Export-Package" has a lot less "uses" per package.
…ished classes. Instead, there is a package private annotation in all places (since it seems that the package name does not matter)
…stCase.getTestClassDirectory() to work from Gradle when not passing the "freemarker.test.resourcesDir" system property (which is the case when executing say TemplateTestSuite.main).
…understand that sourcesets should have different dependencies).
…uld have been deployed in a normal release.
…che Maven repository.
…signMethod` property. The possible values are: none, gradle_properties, gpg_command.
54820b3
to
b9692da
Compare
Added the comments, and changed the artifact name to
I decided to go with option 1, because it is considerably more simpler, and less error prone. The reason I have considered option 2 is that in that case it wouldn't change the name of the project when switching branches. I'm not aware of any IDE issues when you changing the name of the root project though. |
Did some minor README(-ish) adjustments post-merge. Also this is not merged into the 2.3 branch. One thing I noticed... you exclude gradlew from the source distro. I can't remember, were there some legal issues with including that? Because the goal would be that people can extract the src distro, look at the README, and can build the product. |
I'm not aware of any legal issues, but if you want to include |
Quick feedback. I added this to
as described here https://docs.gradle.org/current/userguide/toolchains.html#sub:download_repositories which automatically downloads the required JDKs. I did not have JDK16 installed so the build failed initially. This plugin made it work automatically. Just as an idea to make it build right away without manual intervention. Furthermore I installed built Conclusion: 👍 |
@chrisrueger Thanks. I was bit worried that the new bnd might break something, but it is certainly reassuring that a real project is fine with the changes. As for auto provisioning: I thought about applying it, but then decided against it since it can be annoying that a tool just installs a full JDK hidden deep into ~/.gradle. And one JDK you need anyway to start Gradle (although the current build works with any JDK 8 and above). Though since JDK 16 is uncommon for someone to have it already installed, it might be reasonable to have this automated, but I guess @ddekany can weigh in, if that would be a preferred behavior. |
I added all gradlew related files, except the jar, but added a note about that in the README. It looks absurd, but it's ASF policy thing. When people vote for a release, they have to build from the source release, not from the Git repo sources. I checked what a few other projects did, and basically they do the same. |
As an option we can do that. Easier for the people who will vote on the release. |
* this makes it easier to build e.g. when no JDK16 is installed. It installs it automatically (see https://docs.gradle.org/current/userguide/toolchains.html#sub:download_repositories). see also the discussion here apache#79 (comment) Feel free to exclude this commit if this should be in a separate PR
For easier review:
The project can be build by executing:
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:
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).