bp2build: remove header globs in generated srcs.
Not needed anymore for bp2build-incremental since https://android-review.googlesource.com/q/topic:no-include-check. Not needed for mixed builds either, since cc compile actions aren't sandboxed. Fixes: 186488830 Test: treehugger and go tests Change-Id: Ib5d4908dcce6bf910a653c457bb251d726e717d4
This commit is contained in:
@@ -80,7 +80,7 @@ type compilerAttributes struct {
|
||||
|
||||
// bp2BuildParseCompilerProps returns copts, srcs and hdrs and other attributes.
|
||||
func bp2BuildParseCompilerProps(ctx android.TopDownMutatorContext, module *Module) compilerAttributes {
|
||||
var localHdrs, srcs bazel.LabelListAttribute
|
||||
var srcs bazel.LabelListAttribute
|
||||
var copts bazel.StringListAttribute
|
||||
|
||||
// Creates the -I flag for a directory, while making the directory relative
|
||||
@@ -121,10 +121,8 @@ func bp2BuildParseCompilerProps(ctx android.TopDownMutatorContext, module *Modul
|
||||
|
||||
if c, ok := module.compiler.(*baseCompiler); ok && c.includeBuildDirectory() {
|
||||
copts.Value = append(copts.Value, includeFlag("."))
|
||||
localHdrs.Value = bp2BuildListHeadersInDir(ctx, ".")
|
||||
} else if c, ok := module.compiler.(*libraryDecorator); ok && c.includeBuildDirectory() {
|
||||
copts.Value = append(copts.Value, includeFlag("."))
|
||||
localHdrs.Value = bp2BuildListHeadersInDir(ctx, ".")
|
||||
}
|
||||
|
||||
for arch, props := range module.GetArchProperties(&BaseCompilerProperties{}) {
|
||||
@@ -143,9 +141,6 @@ func bp2BuildParseCompilerProps(ctx android.TopDownMutatorContext, module *Modul
|
||||
}
|
||||
}
|
||||
|
||||
// Combine local, non-exported hdrs into srcs
|
||||
srcs.Append(localHdrs)
|
||||
|
||||
return compilerAttributes{
|
||||
srcs: srcs,
|
||||
copts: copts,
|
||||
@@ -207,11 +202,6 @@ func bp2BuildParseLinkerProps(ctx android.TopDownMutatorContext, module *Module)
|
||||
}
|
||||
}
|
||||
|
||||
func bp2BuildListHeadersInDir(ctx android.TopDownMutatorContext, includeDir string) bazel.LabelList {
|
||||
globs := bazel.GlobsInDir(includeDir, true, headerExts)
|
||||
return android.BazelLabelForModuleSrc(ctx, globs)
|
||||
}
|
||||
|
||||
// Relativize a list of root-relative paths with respect to the module's
|
||||
// directory.
|
||||
//
|
||||
@@ -236,9 +226,8 @@ func bp2BuildMakePathsRelativeToModule(ctx android.BazelConversionPathContext, p
|
||||
}
|
||||
|
||||
// bp2BuildParseExportedIncludes creates a string list attribute contains the
|
||||
// exported included directories of a module, and a label list attribute
|
||||
// containing the exported headers of a module.
|
||||
func bp2BuildParseExportedIncludes(ctx android.TopDownMutatorContext, module *Module) (bazel.StringListAttribute, bazel.LabelListAttribute) {
|
||||
// exported included directories of a module.
|
||||
func bp2BuildParseExportedIncludes(ctx android.TopDownMutatorContext, module *Module) bazel.StringListAttribute {
|
||||
libraryDecorator := module.linker.(*libraryDecorator)
|
||||
|
||||
// Export_system_include_dirs and export_include_dirs are already module dir
|
||||
@@ -248,14 +237,6 @@ func bp2BuildParseExportedIncludes(ctx android.TopDownMutatorContext, module *Mo
|
||||
includeDirs = append(includeDirs, libraryDecorator.flagExporter.Properties.Export_include_dirs...)
|
||||
includeDirsAttribute := bazel.MakeStringListAttribute(includeDirs)
|
||||
|
||||
var headersAttribute bazel.LabelListAttribute
|
||||
var headers bazel.LabelList
|
||||
for _, includeDir := range includeDirs {
|
||||
headers.Append(bp2BuildListHeadersInDir(ctx, includeDir))
|
||||
}
|
||||
headers = bazel.UniqueBazelLabelList(headers)
|
||||
headersAttribute.Value = headers
|
||||
|
||||
for arch, props := range module.GetArchProperties(&FlagExporterProperties{}) {
|
||||
if flagExporterProperties, ok := props.(*FlagExporterProperties); ok {
|
||||
archIncludeDirs := flagExporterProperties.Export_system_include_dirs
|
||||
@@ -268,20 +249,6 @@ func bp2BuildParseExportedIncludes(ctx android.TopDownMutatorContext, module *Mo
|
||||
if len(archIncludeDirs) > 0 {
|
||||
includeDirsAttribute.SetValueForArch(arch.Name, archIncludeDirs)
|
||||
}
|
||||
|
||||
var archHeaders bazel.LabelList
|
||||
for _, archIncludeDir := range archIncludeDirs {
|
||||
archHeaders.Append(bp2BuildListHeadersInDir(ctx, archIncludeDir))
|
||||
}
|
||||
archHeaders = bazel.UniqueBazelLabelList(archHeaders)
|
||||
|
||||
// To avoid duplicate headers when base headers + arch headers are combined
|
||||
// FIXME: This doesn't take conflicts between arch and os includes into account
|
||||
archHeaders = bazel.SubtractBazelLabelList(archHeaders, headers)
|
||||
|
||||
if len(archHeaders.Includes) > 0 || len(archHeaders.Excludes) > 0 {
|
||||
headersAttribute.SetValueForArch(arch.Name, archHeaders)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,22 +264,8 @@ func bp2BuildParseExportedIncludes(ctx android.TopDownMutatorContext, module *Mo
|
||||
if len(osIncludeDirs) > 0 {
|
||||
includeDirsAttribute.SetValueForOS(os.Name, osIncludeDirs)
|
||||
}
|
||||
|
||||
var osHeaders bazel.LabelList
|
||||
for _, osIncludeDir := range osIncludeDirs {
|
||||
osHeaders.Append(bp2BuildListHeadersInDir(ctx, osIncludeDir))
|
||||
}
|
||||
osHeaders = bazel.UniqueBazelLabelList(osHeaders)
|
||||
|
||||
// To avoid duplicate headers when base headers + os headers are combined
|
||||
// FIXME: This doesn't take conflicts between arch and os includes into account
|
||||
osHeaders = bazel.SubtractBazelLabelList(osHeaders, headers)
|
||||
|
||||
if len(osHeaders.Includes) > 0 || len(osHeaders.Excludes) > 0 {
|
||||
headersAttribute.SetValueForOS(os.Name, osHeaders)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return includeDirsAttribute, headersAttribute
|
||||
return includeDirsAttribute
|
||||
}
|
||||
|
Reference in New Issue
Block a user