Expand handling of unconverted deps in bp2build
Support three options for converting modules with unconverted
dependencies
1. (default) Warn when converting a module if it has unconverted deps.
2. Error when encountering a module with unconverted deps. (not hooked
up yet)
Test: build/bazel/ci/bp2build.sh
Test: build/bazel/ci/mixed_libc.sh
Test: BP2BUILD_ERROR_UNCONVERTED=1 build/bazel/ci/bp2build.sh with
unconverted deps -- get appropriate error
Bug: 181155349
Change-Id: Ifaabf0cd2e43e963366dc137159c705294165c3d
diff --git a/android/module.go b/android/module.go
index dd6a25a..9532cbc 100644
--- a/android/module.go
+++ b/android/module.go
@@ -316,6 +316,9 @@
AddMissingDependencies(missingDeps []string)
+ // AddUnconvertedBp2buildDep stores module name of a direct dependency that was not converted via bp2build
+ AddUnconvertedBp2buildDep(dep string)
+
Target() Target
TargetPrimary() bool
@@ -496,6 +499,7 @@
IsConvertedByBp2build() bool
// Bp2buildTargets returns the target(s) generated for Bazel via bp2build for this module
Bp2buildTargets() []bp2buildInfo
+ GetUnconvertedBp2buildDeps() []string
BuildParamsForTests() []BuildParams
RuleParamsForTests() map[blueprint.Rule]blueprint.RuleParams
@@ -833,6 +837,10 @@
// supported as Soong handles some things within a single target that we may choose to split into
// multiple targets, e.g. renderscript, protos, yacc within a cc module.
Bp2buildInfo []bp2buildInfo `blueprint:"mutated"`
+
+ // UnconvertedBp2buildDep stores the module names of direct dependency that were not converted to
+ // Bazel
+ UnconvertedBp2buildDeps []string `blueprint:"mutated"`
}
type distProperties struct {
@@ -1212,6 +1220,18 @@
return m.commonProperties.Bp2buildInfo
}
+// AddUnconvertedBp2buildDep stores module name of a dependency that was not converted to Bazel.
+func (b *baseModuleContext) AddUnconvertedBp2buildDep(dep string) {
+ unconvertedDeps := &b.Module().base().commonProperties.UnconvertedBp2buildDeps
+ *unconvertedDeps = append(*unconvertedDeps, dep)
+}
+
+// GetUnconvertedBp2buildDeps returns the list of module names of this module's direct dependencies that
+// were not converted to Bazel.
+func (m *ModuleBase) GetUnconvertedBp2buildDeps() []string {
+ return m.commonProperties.UnconvertedBp2buildDeps
+}
+
func (m *ModuleBase) AddJSONData(d *map[string]interface{}) {
(*d)["Android"] = map[string]interface{}{}
}