Revert "Revert "Add __ANDROID_APEX_<NAME>__ for apex variants""

This reverts commit 12f629b26d.

Bug: 142582178
Test: m (soong test added)
This commit is contained in:
Jooyung Han
2019-10-18 16:26:16 +09:00
parent 31c470b5d5
commit 7798857a0d
2 changed files with 14 additions and 0 deletions

View File

@@ -320,7 +320,9 @@ 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_"+makeDefineString(ctx.apexName())+"__")
}
instructionSet := String(compiler.Properties.Instruction_set)
@@ -528,6 +530,12 @@ func (compiler *baseCompiler) hasSrcExt(ext string) bool {
return false
}
// makeDefineString transforms a name of an APEX module into a value to be used as value for C define
// For example, com.android.foo => COM_ANDROID_FOO
func makeDefineString(name string) string {
return strings.ReplaceAll(strings.ToUpper(name), ".", "_")
}
var gnuToCReplacer = strings.NewReplacer("gnu", "c")
func ndkPathDeps(ctx ModuleContext) android.Paths {