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/android/util.go b/android/util.go
index 5375373..7f6af2d 100644
--- a/android/util.go
+++ b/android/util.go
@@ -33,12 +33,17 @@
return append([]T{}, s...)
}
-// Concat returns a new slice concatenated from the two input slices. It does not change the input
+// Concat returns a new slice concatenated from the input slices. It does not change the input
// slices.
-func Concat[T any](s1, s2 []T) []T {
- res := make([]T, 0, len(s1)+len(s2))
- res = append(res, s1...)
- res = append(res, s2...)
+func Concat[T any](slices ...[]T) []T {
+ newLength := 0
+ for _, s := range slices {
+ newLength += len(s)
+ }
+ res := make([]T, 0, newLength)
+ for _, s := range slices {
+ res = append(res, s...)
+ }
return res
}