Merge "Handle the version_script property." am: dac1db044b am: 8e9c7d9212 am: 30b77b329e

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1690878

Change-Id: Ie1f640f7e1be2f99bdd9b1a7ae9aa6c472e16559
This commit is contained in:
Lukács T. Berki
2021-04-30 15:14:32 +00:00
committed by Automerger Merge Worker
7 changed files with 62 additions and 9 deletions

View File

@@ -246,15 +246,17 @@ func bp2BuildParseCompilerProps(ctx android.TopDownMutatorContext, module *Modul
// Convenience struct to hold all attributes parsed from linker properties.
type linkerAttributes struct {
deps bazel.LabelListAttribute
linkopts bazel.StringListAttribute
deps bazel.LabelListAttribute
linkopts bazel.StringListAttribute
versionScript bazel.LabelAttribute
}
// bp2BuildParseLinkerProps creates a label list attribute containing the header library deps of a module, including
// bp2BuildParseLinkerProps parses the linker properties of a module, including
// configurable attribute values.
func bp2BuildParseLinkerProps(ctx android.TopDownMutatorContext, module *Module) linkerAttributes {
var deps bazel.LabelListAttribute
var linkopts bazel.StringListAttribute
var versionScript bazel.LabelAttribute
for _, linkerProps := range module.linker.linkerProps() {
if baseLinkerProps, ok := linkerProps.(*BaseLinkerProperties); ok {
@@ -265,6 +267,12 @@ func bp2BuildParseLinkerProps(ctx android.TopDownMutatorContext, module *Module)
libs = android.SortedUniqueStrings(libs)
deps = bazel.MakeLabelListAttribute(android.BazelLabelForModuleDeps(ctx, libs))
linkopts.Value = baseLinkerProps.Ldflags
if baseLinkerProps.Version_script != nil {
versionScript = bazel.LabelAttribute{
Value: android.BazelLabelForModuleSrcSingle(ctx, *baseLinkerProps.Version_script),
}
}
break
}
}
@@ -294,8 +302,9 @@ func bp2BuildParseLinkerProps(ctx android.TopDownMutatorContext, module *Module)
}
return linkerAttributes{
deps: deps,
linkopts: linkopts,
deps: deps,
linkopts: linkopts,
versionScript: versionScript,
}
}

View File

@@ -228,6 +228,7 @@ type bazelCcLibraryAttributes struct {
User_link_flags bazel.StringListAttribute
Includes bazel.StringListAttribute
Static_deps_for_shared bazel.LabelListAttribute
Version_script bazel.LabelAttribute
}
type bazelCcLibrary struct {
@@ -273,6 +274,7 @@ func CcLibraryBp2Build(ctx android.TopDownMutatorContext) {
Copts: compilerAttrs.copts,
Linkopts: linkerAttrs.linkopts,
Deps: linkerAttrs.deps,
Version_script: linkerAttrs.versionScript,
Static_deps_for_shared: sharedAttrs.staticDeps,
Includes: exportedIncludes,
}