Hacker News new | ask | show | jobs
by jpgvm 1011 days ago
I wish Jetbrains and Google could work towards replacing Gradle for Android with Bazel. This would mean much more alignment in Android Studio/Jetbrains IDEs and ASOP itself is built with Bazel these days so eventually having both ASOP and app projects built with the same build system could yield benefits also.
1 comments

What’s the problem with Gradle? It is one of the few extensible, cross-language build systems that actually has most necessary features for the task, and is correct.

Android just has some absolutely mindblowingly insane dependency graph and long-running steps in their build process, making even gradle sweat buckets. Without a significant re-architecture, Bazel wouldn’t fair any better, while a significant re-architecture could just as well help Gradle.

The problem isn't Gradle itself which I am a huge fan of but more so the existing legacy Android plugins which have either stagnated or slowly degraded.

Moving to Bazel would be good for aligning everything. As previously mentioned ASOP is built with Bazel, Bazel already has great support for building Android apps (and works much better with NDK: https://bazel.build/docs/android-ndk).

Gradle while I do like it I have come to realise is a drastically more complicated (and magic) build system than Bazel. I say this as someone that can do "anything" in Gradle by either developing custom plugins or dropping hacks into buildSrc.

I think part of the reason why Android builds don't get better is people don't want to even try deal with Gradle because of the comprehensibility cliff, i.e there is too much distance between "I can copy and paste and it works" and "I actually understood what I copied and pasted".

It's hard to say exactly what the key problems are with comprehension are but despite years of trying to help others understand Gradle I gave up and just handled all the build issues myself.

Bazel has been a lot easier on the uptake, it's not perfect and still takes a bunch of upfront "you need to understand the difference between rules, repository rules, macros etc" but there is less fundamental topics to cover and less magic if you aren't using external rulesets.

Thanks for the comment, I am also baffled why people have so much trouble understanding gradle’s model.

I am not that well versed in bazel, but doesn’t it sorta require a monorepo like structure?