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
This commit is contained in:
Sam Delmerico
2023-06-16 10:28:04 -04:00
parent d96a60685a
commit a588d153c8
28 changed files with 1403 additions and 384 deletions

View File

@@ -95,6 +95,12 @@ func NewDepSet[T depSettableType](order DepSetOrder, direct []T, transitive []*D
}
}
// AddDirectToDepSet returns a new DepSet with additional elements added to its direct set.
// The transitive sets remain untouched.
func AddDirectToDepSet[T depSettableType](d *DepSet[T], direct ...T) *DepSet[T] {
return NewDepSet[T](d.order, Concat(d.direct, direct), d.transitive)
}
// DepSetBuilder is used to create an immutable DepSet.
type DepSetBuilder[T depSettableType] struct {
order DepSetOrder
@@ -188,3 +194,14 @@ func (d *DepSet[T]) ToList() []T {
}
return list
}
// ToListDirect returns the direct elements of a DepSet flattened to a list.
func (d *DepSet[T]) ToListDirect() []T {
if d == nil {
return nil
}
list := make([]T, len(d.direct))
copy(list, d.direct)
list = firstUniqueInPlace(list)
return list
}