Merge "Clean up some bp2build technical debt"
diff --git a/android/module.go b/android/module.go
index 97a46dd..21d5a3d 100644
--- a/android/module.go
+++ b/android/module.go
@@ -2462,7 +2462,7 @@
bazelConversionMode bool
}
-func (b *baseModuleContext) BazelConversionMode() bool {
+func (b *baseModuleContext) isBazelConversionMode() bool {
return b.bazelConversionMode
}
func (b *baseModuleContext) OtherModuleName(m blueprint.Module) string {
@@ -2851,7 +2851,7 @@
}
func (b *baseModuleContext) ModuleFromName(name string) (blueprint.Module, bool) {
- if !b.BazelConversionMode() {
+ if !b.isBazelConversionMode() {
panic("cannot call ModuleFromName if not in bazel conversion mode")
}
if moduleName, _ := SrcIsModuleWithTag(name); moduleName != "" {
diff --git a/android/mutator.go b/android/mutator.go
index 02a6143..f06ecda 100644
--- a/android/mutator.go
+++ b/android/mutator.go
@@ -232,9 +232,6 @@
// Rename all variants of a module. The new name is not visible to calls to ModuleName,
// AddDependency or OtherModuleName until after this mutator pass is complete.
Rename(name string)
-
- // BazelConversionMode returns whether this mutator is being run as part of Bazel Conversion.
- BazelConversionMode() bool
}
type TopDownMutator func(TopDownMutatorContext)
@@ -626,28 +623,11 @@
func (b *bottomUpMutatorContext) AddVariationDependencies(variations []blueprint.Variation, tag blueprint.DependencyTag,
names ...string) []blueprint.Module {
- if b.bazelConversionMode {
- _, noSelfDeps := RemoveFromList(b.ModuleName(), names)
- if len(noSelfDeps) == 0 {
- return []blueprint.Module(nil)
- }
- // In Bazel conversion mode, mutators should not have created any variants. So, when adding a
- // dependency, the variations would not exist and the dependency could not be added, by
- // specifying no variations, we will allow adding the dependency to succeed.
- return b.bp.AddFarVariationDependencies(nil, tag, noSelfDeps...)
- }
-
return b.bp.AddVariationDependencies(variations, tag, names...)
}
func (b *bottomUpMutatorContext) AddFarVariationDependencies(variations []blueprint.Variation,
tag blueprint.DependencyTag, names ...string) []blueprint.Module {
- if b.bazelConversionMode {
- // In Bazel conversion mode, mutators should not have created any variants. So, when adding a
- // dependency, the variations would not exist and the dependency could not be added, by
- // specifying no variations, we will allow adding the dependency to succeed.
- return b.bp.AddFarVariationDependencies(nil, tag, names...)
- }
return b.bp.AddFarVariationDependencies(variations, tag, names...)
}
diff --git a/cc/binary.go b/cc/binary.go
index 7b5591a..1e9f48c 100644
--- a/cc/binary.go
+++ b/cc/binary.go
@@ -183,7 +183,7 @@
}
}
- if !binary.static() && inList("libc", deps.StaticLibs) && !ctx.BazelConversionMode() {
+ if !binary.static() && inList("libc", deps.StaticLibs) {
ctx.ModuleErrorf("statically linking libc to dynamic executable, please remove libc\n" +
"from static libs or set static_executable: true")
}
diff --git a/cc/cc.go b/cc/cc.go
index 3d21f63..da8a807 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -2059,12 +2059,6 @@
deps.HeaderLibs = android.LastUniqueStrings(deps.HeaderLibs)
deps.RuntimeLibs = android.LastUniqueStrings(deps.RuntimeLibs)
- // In Bazel conversion mode, we dependency and build validations will occur in Bazel, so there is
- // no need to do so in Soong.
- if ctx.BazelConversionMode() {
- return deps
- }
-
for _, lib := range deps.ReexportSharedLibHeaders {
if !inList(lib, deps.SharedLibs) {
ctx.PropertyErrorf("export_shared_lib_headers", "Shared library not in shared_libs: '%s'", lib)
diff --git a/cc/config/toolchain.go b/cc/config/toolchain.go
index 7175fdc..253bb06 100644
--- a/cc/config/toolchain.go
+++ b/cc/config/toolchain.go
@@ -36,19 +36,10 @@
Arch() android.Arch
}
-type conversionContext interface {
- BazelConversionMode() bool
-}
-
func FindToolchainWithContext(ctx toolchainContext) Toolchain {
t, err := findToolchain(ctx.Os(), ctx.Arch())
if err != nil {
- if c, ok := ctx.(conversionContext); ok && c.BazelConversionMode() {
- // TODO(b/179123288): determine conversion for toolchain
- return &toolchainX86_64{}
- } else {
- panic(err)
- }
+ panic(err)
}
return t
}
diff --git a/cc/linker.go b/cc/linker.go
index f346584..4e9404c 100644
--- a/cc/linker.go
+++ b/cc/linker.go
@@ -389,9 +389,7 @@
}
deps.SystemSharedLibs = linker.Properties.System_shared_libs
- // In Bazel conversion mode, variations have not been specified, so SystemSharedLibs may
- // inaccuarately appear unset, which can cause issues with circular dependencies.
- if deps.SystemSharedLibs == nil && !ctx.BazelConversionMode() {
+ if deps.SystemSharedLibs == nil {
// Provide a default system_shared_libs if it is unspecified. Note: If an
// empty list [] is specified, it implies that the module declines the
// default system_shared_libs.
diff --git a/java/java.go b/java/java.go
index 4476cec..511e885 100644
--- a/java/java.go
+++ b/java/java.go
@@ -1247,10 +1247,10 @@
}
func (j *Binary) DepsMutator(ctx android.BottomUpMutatorContext) {
- if ctx.Arch().ArchType == android.Common || ctx.BazelConversionMode() {
+ if ctx.Arch().ArchType == android.Common {
j.deps(ctx)
}
- if ctx.Arch().ArchType != android.Common || ctx.BazelConversionMode() {
+ if ctx.Arch().ArchType != android.Common {
// These dependencies ensure the host installation rules will install the jar file and
// the jni libraries when the wrapper is installed.
ctx.AddVariationDependencies(nil, jniInstallTag, j.binaryProperties.Jni_libs...)
diff --git a/java/proto.go b/java/proto.go
index 5ba486f..5280077 100644
--- a/java/proto.go
+++ b/java/proto.go
@@ -91,7 +91,7 @@
case "lite", unspecifiedProtobufPluginType:
ctx.AddVariationDependencies(nil, staticLibTag, "libprotobuf-java-lite")
case "full":
- if ctx.Host() || ctx.BazelConversionMode() {
+ if ctx.Host() {
ctx.AddVariationDependencies(nil, staticLibTag, "libprotobuf-java-full")
} else {
ctx.PropertyErrorf("proto.type", "full java protos only supported on the host")
diff --git a/rust/library.go b/rust/library.go
index 1286549..c2ce9de 100644
--- a/rust/library.go
+++ b/rust/library.go
@@ -246,10 +246,6 @@
return rlibAutoDep
} else if library.dylib() || library.shared() {
return dylibAutoDep
- } else if ctx.BazelConversionMode() {
- // In Bazel conversion mode, we are currently ignoring the deptag, so we just need to supply a
- // compatible tag in order to add the dependency.
- return rlibAutoDep
} else {
panic(fmt.Errorf("autoDep called on library %q that has no enabled variants.", ctx.ModuleName()))
}
diff --git a/sh/sh_binary.go b/sh/sh_binary.go
index d1beaba..4de0144 100644
--- a/sh/sh_binary.go
+++ b/sh/sh_binary.go
@@ -323,7 +323,7 @@
ctx.AddFarVariationDependencies(ctx.Target().Variations(), shTestDataBinsTag, s.testProperties.Data_bins...)
ctx.AddFarVariationDependencies(append(ctx.Target().Variations(), sharedLibVariations...),
shTestDataLibsTag, s.testProperties.Data_libs...)
- if (ctx.Target().Os.Class == android.Host || ctx.BazelConversionMode()) && len(ctx.Config().Targets[android.Android]) > 0 {
+ if ctx.Target().Os.Class == android.Host && len(ctx.Config().Targets[android.Android]) > 0 {
deviceVariations := ctx.Config().AndroidFirstDeviceTarget.Variations()
ctx.AddFarVariationDependencies(deviceVariations, shTestDataDeviceBinsTag, s.testProperties.Data_device_bins...)
ctx.AddFarVariationDependencies(append(deviceVariations, sharedLibVariations...),