Build System top-level wrapper functions versus digging into 'guts'

Not a big thing to fix and build system API changes are expected, but the general direction is bugging me for a while already:

Convenience functions on top-level build system components are removed in favour of accessing low level functions on nested items (which feels like poking around in what should be private implementation details).

In my specific case I need to check in the build script for 3 things:

  • is the target platform ‘the web’ (e.g. via Target.isWasm()
  • is the target a macOS/iOS flavour (e.g. Target.isDarwin()
  • is the target Android (e.g. Target.isAndroid()

Previously it was fairly easy to find this functionality since they were all in one place.

Now those three things are in different places and sometimes it’s hard to guess the right place:

  • isWasm is on Target.cpu.arch
  • isDarwin is on Target.os.tag
  • isAndroid is on Target.abi

…I would have expected isAndroid to be on Target.os.tag btw… but this doesn’t seem to have an Android flavour.

Ideally I probably wouldn’t want to have such ‘helper methods’ on Target either… instead I’d like to ask the ‘build system’ those high level question (am I compiling for WASM, Apple platforms or Android).

E.g. long story short: I feel like the build system API requires access to what feels like internal implementation details, and this trend is getting bigger instead of smaller :slight_smile:

6 Likes