Add bp2build for rust_protobuf module
We only supported bp2build for rust_protobuf_host because the non-host toolchain for rust is not checked in yet. aosp/2759750 changed a converted module from rust_protobuf_host to rust_protobuf and broke CI.
This CL adds bp2build support for rust_protobuf but makes the target incompatible with android os for now untilnon-host rust toolchain is checked in.
Bug: 301956497
Test: b build //build/make/tools/aconfig:all --config=android
Change-Id: I739896c79f32674000c2603e394f16860a6fc57d
diff --git a/rust/protobuf.go b/rust/protobuf.go
index c8d2bda..c3aa8dc 100644
--- a/rust/protobuf.go
+++ b/rust/protobuf.go
@@ -305,7 +305,11 @@
},
}
- ctx.CreateBazelTargetModule(
+ // TODO(b/295918553): Remove androidRestriction after rust toolchain for android is checked in.
+ var androidRestriction bazel.BoolAttribute
+ androidRestriction.SetSelectValue(bazel.OsConfigurationAxis, "android", proptools.BoolPtr(false))
+
+ ctx.CreateBazelTargetModuleWithRestrictions(
bazel.BazelTargetModuleProperties{
Rule_class: "proto_library",
},
@@ -317,9 +321,10 @@
android.BazelLabelForModuleSrc(ctx, protoFiles),
),
},
+ androidRestriction,
)
- ctx.CreateBazelTargetModule(
+ ctx.CreateBazelTargetModuleWithRestrictions(
bazel.BazelTargetModuleProperties{
Rule_class: "rust_proto_library",
Bzl_load_location: "@rules_rust//proto/protobuf:defs.bzl",
@@ -333,5 +338,6 @@
},
Deps: protoDeps,
},
+ androidRestriction,
)
}