Sandbox uwb genrules

go/roboleaf-busy-beavers-sandboxing

Bug: 307824623
Test: ./build/soong/tests/genrule_sandbox_test.py gen_uwb_core_proto uwb_core_artifacts
Change-Id: I3f45423d14ea15cbfb75237c9e8682e5919c77c9
diff --git a/src/Android.bp b/src/Android.bp
index 16cb3a1..500bbd1 100755
--- a/src/Android.bp
+++ b/src/Android.bp
@@ -210,7 +210,6 @@
     tools: ["aprotoc", "protoc-gen-rust"],
     cmd: "$(location aprotoc)" +
          " --proto_path=`dirname $(in)`" +
-         " --dependency_out=$(depfile)" +
          " --plugin=protoc-gen-rust=$(location protoc-gen-rust)" +
          " --rust_out=$(genDir) $(in)",
     srcs: [
@@ -219,7 +218,6 @@
     out: [
         "uwb_service.rs",
     ],
-    depfile: true,
 }
 
 genrule {
@@ -363,23 +361,28 @@
         "pdlc",
         "soong_zip",
     ],
+    srcs: [
+        "rust/uwb_core/**/*",
+        "rust/uwb_uci_packets/**/*",
+        "rust/Cargo.toml",
+    ],
     cmd:
         // Create a artifacts directory and copy the source code into it.
-        "mkdir $(genDir)/artifacts;" +
+        "mkdir $(genDir)/artifacts && " +
         "cp -r external/uwb/src/rust/uwb_core " +
         "      external/uwb/src/rust/uwb_uci_packets " +
         "      external/uwb/src/rust/Cargo.toml " +
-        "      $(genDir)/artifacts;" +
+        "      $(genDir)/artifacts && " +
 
         // Generate uci_packets.rs at $(genDir)/artifacts/uwb_uci_packets/.
         "$(location pdlc) --output-format rust " +
         "      external/uwb/src/rust/uwb_uci_packets/uci_packets.pdl " +
-        "      > $(genDir)/artifacts/uwb_uci_packets/uci_packets.rs;" +
+        "      > $(genDir)/artifacts/uwb_uci_packets/uci_packets.rs && " +
 
         // Pack the artifacts directory and clean up the directory.
         "$(location soong_zip) -o $(out) " +
         "                      -C $(genDir)/artifacts " +
-        "                      -D $(genDir)/artifacts;" +
+        "                      -D $(genDir)/artifacts && " +
         "rm -rf $(genDir)/artifacts",
     out: [
         "uwb_core_artifacts.zip",