apex: __ANDROID_APEX__ defined with no value
__ANDROID_APEX__ was defined with the name of apex module. -D__ANDROID_APEX__=com.android.foo But in this way, conditional compilation is not easy since comparing macro's string value is not supported in C/C++. (There's no usages of this value in source tree.) In most cases, modules can check if __ANDROID_APEX__ is defined to see if they are compiled for apex. For modules which should behave differently according to which apex they are included, they can check __ANDROID_APEX_<NAME>__. Bug: 142582178 Test: m (soong tests run) && boot device && TH Change-Id: I0f5e3e9463ccd96cbba333a8bdd648470c5c912d
This commit is contained in:
@@ -320,8 +320,7 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
|
||||
}
|
||||
|
||||
if ctx.apexName() != "" {
|
||||
// TODO(b/142582178): remove the value for __ANDROID_APEX__
|
||||
flags.GlobalFlags = append(flags.GlobalFlags, "-D__ANDROID_APEX__="+ctx.apexName())
|
||||
flags.GlobalFlags = append(flags.GlobalFlags, "-D__ANDROID_APEX__")
|
||||
flags.GlobalFlags = append(flags.GlobalFlags, "-D__ANDROID_APEX_"+makeDefineString(ctx.apexName())+"__")
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user