Merge "Gen a header library when genrules export includes" into main
This commit is contained in:
@@ -22,6 +22,7 @@ import (
|
||||
"android/soong/android"
|
||||
"android/soong/bazel"
|
||||
"android/soong/cc/config"
|
||||
"android/soong/genrule"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
|
||||
@@ -45,6 +46,8 @@ const (
|
||||
|
||||
xsdSrcPartition = "xsd"
|
||||
|
||||
genrulePartition = "genrule"
|
||||
|
||||
hdrPartition = "hdr"
|
||||
|
||||
stubsSuffix = "_stub_libs_current"
|
||||
@@ -172,8 +175,9 @@ func groupSrcsByExtension(ctx android.BazelConversionPathContext, srcs bazel.Lab
|
||||
|
||||
func partitionHeaders(ctx android.BazelConversionPathContext, hdrs bazel.LabelListAttribute) bazel.PartitionToLabelListAttribute {
|
||||
labels := bazel.LabelPartitions{
|
||||
xsdSrcPartition: bazel.LabelPartition{LabelMapper: android.XsdLabelMapper(xsdConfigCppTarget)},
|
||||
hdrPartition: bazel.LabelPartition{Keep_remainder: true},
|
||||
xsdSrcPartition: bazel.LabelPartition{LabelMapper: android.XsdLabelMapper(xsdConfigCppTarget)},
|
||||
genrulePartition: bazel.LabelPartition{LabelMapper: genrule.GenruleCcHeaderLabelMapper},
|
||||
hdrPartition: bazel.LabelPartition{Keep_remainder: true},
|
||||
}
|
||||
return bazel.PartitionLabelListAttribute(ctx, &hdrs, labels)
|
||||
}
|
||||
@@ -419,6 +423,10 @@ type compilerAttributes struct {
|
||||
xsdSrcs bazel.LabelListAttribute
|
||||
exportXsdSrcs bazel.LabelListAttribute
|
||||
|
||||
// genrule headers
|
||||
genruleHeaders bazel.LabelListAttribute
|
||||
exportGenruleHeaders bazel.LabelListAttribute
|
||||
|
||||
// Lex sources and options
|
||||
lSrcs bazel.LabelListAttribute
|
||||
llSrcs bazel.LabelListAttribute
|
||||
@@ -606,6 +614,9 @@ func (ca *compilerAttributes) finalize(ctx android.BazelConversionPathContext, i
|
||||
ca.exportXsdSrcs = partitionedHdrs[xsdSrcPartition]
|
||||
ca.xsdSrcs = bazel.FirstUniqueBazelLabelListAttribute(xsdSrcs)
|
||||
|
||||
ca.genruleHeaders = partitionedImplHdrs[genrulePartition]
|
||||
ca.exportGenruleHeaders = partitionedHdrs[genrulePartition]
|
||||
|
||||
ca.srcs = partitionedSrcs[cppSrcPartition]
|
||||
ca.cSrcs = partitionedSrcs[cSrcPartition]
|
||||
ca.asSrcs = partitionedSrcs[asSrcPartition]
|
||||
@@ -900,6 +911,9 @@ func bp2BuildParseBaseProps(ctx android.Bp2buildMutatorContext, module *Module)
|
||||
|
||||
(&compilerAttrs.srcs).Add(bp2BuildYasm(ctx, module, compilerAttrs))
|
||||
|
||||
(&linkerAttrs).deps.Append(compilerAttrs.exportGenruleHeaders)
|
||||
(&linkerAttrs).implementationDeps.Append(compilerAttrs.genruleHeaders)
|
||||
|
||||
(&linkerAttrs).wholeArchiveDeps.Append(compilerAttrs.exportXsdSrcs)
|
||||
(&linkerAttrs).implementationWholeArchiveDeps.Append(compilerAttrs.xsdSrcs)
|
||||
|
||||
|
Reference in New Issue
Block a user