I am trying to find a way to write a conditional inside a .bp file.
I found a documentation here: https://android.googlesource.com/platform/build/soong/+/HEAD/README.md
It has a "How do I write conditionals?" part, which points to the art.go: https://android.googlesource.com/platform/art/+/master/build/art.go
Which is hardly an answer to the aforementioned question. It needs a lot more clarification than a simple link.
I have cc_binary in my Android.bp for the module (HAL) I develop.
cc_binary {
name: "name",
init_rc: ["script.rc"],
vintf_fragments: ["fragments.xml"],
relative_install_path: "path",
srcs: ["src1.cpp", "src2.cpp", ...],
shared_libs: ["sh_lib1", "sh_lib2", ...],
tstic_libs: ["lib1", "lib2", ...],
}
I want to add a conditional cflag (-DCONDITIONAL), which will be set to 1 if environmental variable SOME_ENV_VAR is equal to "some_value".
I found a lot of examples of similar *.go files inside AOSP, but they turned out to be of no use for me, because I cannot simply apply practices described there to my case.
I also failed to find any documentation about *.go files, which describes how to do stuff using them. I cannot even find something like "simplest example of usage".
Does anyone know is it even possible what I am trying to do here?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…