yahoo / fili

Easily make RESTful web services for time series reporting with Big Data analytics engines like Druid and SQL Databases.
http://fili.io
Apache License 2.0
173 stars 96 forks source link

Migrate builds to Gradle #59

Open cdeszaq opened 8 years ago

cdeszaq commented 8 years ago

As nice as Maven is, it's been a challenge to get it working the way we'd like and making it do more seems to be more painful than painless. So, to ease our pain (and hopefully get faster builds), we want to move to Grade.

The main reasons we're looking at switching are:

  1. Speed.

    Gradle is really good at only recompiling what it needs to, and while Maven can (in theory) do some of this, it's not nearly as good at it. Gradle, in general, has more flexibility (or at least more easily accessible mechanisms) around speeding up builds and determining dependencies.

  2. Flexibility and Control

    Gradle is much more easily flexible than Maven is. Not only are there a bunch of plugins out there for Gradle already, but Gradle also makes it very easy to write new plugins for richer flexibility, whereas Maven does not do the same. One of these big things that we're looking at for this is the ability to have multiple sets of tests for different categories of things. In particular, breaking out the Unit, Functional, and Integration tests as separate aspects.

  3. General Scriptability

    Gradle makes it much easier to do related build scripting, partly due to the way it views the world, as well as due to it's Groovy roots and the ease with which external processes can be managed. In particular, some of the things we're looking at are:

    1. Spinning up an instance of Fili using an embedded Jetty very easily (ideally with just a command like gradlew run
    2. Spinning up a full suite of demo dependencies (Druid, Redis, etc) so that a sandbox instance can be running in under 5 minutes with minimal setup with just a simple command like gradlew demo
    3. Spinning up real dependencies during tests so that we can test against real Druid instances, and potentially multiple versions, rather than having to fake everything
  4. Developer Friendliness

    Gradle comes with gradlew, which is a wrapper script that will download the dependencies needed for a project to build / compile (on both Windows and *Nix environments), so that developers don't need to worry about having the right version of Gradle or other build dependencies installed. Gradle can handle that for us, which makes it easier to get up and going for those looking to extend Fili.

  5. Better Groovy Support

    Maven's support for compiling both Java and Groovy in the same project is limited, rather clunky, and not super well supported. Not only has this caused some problems, but it's also made it more challenging to use Groovy-oriented tooling, like Code Narc (which is like CheckStyle for Groovy). Gradle, on the other hand, has multi-language support (especially Groovy and Java) as a 1st-class feature.

archolewa commented 8 years ago

💯 💯 💯 💯 💯 💯

dejan2609 commented 7 years ago

@cdeszaq would love to work on this. Am I allowed to share some ideas / send PR (if external contributions are allowed for this specific ticket) ?

michael-mclawhorn commented 7 years ago

Right now I'm looking for some Fili implementor to pilot using gradle on their fili-derived project to figure out how difficult or easy it is to adapt the build process to it. Our chief gradle evangelist from the Core Team(@cdeszaq) moved and took a new job and has been fairly idle since then.

cdeszaq commented 7 years ago

By all means feel free to take a stab at it / provide input. Our Gradle efforts are very nascent so anyone with experience (or desire to learn) is welcome.

As Mike said, I've been more checked out than originally planned, but I am watching from afar more than it may seem ;-)

I will say that one of the biggest hurdles will be to help the whole Fili community get up to speed with Gradle and be comfortable with it. So with that in mind, lots of comments and even links to documentation so that others can follow along, and to explain why a choice makes sense, would be a good idea.

On Aug 14, 2017, at 1:19 PM, michael-mclawhorn notifications@github.com wrote:

Right now I'm looking for some Fili implementor to pilot using gradle on their fili-derived project to figure out how difficult or easy it is to adapt the build process to it. Our chief gradle evangelist from the Core Team(@cdeszaq) moved and took a new job and has been fairly idle since then.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

dejan2609 commented 7 years ago

@michael-mclawhorn I'll try to provide non-biased Maven vs. Gradle comparison (followed by some examples / pitfalls / suggestions).

Maven (devil's) advocacy combined with just a few Gradle pitfalls

(main idea is to show that Maven is not all that bad or that Gradle is not a silver bullet solution):

Final verdict:

Some rules (among others) for successful Gradle builds:

dejan2609 commented 7 years ago

Examples / usefull links:

Big projects that moved from Maven to Gradle:

Projects that use Gradle since day one:

Rather complicated Gradle build examples IMHO (just to be fair: build requirements are high for these projects given a fact that their stack of technologies is pretty mixed OR they produce multiple/parallel artifacts):

dejan2609 commented 7 years ago

Stay tuned, pull request (first draft) is on the way.