AutoValue is a really handy library to eliminate boilerplate in your Java code. Basically, if you have a “plain old Java object” with some fields, there are all sorts of things you need to do to make it work “good,” e.g., implement equals and hashCode to use it in collections, make all of its fieldsContinue reading “Using AutoValue with Bazel”
Author Archives: kchodorow
You do you
I’m a little tired and depressed this week. However, this was a very inspiring speech Neil Gaiman gave to new grads of an art school: Neil Gaiman Addresses the University of the Arts Class of 2012 from The University of the Arts (Phl) on Vimeo. I think that his point about doing what you love,Continue reading “You do you”
Snail Spam
When I started blogging, I called my blog “Snail in a Turtleneck,” a cute image that Andrew & I came up with. I drew up my mascot: and I began posting cartoons I had drawn. I quickly became bored of doing cartoons, and found I was more motivated to put up technical blog posts. MostContinue reading “Snail Spam”
Four alternative debugging techniques
I’ve recently been working on a side project that uses WebGL and a physics engine that was transpiled from C++ into JavaScript so… printing variable to the console and using the debugger just weren’t cutting it. I started thinking about the other ways I debug things: Ship of Theseus debugging: the ship of Theseus isContinue reading “Four alternative debugging techniques”
Compilation à la mode
Bazel lets you set up various “modes” of compilation. There are several built-in (fast, optimized, debug) and you can define your own. The built in ones are: Fast: build your program as quickly as possible. This is generally best for development (when you want a tight compile/edit loop) and is the default, when you don’tContinue reading “Compilation à la mode”
The Mixed-Up Directories of Mrs. Bazel E. Frankweiler
Bazel has several directory trees that it uses during a build. Sources The most obvious directory is the source tree where your code lives and where you run your builds. This is, by default, what Bazel uses for source files. However, you can combine several source trees by using the –package_path option. This basically overlaysContinue reading “The Mixed-Up Directories of Mrs. Bazel E. Frankweiler”
Custom, locally-sourced output filenames
Skylark lets you use templates in your output file name, e.g., this would create a file called target.timestamp: touch = rule( outputs = {“date_and_time”: “%{name}.timestamp”}, implementation = _impl, ) So if you had touch(name = “foo”) in a BUILD file and built :foo, you’d get foo.timestamp. I’d always used %{name}, but I found out theContinue reading “Custom, locally-sourced output filenames”
Using environment variables in Skylark repository rules
If you’ve every used the AppEngine rules, you know the pain that is wait for all 200 stupid megabytes of API to be downloaded. The pain is doubled because I already have a copy of these rules on my workstation. To use the local rules, all I have to do is override the @com_google_appengine_java repositoryContinue reading “Using environment variables in Skylark repository rules”
Resting BUILD face
I am super excited that pmbethe09 and lautentlb just put in a bunch of extra work to open source Buildifier. Buildifier is a great tool we use in Google to format BUILD files. It automatically organizes attributes, corrects indentation, and generally makes them more readable and excellent. To try it out, clone the repo andContinue reading “Resting BUILD face”
Communicating between Bazel rules: how to use Skylark providers
Rules in Bazel often need information from their dependencies. My previous post touched on a special case of this: figuring out what a dependency’s runfiles are. However, Skylark is actually capable of passing arbitrary information between rules using a system known as providers. Suppose we have a rule, analyze_flavors, that figures out what all ofContinue reading “Communicating between Bazel rules: how to use Skylark providers”
