PSA: FIDL HLCPP Bindings are now behind an allowlist

7 views
Skip to first unread message

Ian McKellar

unread,
Jan 18, 2023, 7:49:16 PM1/18/23
to fidl-dev
tl;dr: new code written against old bindings won't build

The new FIDL C++ bindings are now generally available in the SDK. It's time to stop using the old HLCPP bindings, or at least time to stop starting to use the old HLCPP bindings.

We believe that the new bindings are better than the old ones but understand that teams will balance tech debt cleanup work like migrating existing code to the new bindings with the need to fix bugs and implement features. But let's not back-slide.

Allowlists

There are two independent allowlist mechanisms for HLCPP, one that controls which FIDL libraries have HLCPP bindings generated for them and one for which C++ code can use those HLCPP bindings.

Like we have done for Banjo and C bindings there's now an enable_hlcpp variable that must be set in FIDL target definitions to enable generation of HLCPP bindings. This is pretty straight-forward and self-evident. You can't use a FIDL library with HLCPP unless that library (and its dependencies) have enable_hlcpp=true.

There's also a GN visibility based allowlist (in //build/cpp/hlcpp_visibility.gni) that determines which targets are allowed to depend on HLCPP bindings. Targets (eg: executable or source_set) aren't able to depend on HLCPP bindings unless they appear in that list.

Living With Allowlists

If you're reorganizing the source tree by moving existing code around, please update the allowlists, guilt free.

All new C++ components should be written using the new C++ bindings. They're really rather nice. The only reason not to do this is if the new component (including a test) shares a lot of code with an existing component that uses HLCPP. In this case you should consider porting the existing component and shared code over to the new bindings, but we recognize that sometimes this won't be possible.

Please don't add enable_hlcpp=true to new or existing FIDL libraries unless an existing component that uses HLCPP needs to start using the library. Once again, this might be a good time to look at updating that component to use the new C++ bindings.

Thanks,

Ian & the FIDL team

Tamir Duberstein

unread,
Jan 18, 2023, 7:50:51 PM1/18/23
to Ian McKellar, fidl-dev
🤘

Seth Ladd

unread,
Jan 18, 2023, 11:43:46 PM1/18/23
to Tamir Duberstein, Ian McKellar, fidl-dev
Thank you for expanding and improving our SDK!

--
All posts must follow the Fuchsia Code of Conduct https://fuchsia.dev/fuchsia-src/CODE_OF_CONDUCT or may be removed.
---
You received this message because you are subscribed to the Google Groups "fidl-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fidl-dev+u...@fuchsia.dev.
To view this discussion on the web visit https://groups.google.com/a/fuchsia.dev/d/msgid/fidl-dev/CAK-_uh4ZyBpBaA7%3DY2n-3zYobutgLHVKcuW99cX1sTMN_1_qvQ%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages