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:
parent
5602d33025
commit
560cb6685c
@@ -13,19 +13,24 @@ type PythonLibBp2Build func(ctx android.TopDownMutatorContext)
|
||||
|
||||
func TestPythonLibrary(t *testing.T) {
|
||||
testPythonLib(t, "python_library",
|
||||
python.PythonLibraryFactory, python.PythonLibraryBp2Build)
|
||||
python.PythonLibraryFactory, python.PythonLibraryBp2Build,
|
||||
func(ctx android.RegistrationContext) {})
|
||||
}
|
||||
|
||||
func TestPythonLibraryHost(t *testing.T) {
|
||||
testPythonLib(t, "python_library_host",
|
||||
python.PythonLibraryHostFactory, python.PythonLibraryHostBp2Build)
|
||||
python.PythonLibraryHostFactory, python.PythonLibraryHostBp2Build,
|
||||
func(ctx android.RegistrationContext) {
|
||||
ctx.RegisterModuleType("python_library", python.PythonLibraryFactory)
|
||||
})
|
||||
}
|
||||
|
||||
func testPythonLib(t *testing.T, modType string,
|
||||
factory android.ModuleFactory, mutator PythonLibBp2Build) {
|
||||
factory android.ModuleFactory, mutator PythonLibBp2Build,
|
||||
registration func(ctx android.RegistrationContext)) {
|
||||
t.Helper()
|
||||
// Simple
|
||||
runBp2BuildTestCaseSimple(t, bp2buildTestCase{
|
||||
runBp2BuildTestCase(t, registration, bp2buildTestCase{
|
||||
description: fmt.Sprintf("simple %s converts to a native py_library", modType),
|
||||
moduleTypeUnderTest: modType,
|
||||
moduleTypeUnderTestFactory: factory,
|
||||
@@ -42,11 +47,18 @@ func testPythonLib(t *testing.T, modType string,
|
||||
srcs: ["**/*.py"],
|
||||
exclude_srcs: ["b/e.py"],
|
||||
data: ["files/data.txt",],
|
||||
libs: ["bar"],
|
||||
bazel_module: { bp2build_available: true },
|
||||
}`, modType),
|
||||
}
|
||||
python_library {
|
||||
name: "bar",
|
||||
srcs: ["b/e.py"],
|
||||
bazel_module: { bp2build_available: false },
|
||||
}`, modType),
|
||||
expectedBazelTargets: []string{`py_library(
|
||||
name = "foo",
|
||||
data = ["files/data.txt"],
|
||||
deps = [":bar"],
|
||||
srcs = [
|
||||
"a.py",
|
||||
"b/c.py",
|
||||
|
Reference in New Issue
Block a user