Add support for shared_libs in cc_library targets. am: c50fa8dd05
am: b28a33ceca
am: 91200c1649
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1697794 Change-Id: I800f7fdd859a36b01d458e979e563defc6022d87
This commit is contained in:
committed by
Automerger Merge Worker
commit
7d46a4455a
@@ -247,6 +247,7 @@ func bp2BuildParseCompilerProps(ctx android.TopDownMutatorContext, module *Modul
|
||||
// Convenience struct to hold all attributes parsed from linker properties.
|
||||
type linkerAttributes struct {
|
||||
deps bazel.LabelListAttribute
|
||||
dynamicDeps bazel.LabelListAttribute
|
||||
linkopts bazel.StringListAttribute
|
||||
versionScript bazel.LabelAttribute
|
||||
}
|
||||
@@ -255,6 +256,7 @@ type linkerAttributes struct {
|
||||
// configurable attribute values.
|
||||
func bp2BuildParseLinkerProps(ctx android.TopDownMutatorContext, module *Module) linkerAttributes {
|
||||
var deps bazel.LabelListAttribute
|
||||
var dynamicDeps bazel.LabelListAttribute
|
||||
var linkopts bazel.StringListAttribute
|
||||
var versionScript bazel.LabelAttribute
|
||||
|
||||
@@ -266,11 +268,16 @@ func bp2BuildParseLinkerProps(ctx android.TopDownMutatorContext, module *Module)
|
||||
libs = append(libs, baseLinkerProps.Whole_static_libs...)
|
||||
libs = android.SortedUniqueStrings(libs)
|
||||
deps = bazel.MakeLabelListAttribute(android.BazelLabelForModuleDeps(ctx, libs))
|
||||
|
||||
linkopts.Value = baseLinkerProps.Ldflags
|
||||
|
||||
if baseLinkerProps.Version_script != nil {
|
||||
versionScript.Value = android.BazelLabelForModuleSrcSingle(ctx, *baseLinkerProps.Version_script)
|
||||
}
|
||||
|
||||
sharedLibs := baseLinkerProps.Shared_libs
|
||||
dynamicDeps = bazel.MakeLabelListAttribute(android.BazelLabelForModuleDeps(ctx, sharedLibs))
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -283,10 +290,15 @@ func bp2BuildParseLinkerProps(ctx android.TopDownMutatorContext, module *Module)
|
||||
libs = append(libs, baseLinkerProps.Whole_static_libs...)
|
||||
libs = android.SortedUniqueStrings(libs)
|
||||
deps.SetValueForArch(arch.Name, android.BazelLabelForModuleDeps(ctx, libs))
|
||||
|
||||
linkopts.SetValueForArch(arch.Name, baseLinkerProps.Ldflags)
|
||||
|
||||
if baseLinkerProps.Version_script != nil {
|
||||
versionScript.SetValueForArch(arch.Name,
|
||||
android.BazelLabelForModuleSrcSingle(ctx, *baseLinkerProps.Version_script))
|
||||
|
||||
sharedLibs := baseLinkerProps.Shared_libs
|
||||
dynamicDeps.SetValueForArch(arch.Name, android.BazelLabelForModuleDeps(ctx, sharedLibs))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -299,12 +311,17 @@ func bp2BuildParseLinkerProps(ctx android.TopDownMutatorContext, module *Module)
|
||||
libs = append(libs, baseLinkerProps.Whole_static_libs...)
|
||||
libs = android.SortedUniqueStrings(libs)
|
||||
deps.SetValueForOS(os.Name, android.BazelLabelForModuleDeps(ctx, libs))
|
||||
|
||||
linkopts.SetValueForOS(os.Name, baseLinkerProps.Ldflags)
|
||||
|
||||
sharedLibs := baseLinkerProps.Shared_libs
|
||||
dynamicDeps.SetValueForOS(os.Name, android.BazelLabelForModuleDeps(ctx, sharedLibs))
|
||||
}
|
||||
}
|
||||
|
||||
return linkerAttributes{
|
||||
deps: deps,
|
||||
dynamicDeps: dynamicDeps,
|
||||
linkopts: linkopts,
|
||||
versionScript: versionScript,
|
||||
}
|
||||
|
@@ -225,6 +225,7 @@ type bazelCcLibraryAttributes struct {
|
||||
Copts bazel.StringListAttribute
|
||||
Linkopts bazel.StringListAttribute
|
||||
Deps bazel.LabelListAttribute
|
||||
Dynamic_deps bazel.LabelListAttribute
|
||||
User_link_flags bazel.StringListAttribute
|
||||
Includes bazel.StringListAttribute
|
||||
Static_deps_for_shared bazel.LabelListAttribute
|
||||
@@ -282,6 +283,7 @@ func CcLibraryBp2Build(ctx android.TopDownMutatorContext) {
|
||||
Copts: compilerAttrs.copts,
|
||||
Linkopts: linkerAttrs.linkopts,
|
||||
Deps: linkerAttrs.deps,
|
||||
Dynamic_deps: linkerAttrs.dynamicDeps,
|
||||
Version_script: linkerAttrs.versionScript,
|
||||
Static_deps_for_shared: sharedAttrs.staticDeps,
|
||||
Includes: exportedIncludes,
|
||||
|
Reference in New Issue
Block a user