Hi,
I have been working with Android O preview source code and have been
studying its new build system, soong.
I’m facing issue regarding conditional compilation of source files inside
different directories based on value of environment variable.
Let’s say Android O-source code has two directories A and B. Each of the
directories contain top level Android.bp inside them. I would like soong to
conditionally compile sources in directory A or B depending up on the value
of an environment variable $ENV_VARIABLE.
ENV_VARIABLE is not specified (null) or contains a string value.
If ENV_VARIABLE is not null, Android.bp file in A should be compiled,
otherwise Android.bp file in B should be compiled.
Currently, both the Android.bp files in A and B are compiled with soong.
So, we need soong to compile Android.bp file in A or B based on the value
of $ENV_VARIABLE.
I tried the below approach :
1. Added My_struct struct { Srcs []string } to varaibleProperties in
build/soong/variable.go
+ My_struct struct{
+ Srcs[]string
+ }
2.+ My_struct *string `json:",omitempty to productVariables in
build/soong/variable.go
3.Passed ENV_VARIABLE to My_struct in build/make/core/soong_config.mk
+ echo ' "My_struct": "$(ENV_VARIABLE)",'
I would like to change Android.bp in directory A in the following way so
that whenever My_struct has a valid string, soong should compile sources
specified in the subdirs field.
+ product_variables: {
+ my_struct: {
+ subdirs =[“../B”],
+ },
+ },
}
But subdirs is not a property in .bp module. Can you please provide help on
how to achieve this?
Thank You.
--
--
You received this message because you are subscribed to the "Android Building"
mailing list.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.