Add $(build_number_file) support to genrules
Genrules that set uses_order_only_build_number_file: true will now
have the ability to reference a $(build_number_file) label that
will point to the build number file. It will also caused the build
number file to be added as an order-only dependency, which will make
it show up in the genrule sandbox.
This is needed for converting make code that references the build
number to soong, and for sandboxing the remaining unsandboxed genrules
that reference the build number.
Bug: 341873065
Test: m nothing --no-skip-soong-tests
Change-Id: I9092cbb0eb39c5449a79f0ee40a4202262cef206
diff --git a/android/rule_builder.go b/android/rule_builder.go
index 8b03124..464aca4 100644
--- a/android/rule_builder.go
+++ b/android/rule_builder.go
@@ -554,6 +554,12 @@
To: proto.String(r.sboxPathForInputRel(input)),
})
}
+ for _, input := range r.OrderOnlys() {
+ command.CopyBefore = append(command.CopyBefore, &sbox_proto.Copy{
+ From: proto.String(input.String()),
+ To: proto.String(r.sboxPathForInputRel(input)),
+ })
+ }
// If using rsp files copy them and their contents into the sbox directory with
// the appropriate path mappings.