
Bazel can now build Haskell - mboes
https://www.tweag.io/posts/2018-02-28-bazel-haskell.html
======
oblio
I wonder if Bazel takes off across many languages. It wouldn't hurt to have a
modern autotools & co. replacement across ecosystems. I don't think it's
doable, considering the fact that we have language specific package managers
and build tools, but you never know.

By "replacement", I mean picking up a random open source project and being
able to do the equivalent of:

./configure

make

make install

To be able to build and run the app directly from sources, when needed.

Right now, it's a mess, the "replacement" is:

curl whatever.io | sudo bash

~~~
steinuil
I doubt Bazel will take off for most open source projects due to being written
in Java, but I do share the sentiment.

I've been meaning to try and write a somewhat saner build system to replace
the Auto* hell, at least for C and C++. I'm focused on other things right now
but I've been studying and collecting information about the architecture of
many other build systems for a while, and some of them are so much ahead of
those used in open source projects it's not even funny. At the very least I'll
be writing a lengthy blog post with my findings.

~~~
numbsafari
The java dependency is my biggest hangup wrt to incorporating it into my own
environment.

So far, I've avoided having to incorporate the JDK into my stack. Having to
bring it in just for a build tool, keeping it up-to-date on developer
configurations, just feels like a royal pain.

I realize it's never gonna happen, but having bazel rewritten in Go or C++ or
anything else that produces a single binary would be awesome.

~~~
pebers
We have done more or less that: [https://please.build](https://please.build) /
[https://github.com/thought-machine/please](https://github.com/thought-
machine/please)

It's written in Go so doesn't need any external dependencies unless you want
to target that language (i.e. it only needs a JDK if you're trying to build
Java).

Disclaimer: I'm the main author.

~~~
numbsafari
Wow. Looks good! Thanks for the heads up.

------
aphexairlines
Given that Nix is already popular in the Haskell ecosystem and it's also
polyglot, why not build the monorepo with that instead of Bazel?

~~~
evmar
Can Nix build incrementally? One random collection of notes I just dug up says
that it rebuilds packages from scratch on minor changes. It seems like Nix is
addressing a different problem.

~~~
clhodapp
I thought that Bazel's notion of "incremental building" was at the project
level of granularity too. Is that incorrect?

~~~
haldean
Bazel recompiles at the source file level, and it's very good at only
recompiling only what's necessary; for example, it caches object files for
C++, and will only rebuild the object files of changed source files, and then
relink.

------
irq-1
Seems like SCons: [http://scons.org/](http://scons.org/)

> Built-in support for C, C++, D, Java, Fortran, Yacc, Lex, Qt and SWIG, and
> building TeX and LaTeX documents. Easily extensible through user-defined
> Builders for other languages or file types.

Godot [https://godotengine.org/](https://godotengine.org/) uses SCons and it's
great; easy, quick and reliable.

~~~
echlebek
What I don't like about scons, is that when it fails, it's inscrutable.
Happily for scons detractors, it seems to be fading from use.

------
netheril96
A significant hurdle for the universal adoption of Bazel is its too many
dependencies.

~~~
oblio
sudo apt-get install openjdk-8-jdk

sudo apt-get install pkg-config zip g++ zlib1g-dev unzip python

That's a fair few things, but it doesn't see that awful. None of those
dependencies seem exotic. I wonder if they could get rid of Python by using
Jython on top of the JDK.

~~~
kylecordes
Right, and a proper packaging "in the box" reduce it to a single install
command on most any Linux. Right now it's pretty close to that on a Mac also
if you already have brew.

The current long pole in the tent is Windows. Bazel brings along its own JVM -
so there isn't any Java or Java dependency difficulty (as some other posters
have suggested). But the install instructions direct you to provide some
dependencies first, by hand. Of course in the long term a little while spent
installing is no big deal... but each new adopter has to get through the short
term on the way to the long term.

Hopefully a future Bazel installer will "just work" on Windows as a single
installation with no instructions.

~~~
oblio
Maybe they could use this for the JRE bundling:
[https://docs.oracle.com/javase/9/tools/javapackager.htm#JSWO...](https://docs.oracle.com/javase/9/tools/javapackager.htm#JSWOR719)

------
platz
inline-java is a wonderful package - more examples running java code from
haskell here - [https://www.tweag.io/posts/2017-09-15-inline-java-
tutorial.h...](https://www.tweag.io/posts/2017-09-15-inline-java-
tutorial.html)

------
throwaway84742
Blaze (Bazel’s internal counterpart) could build Haskell for close to a
decade. In fact it built the Haskell _compiler_ as an indirect tool dependency
of a lot of build targets.

------
ncmncm
There is no language named C/C++. There is C, and there is C++. To be taken
seriously, treat them as the very different languages they are.

~~~
klodolph
From the perspective of a build system, the difference between supporting C or
C++ and supporting both is minor.

Speaking as someone who has made their own build system, as dumb as that is.

~~~
imtringued
It's not dumb. The C++ ecosystem is still crap even though it had decades to
catch up.

