support sandboxed rust rules

This commit adds support for compiling rust rules inside the sbox
sandbox. To compile a rust module with sandboxing enabled, the entry
point to the crate must be specified via the `crate_root` property, and
all input sources and compile-time data must be specified via the `srcs`
and `compile_data` properties.

Bug: 286077158
Change-Id: I8c9dc5cf7578037a583b4be2e2f73cf20ffd4408
diff --git a/rust/image_test.go b/rust/image_test.go
index fb4d9c1..813c5bc 100644
--- a/rust/image_test.go
+++ b/rust/image_test.go
@@ -59,36 +59,36 @@
 
 	vendor := ctx.ModuleForTests("libfoo", "android_vendor.29_arm64_armv8-a_static").Rule("rustc")
 
-	if !strings.Contains(vendor.Args["rustcFlags"], "--cfg 'android_vndk'") {
-		t.Errorf("missing \"--cfg 'android_vndk'\" for libfoo vendor variant, rustcFlags: %#v", vendor.Args["rustcFlags"])
+	if !strings.Contains(vendor.RuleParams.Command, "--cfg 'android_vndk'") {
+		t.Errorf("missing \"--cfg 'android_vndk'\" for libfoo vendor variant, rustcFlags: %#v", vendor.RuleParams.Command)
 	}
-	if !strings.Contains(vendor.Args["rustcFlags"], "--cfg 'android_vendor'") {
-		t.Errorf("missing \"--cfg 'android_vendor'\" for libfoo vendor variant, rustcFlags: %#v", vendor.Args["rustcFlags"])
+	if !strings.Contains(vendor.RuleParams.Command, "--cfg 'android_vendor'") {
+		t.Errorf("missing \"--cfg 'android_vendor'\" for libfoo vendor variant, rustcFlags: %#v", vendor.RuleParams.Command)
 	}
-	if strings.Contains(vendor.Args["rustcFlags"], "--cfg 'android_product'") {
-		t.Errorf("unexpected \"--cfg 'android_product'\" for libfoo vendor variant, rustcFlags: %#v", vendor.Args["rustcFlags"])
+	if strings.Contains(vendor.RuleParams.Command, "--cfg 'android_product'") {
+		t.Errorf("unexpected \"--cfg 'android_product'\" for libfoo vendor variant, rustcFlags: %#v", vendor.RuleParams.Command)
 	}
 
 	product := ctx.ModuleForTests("libfoo", "android_product.29_arm64_armv8-a_static").Rule("rustc")
-	if !strings.Contains(product.Args["rustcFlags"], "--cfg 'android_vndk'") {
-		t.Errorf("missing \"--cfg 'android_vndk'\" for libfoo product variant, rustcFlags: %#v", product.Args["rustcFlags"])
+	if !strings.Contains(product.RuleParams.Command, "--cfg 'android_vndk'") {
+		t.Errorf("missing \"--cfg 'android_vndk'\" for libfoo product variant, rustcFlags: %#v", product.RuleParams.Command)
 	}
-	if strings.Contains(product.Args["rustcFlags"], "--cfg 'android_vendor'") {
-		t.Errorf("unexpected \"--cfg 'android_vendor'\" for libfoo product variant, rustcFlags: %#v", product.Args["rustcFlags"])
+	if strings.Contains(product.RuleParams.Command, "--cfg 'android_vendor'") {
+		t.Errorf("unexpected \"--cfg 'android_vendor'\" for libfoo product variant, rustcFlags: %#v", product.RuleParams.Command)
 	}
-	if !strings.Contains(product.Args["rustcFlags"], "--cfg 'android_product'") {
-		t.Errorf("missing \"--cfg 'android_product'\" for libfoo product variant, rustcFlags: %#v", product.Args["rustcFlags"])
+	if !strings.Contains(product.RuleParams.Command, "--cfg 'android_product'") {
+		t.Errorf("missing \"--cfg 'android_product'\" for libfoo product variant, rustcFlags: %#v", product.RuleParams.Command)
 	}
 
 	system := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_static").Rule("rustc")
-	if strings.Contains(system.Args["rustcFlags"], "--cfg 'android_vndk'") {
-		t.Errorf("unexpected \"--cfg 'android_vndk'\" for libfoo system variant, rustcFlags: %#v", system.Args["rustcFlags"])
+	if strings.Contains(system.RuleParams.Command, "--cfg 'android_vndk'") {
+		t.Errorf("unexpected \"--cfg 'android_vndk'\" for libfoo system variant, rustcFlags: %#v", system.RuleParams.Command)
 	}
-	if strings.Contains(system.Args["rustcFlags"], "--cfg 'android_vendor'") {
-		t.Errorf("unexpected \"--cfg 'android_vendor'\" for libfoo system variant, rustcFlags: %#v", system.Args["rustcFlags"])
+	if strings.Contains(system.RuleParams.Command, "--cfg 'android_vendor'") {
+		t.Errorf("unexpected \"--cfg 'android_vendor'\" for libfoo system variant, rustcFlags: %#v", system.RuleParams.Command)
 	}
-	if strings.Contains(system.Args["rustcFlags"], "--cfg 'android_product'") {
-		t.Errorf("unexpected \"--cfg 'android_product'\" for libfoo system variant, rustcFlags: %#v", product.Args["rustcFlags"])
+	if strings.Contains(system.RuleParams.Command, "--cfg 'android_product'") {
+		t.Errorf("unexpected \"--cfg 'android_product'\" for libfoo system variant, rustcFlags: %#v", product.RuleParams.Command)
 	}
 
 }