From 151d0aa9508433e30c170235df367fb124affbb6 Mon Sep 17 00:00:00 2001 From: Cole Faust Date: Wed, 6 Nov 2024 10:48:37 -0800 Subject: [PATCH] Make include_dirs and local_include_dirs configurable Requested by a user. Fixes: 377540448 Test: m nothing --no-skip-soong-tests Change-Id: I59e49c68e1d47ee0914677714cedcddf624903e6 --- cc/compiler.go | 10 +++++----- rust/bindgen.go | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cc/compiler.go b/cc/compiler.go index f3e93ec7f..db28f8808 100644 --- a/cc/compiler.go +++ b/cc/compiler.go @@ -78,11 +78,11 @@ type BaseCompilerProperties struct { // If possible, don't use this. If adding paths from the current directory use // local_include_dirs, if adding paths from other modules use export_include_dirs in // that module. - Include_dirs []string `android:"arch_variant,variant_prepend"` + Include_dirs proptools.Configurable[[]string] `android:"arch_variant,variant_prepend"` // list of directories relative to the Blueprints file that will // be added to the include path using -I - Local_include_dirs []string `android:"arch_variant,variant_prepend"` + Local_include_dirs proptools.Configurable[[]string] `android:"arch_variant,variant_prepend"` // Add the directory containing the Android.bp file to the list of include // directories. Defaults to true. @@ -407,13 +407,13 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps } // Include dir cflags - localIncludeDirs := android.PathsForModuleSrc(ctx, compiler.Properties.Local_include_dirs) + localIncludeDirs := android.PathsForModuleSrc(ctx, compiler.Properties.Local_include_dirs.GetOrDefault(ctx, nil)) if len(localIncludeDirs) > 0 { f := includeDirsToFlags(localIncludeDirs) flags.Local.CommonFlags = append(flags.Local.CommonFlags, f) flags.Local.YasmFlags = append(flags.Local.YasmFlags, f) } - rootIncludeDirs := android.PathsForSource(ctx, compiler.Properties.Include_dirs) + rootIncludeDirs := android.PathsForSource(ctx, compiler.Properties.Include_dirs.GetOrDefault(ctx, nil)) if len(rootIncludeDirs) > 0 { f := includeDirsToFlags(rootIncludeDirs) flags.Local.CommonFlags = append(flags.Local.CommonFlags, f) @@ -804,7 +804,7 @@ func compileObjs(ctx ModuleContext, flags builderFlags, subdir string, type RustBindgenClangProperties struct { // list of directories relative to the Blueprints file that will // be added to the include path using -I - Local_include_dirs []string `android:"arch_variant,variant_prepend"` + Local_include_dirs proptools.Configurable[[]string] `android:"arch_variant,variant_prepend"` // list of static libraries that provide headers for this binding. Static_libs proptools.Configurable[[]string] `android:"arch_variant,variant_prepend"` diff --git a/rust/bindgen.go b/rust/bindgen.go index 31aa13725..fc24587d1 100644 --- a/rust/bindgen.go +++ b/rust/bindgen.go @@ -250,7 +250,7 @@ func (b *bindgenDecorator) GenerateSource(ctx ModuleContext, deps PathDeps) andr // Module defined clang flags and include paths cflags = append(cflags, esc(cflagsProp)...) - for _, include := range b.ClangProperties.Local_include_dirs { + for _, include := range b.ClangProperties.Local_include_dirs.GetOrDefault(ctx, nil) { cflags = append(cflags, "-I"+android.PathForModuleSrc(ctx, include).String()) implicits = append(implicits, android.PathForModuleSrc(ctx, include)) }