Python as a build tool

tonsky.me
6 min read
easy
Why Skija and JWM use Python instead of existing build tool
Python as a build tool

Normally, when starting a Java project (or any other programming project, really), you don't want to reinvent the wheel. You go with the de-facto build system, folder structure, environment etc. The ones that rest of the world is using.

Yet, both Skija and JWM are built using Python scripts instead of more traditional Ant/Maven/Gradle/SBT. Why? Let's find out!

Maven

When we just started Skija, I used Maven because I knew it well. Pretty soon we run into Maven limitations: it's a very rigid system. It does well on standard projects, but when you need something extra, it becomes an obstacle.

And we had very non-standard project. Skija is 50/50 Java AND C++ project. We build native artifacts and pack them in JARs files. We have multiple different JARs built from the same source (one per platform). We also pre-process Java sources with Lombok before compiling them.

Funny fact: the only IDE that supports simultaneous Java + C++ development is Android Studio. No, we weren't ready to make this sacrifice.

With each complication, I fought hard to make it work with the Maven. But its rigidness made easy things extremely hard. E.g. I couldn't control which files from the directory should go into JARs and which should not. I couldn't tell it at which directory to look.

Eventually, I gave up. It was ridicously hard affair to achieve trivial things. E.g. you need to generate/modify XML file on the fly just to pass credentials from the environment. Or I couldn't stop Maven from running tests when I didn't need to.

Gradle

We didn't even try Gradle on Skija project, but I saw my colleagues use it in the wild. Gradle is mostly magic: you write "hints" to the build system and then, hopefully, right thing will happen at the right time. It's also full of defaults and conventions, so many details are implicit. You have to know them to guess what will happen, but you can't google them, because there's no code.

Make

We tried Make but I was unable to…
https://www.facebook.com/nikitonsky
Read full article