Adding a flag in Android.bp

1,460 views
Skip to first unread message

Minseong Kim

unread,
Aug 2, 2017, 5:11:06 PM8/2/17
to Android Building
Hi~

It is quite difficult to find information about handling Android.bp files.

Does anyone know how to add an additional Boolean flag to a module in a local Android.bp (e.g. bionic/libdl/Android.bp) and this newly added flag can be examined true/false when being parsed (e.g. at TransformSourceToObj function in build/soong/cc/builder.go where local flags from Android.bp files are parsed and constructed) ?

Your time and help is greatly appreciated in advance. 

cheers,
Min



Colin Cross

unread,
Aug 2, 2017, 5:18:59 PM8/2/17
to android-...@googlegroups.com
Can you describe more about the flag you are trying to add? It would
probably go in BaseCompilerProperties in build/soong/cc/compiler.go,
then be parsed in baseCompiler.compilerFlags into a something that is
passed to the compiler in TransformSourceToObj.
> --
> --
> You received this message because you are subscribed to the "Android
> Building" mailing list.
> To post to this group, send email to android-...@googlegroups.com
> To unsubscribe from this group, send email to
> android-buildi...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-building?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Android Building" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to android-buildi...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Minseong Kim

unread,
Aug 3, 2017, 11:42:27 AM8/3/17
to Android Building
Hi Colin,

Thanks for your time.

For example, I want to add a flag (local_flag) like the following in the bionic/libdl/Android.bp:

And when the module's flags are being parsed (for example in TransformSourceToObj function or other places where more appropriate), the local_flag can be examined in order to decide whether to add a additional flag or not as the following:
So that the "some compiler flag" can be appended to the cflags iff the module's local_flag is set to true.

Thank you very much for your help ^^

cheers,
Min
Reply all
Reply to author
Forward
0 new messages