soong: allow overriding header files

Includes:

  Author: Jan Altensen <info@stricted.net>
  Date:   Sat Aug 7 19:41:59 2021 +0200

    soong: move header override to compiler.go

     * library.go only covers libraries

    Change-Id: I3374999d6b364dd1bbc2060996964ee7b04493e7

Change-Id: Ia9d2210605c5927b529fbe9485b0e5abd079f487
This commit is contained in:
Jan Altensen 2020-09-10 15:21:40 +02:00 committed by Bartłomiej Rudecki
parent 34e34e8c1d
commit f5c73b4700
Signed by: przekichane
GPG key ID: 751F23C6F014EF76
3 changed files with 16 additions and 0 deletions

View file

@ -1423,6 +1423,10 @@ func (c *deviceConfig) DeviceKernelHeaderDirs() []string {
return c.config.productVariables.DeviceKernelHeaders
}
func (c *deviceConfig) TargetSpecificHeaderPath() string {
return String(c.config.productVariables.TargetSpecificHeaderPath)
}
// JavaCoverageEnabledForPath returns whether Java code coverage is enabled for
// path. Coverage is enabled by default when the product variable
// JavaCoveragePaths is empty. If JavaCoveragePaths is not empty, coverage is

View file

@ -362,6 +362,8 @@ type ProductVariables struct {
DeviceKernelHeaders []string `json:",omitempty"`
TargetSpecificHeaderPath *string `json:",omitempty"`
ExtraVndkVersions []string `json:",omitempty"`
NamespacesToExport []string `json:",omitempty"`

View file

@ -363,6 +363,16 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
tc := ctx.toolchain()
modulePath := ctx.ModuleDir()
additionalIncludeDirs := ctx.DeviceConfig().TargetSpecificHeaderPath()
if len(additionalIncludeDirs) > 0 {
// devices can have multiple paths in TARGET_SPECIFIC_HEADER_PATH
// add -I in front of all of them
if (strings.Contains(additionalIncludeDirs, " ")) {
additionalIncludeDirs = strings.ReplaceAll(additionalIncludeDirs, " ", " -I")
}
flags.Local.CommonFlags = append(flags.Local.CommonFlags, "-I" + additionalIncludeDirs)
}
compiler.srcsBeforeGen = android.PathsForModuleSrcExcludes(ctx, compiler.Properties.Srcs, compiler.Properties.Exclude_srcs)
compiler.srcsBeforeGen = append(compiler.srcsBeforeGen, deps.GeneratedSources...)