facebook / buck

A fast build system that encourages the creation of small, reusable modules over a variety of platforms and languages.
https://buck.build
Apache License 2.0
8.56k stars 1.16k forks source link

Extra Checkers/Linters Support #1385

Open nordlow opened 7 years ago

nordlow commented 7 years ago

Does Buck support some way of calling extra linters/checkers in parallell with the compilation step similar to what Bazel provides here. I'm thinking mainly of calls to

And what about using the result of the checkers outputs as inputs into successive build steps to collect metric reports on test coverage etc?

kageiit commented 7 years ago

We are also definitely interested in this. This would allow us to run static analysis in parallel with the compiler and break the build if there are violations.

cc @msridhar @hzsweers

yiding commented 7 years ago

Can this be implemented via wrapper scripts around the compiler, such that compiler invocations can also fork off a linter check? You can also wrap ar and ld to collect these lint outputs. In this manner you can create build+lint without any special build system support. The only issue is that caching of these analysis would not be well supported.

kageiit commented 7 years ago

@yiding That would disable in memory compilation which would remove a lot of benefits :(

yiding commented 7 years ago

What is "in-memory compilation"?

jkeljo commented 7 years ago

In-memory compilation is referring to Jsr199Javac, which invokes the compiler in-process with Buck. It's a ton faster than exec'ing javac for each rule (e.g. for Buck itself literally 100% faster), because it eliminates invocation and VM startup overhead, allows the compiler (and in some cases annotation processor) classes to be loaded just once, enables some cross-build caching of JAR directories, lets the HotSpot JIT get the compiler code nice and speedy, allows us to build the output JARs in memory, enables dependency file support, and probably some other things I'm forgetting. The list keeps getting longer since most of our Java-specific performance efforts are focused on this mode.

One alternative that can be done now is to create extra build rules with the dependencies hooked up in such a way that the checking rules will always run any time the compilation rule does. However, that way has other challenges, in that it can slow down the initial processing of the BUCK files, put additional stress on cache servers (and require more cache fetches), and make the graph generally harder to understand.

linzhp commented 6 years ago

Any updates on this?