Bp2Build common properties auto-handling
Introduce `commonAttributes` & `fillCommonBp2BuildModuleAttrs used in
CreateBazelTargetModule
Adapt `bp2BuildInfo` to use `commonAttrs` instead of `Name`.
And thus also all downstream users of `CreateBazelTargetModule`.
As initial user, the Soong `required` property will be
translated to Bazel's `data`.
Bug: 198146582, 196091467
Test: build_converstion_test.go:TestCommonBp2BuildModuleAttrs
Test: go test
Test: mixed_{libc,droid}.sh
Change-Id: Ib500e40f7e2cb48c459f1ebe3188962fc41ec124
diff --git a/cc/library.go b/cc/library.go
index de9d01e..b181a16 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -345,7 +345,7 @@
Bzl_load_location: "//build/bazel/rules:full_cc_library.bzl",
}
- ctx.CreateBazelTargetModule(m.Name(), props, attrs)
+ ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: m.Name()}, attrs)
}
// cc_library creates both static and/or shared libraries for a device and/or
@@ -2434,7 +2434,7 @@
Bzl_load_location: fmt.Sprintf("//build/bazel/rules:%s.bzl", modType),
}
- ctx.CreateBazelTargetModule(module.Name(), props, attrs)
+ ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: module.Name()}, attrs)
}
// TODO(b/199902614): Can this be factored to share with the other Attributes?
diff --git a/cc/library_headers.go b/cc/library_headers.go
index cabeb01..51c1eb8 100644
--- a/cc/library_headers.go
+++ b/cc/library_headers.go
@@ -147,5 +147,5 @@
Bzl_load_location: "//build/bazel/rules:cc_library_headers.bzl",
}
- ctx.CreateBazelTargetModule(module.Name(), props, attrs)
+ ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: module.Name()}, attrs)
}
diff --git a/cc/object.go b/cc/object.go
index 4ec2b19..d8bb08f 100644
--- a/cc/object.go
+++ b/cc/object.go
@@ -206,7 +206,7 @@
Bzl_load_location: "//build/bazel/rules:cc_object.bzl",
}
- ctx.CreateBazelTargetModule(m.Name(), props, attrs)
+ ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: m.Name()}, attrs)
}
func (object *objectLinker) appendLdflags(flags []string) {