Make the cflags property configurable
So that you can use select statements on it. The current modivation is to convert a module from make to bp with minimal soong config variable boilerplate. Bug: 342006386 Bug: 346922064 Test: m nothing --no-skip-soong-tests Change-Id: I48d5a11ad3aa65c24cc199458634a5fdbeab2f64
This commit is contained in:
@@ -50,7 +50,7 @@ type BaseCompilerProperties struct {
|
||||
Exclude_srcs []string `android:"path,arch_variant"`
|
||||
|
||||
// list of module-specific flags that will be used for C and C++ compiles.
|
||||
Cflags []string `android:"arch_variant"`
|
||||
Cflags proptools.Configurable[[]string] `android:"arch_variant"`
|
||||
|
||||
// list of module-specific flags that will be used for C++ compiles
|
||||
Cppflags []string `android:"arch_variant"`
|
||||
@@ -274,7 +274,7 @@ func (compiler *baseCompiler) Srcs() android.Paths {
|
||||
}
|
||||
|
||||
func (compiler *baseCompiler) appendCflags(flags []string) {
|
||||
compiler.Properties.Cflags = append(compiler.Properties.Cflags, flags...)
|
||||
compiler.Properties.Cflags.AppendSimpleValue(flags)
|
||||
}
|
||||
|
||||
func (compiler *baseCompiler) appendAsflags(flags []string) {
|
||||
@@ -372,7 +372,8 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
|
||||
compiler.srcsBeforeGen = android.PathsForModuleSrcExcludes(ctx, compiler.Properties.Srcs, compiler.Properties.Exclude_srcs)
|
||||
compiler.srcsBeforeGen = append(compiler.srcsBeforeGen, deps.GeneratedSources...)
|
||||
|
||||
CheckBadCompilerFlags(ctx, "cflags", compiler.Properties.Cflags)
|
||||
cflags := compiler.Properties.Cflags.GetOrDefault(ctx, nil)
|
||||
CheckBadCompilerFlags(ctx, "cflags", cflags)
|
||||
CheckBadCompilerFlags(ctx, "cppflags", compiler.Properties.Cppflags)
|
||||
CheckBadCompilerFlags(ctx, "conlyflags", compiler.Properties.Conlyflags)
|
||||
CheckBadCompilerFlags(ctx, "asflags", compiler.Properties.Asflags)
|
||||
@@ -385,7 +386,7 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
|
||||
|
||||
esc := proptools.NinjaAndShellEscapeList
|
||||
|
||||
flags.Local.CFlags = append(flags.Local.CFlags, esc(compiler.Properties.Cflags)...)
|
||||
flags.Local.CFlags = append(flags.Local.CFlags, esc(cflags)...)
|
||||
flags.Local.CppFlags = append(flags.Local.CppFlags, esc(compiler.Properties.Cppflags)...)
|
||||
flags.Local.ConlyFlags = append(flags.Local.ConlyFlags, esc(compiler.Properties.Conlyflags)...)
|
||||
flags.Local.AsFlags = append(flags.Local.AsFlags, esc(compiler.Properties.Asflags)...)
|
||||
@@ -819,7 +820,7 @@ type RustBindgenClangProperties struct {
|
||||
Header_libs []string `android:"arch_variant,variant_prepend"`
|
||||
|
||||
// list of clang flags required to correctly interpret the headers.
|
||||
Cflags []string `android:"arch_variant"`
|
||||
Cflags proptools.Configurable[[]string] `android:"arch_variant"`
|
||||
|
||||
// list of c++ specific clang flags required to correctly interpret the headers.
|
||||
// This is provided primarily to make sure cppflags defined in cc_defaults are pulled in.
|
||||
|
Reference in New Issue
Block a user