Skip to content

LOMBOK CONCEPT: Why does lombok build with ant

Reinier Zwitserloot edited this page May 14, 2018 · 2 revisions

Lombok's build

Lombok's build is extremely complicated. We build the same source files multiple times, targeted at different JVM releases, using a mix of ecj and javac. We even compile stubs that are only used for further compiles and explicitly should not be included in the final product. We do our own take on striping (sometimes called shading), and we outright run custom code during builds for amongst other things building the lombok website.

Thus, please understand: Lombok's build process is itself a piece of software and thus the benefit of 'standardizing' to 'things people are familiar with' does not apply.

If we switch to maven, the entire build would simply be to call a custom written maven plugin that is as complicated (or worse) as our current ant build. Other than a giant waste of time, this gets you absolutely nothing.

if we switch to gradle it won't be quite as bad, as gradle is a lot nicer for custom 'coding' in your build, but it's not going to be significantly simpler to understand than our current ant based build.

I know! I'll rewrite the build infra to maven / gradle / sbt / kobalt / etc...

Please don't.

But ant is just bad

Absolutisms don't work well in programming. Consider the context: There are vanishingly few projects that have a good reason for having a complicated build. And lombok goes a step further: I wouldn't be surprised if lombok is the most complex build amongst all open source java projects.

Given all that, the build tool you use is a fancy launcher for custom code, which makes the pros and cons of the build tool mostly irrelevant.

I really do think the build could be better though

You're probably not wrong there!

A few points of improvement we can think of:

  • Currently, some of our build is built with ecj (and the ecj version we use for this is 'locked in' because it is pulled in as a build dependency via ivy: It's a download we control), which is a recent improvement because javac, starting with JDK9, can no longer produce the required JVM1.5 targeted builds. It'd be better and more consistent (specifically, you'd be less dependent on having, for example, JDK9+ as runtime java when running the build, which is currently a requirement) if ecj was used for every compile.
  • The build should be even more specific about bootclasspaths than it already is, to reduce the dependency on the installed JDK as much as possible.
  • The test targets in the ant build should be more easily configurable to run against whatever installed eclipse you'd like to point it at, in order to make it simpler to test lombok against specific eclipses.

Before putting in the effort to rewrite the build to another build system, please talk to us first, and please address why you think this improves things. "Maven is better" or "gradle is better" or similar arguments will not be sufficient to convince us.