diff --git a/android/mutator.go b/android/mutator.go index c6b667696..b361c51ce 100644 --- a/android/mutator.go +++ b/android/mutator.go @@ -16,9 +16,7 @@ package android import ( "android/soong/bazel" - "fmt" "reflect" - "strings" "sync" "github.com/google/blueprint" @@ -519,12 +517,6 @@ func (t *topDownMutatorContext) CreateBazelTargetModule( name string, bazelProps bazel.BazelTargetModuleProperties, attrs interface{}) { - if strings.HasPrefix(name, bazel.BazelTargetModuleNamePrefix) { - panic(fmt.Errorf( - "The %s name prefix is added automatically, do not set it manually: %s", - bazel.BazelTargetModuleNamePrefix, - name)) - } info := bp2buildInfo{ Name: name, diff --git a/bazel/properties.go b/bazel/properties.go index ed4e9fc9a..d3b40a242 100644 --- a/bazel/properties.go +++ b/bazel/properties.go @@ -19,7 +19,6 @@ import ( "path/filepath" "regexp" "sort" - "strings" ) // BazelTargetModuleProperties contain properties and metadata used for @@ -32,12 +31,6 @@ type BazelTargetModuleProperties struct { Bzl_load_location string `blueprint:"mutated"` } -const BazelTargetModuleNamePrefix = "__bp2build__" - -func StripNamePrefix(moduleName string) string { - return strings.TrimPrefix(moduleName, BazelTargetModuleNamePrefix) -} - var productVariableSubstitutionPattern = regexp.MustCompile("%(d|s)") // Label is used to represent a Bazel compatible Label. Also stores the original diff --git a/bp2build/build_conversion.go b/bp2build/build_conversion.go index 10e2329b1..2cbb5579e 100644 --- a/bp2build/build_conversion.go +++ b/bp2build/build_conversion.go @@ -153,10 +153,10 @@ type bpToBuildContext interface { } type CodegenContext struct { - config android.Config - context android.Context - mode CodegenMode - additionalDeps []string + config android.Config + context android.Context + mode CodegenMode + additionalDeps []string unconvertedDepMode unconvertedDepsMode } @@ -710,10 +710,6 @@ func makeIndent(indent int) string { return strings.Repeat(" ", indent) } -func targetNameForBp2Build(c bpToBuildContext, logicModule blueprint.Module) string { - return strings.Replace(c.ModuleName(logicModule), bazel.BazelTargetModuleNamePrefix, "", 1) -} - func targetNameWithVariant(c bpToBuildContext, logicModule blueprint.Module) string { name := "" if c.ModuleSubDir(logicModule) != "" { diff --git a/bp2build/compatibility.go b/bp2build/compatibility.go index 5baa5249b..01dbdb9df 100644 --- a/bp2build/compatibility.go +++ b/bp2build/compatibility.go @@ -1,7 +1,6 @@ package bp2build import ( - "android/soong/bazel" "fmt" ) @@ -16,9 +15,6 @@ type CodegenCompatLayer struct { // Log an entry of module name -> Bazel target label. func (compatLayer CodegenCompatLayer) AddNameToLabelEntry(name, label string) { - // The module name may be prefixed with bazel.BazelTargetModuleNamePrefix if - // generated from bp2build. - name = bazel.StripNamePrefix(name) if existingLabel, ok := compatLayer.NameToLabelMap[name]; ok { panic(fmt.Errorf( "Module '%s' maps to more than one Bazel target label: %s, %s. "+