python_{binary,library}{,_host} handle lib property

Have binary and library bp2build convert `libs` to
`deps` for bazel

Bug: 196083751
Test: python_{binary,library}_conversion_test.go
Test: build/bazel/ci/mixed_{libc,droid}.sh
Change-Id: I2d5f6ef2e83dd608910edb7adb2eb9a56d25293c
This commit is contained in:
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
2021-08-26 20:13:29 +00:00
parent 5602d33025
commit 560cb6685c
5 changed files with 41 additions and 8 deletions

View File

@@ -38,6 +38,7 @@ type bazelPythonBinaryAttributes struct {
Main string
Srcs bazel.LabelListAttribute
Data bazel.LabelListAttribute
Deps bazel.LabelListAttribute
Python_version string
}
@@ -81,11 +82,13 @@ func PythonBinaryBp2Build(ctx android.TopDownMutatorContext) {
srcs := android.BazelLabelForModuleSrcExcludes(ctx, m.properties.Srcs, m.properties.Exclude_srcs)
data := android.BazelLabelForModuleSrc(ctx, m.properties.Data)
deps := android.BazelLabelForModuleDeps(ctx, m.properties.Libs)
attrs := &bazelPythonBinaryAttributes{
Main: main,
Srcs: bazel.MakeLabelListAttribute(srcs),
Data: bazel.MakeLabelListAttribute(data),
Deps: bazel.MakeLabelListAttribute(deps),
Python_version: python_version,
}

View File

@@ -46,6 +46,7 @@ func PythonLibraryHostFactory() android.Module {
type bazelPythonLibraryAttributes struct {
Srcs bazel.LabelListAttribute
Data bazel.LabelListAttribute
Deps bazel.LabelListAttribute
Srcs_version string
}
@@ -89,10 +90,12 @@ func pythonLibBp2Build(ctx android.TopDownMutatorContext, modType string) {
srcs := android.BazelLabelForModuleSrcExcludes(ctx, m.properties.Srcs, m.properties.Exclude_srcs)
data := android.BazelLabelForModuleSrc(ctx, m.properties.Data)
deps := android.BazelLabelForModuleDeps(ctx, m.properties.Libs)
attrs := &bazelPythonLibraryAttributes{
Srcs: bazel.MakeLabelListAttribute(srcs),
Data: bazel.MakeLabelListAttribute(data),
Deps: bazel.MakeLabelListAttribute(deps),
Srcs_version: python_version,
}