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

@@ -14,7 +14,11 @@
package android
import "path/filepath"
import (
"path/filepath"
"github.com/google/blueprint"
)
func init() {
RegisterModuleType("prebuilt_build_tool", NewPrebuiltBuildTool)
@@ -55,6 +59,13 @@ func (t *prebuiltBuildTool) DepsMutator(ctx BottomUpMutatorContext) {
}
}
type PrebuiltBuildToolInfo struct {
Src Path
Deps Paths
}
var PrebuiltBuildToolInfoProvider = blueprint.NewProvider(PrebuiltBuildToolInfo{})
func (t *prebuiltBuildTool) GenerateAndroidBuildActions(ctx ModuleContext) {
sourcePath := t.prebuilt.SingleSourcePath(ctx)
installedPath := PathForModuleOut(ctx, t.BaseModuleName())
@@ -82,6 +93,11 @@ func (t *prebuiltBuildTool) GenerateAndroidBuildActions(ctx ModuleContext) {
}
t.toolPath = OptionalPathForPath(installedPath)
ctx.SetProvider(PrebuiltBuildToolInfoProvider, PrebuiltBuildToolInfo{
Src: sourcePath,
Deps: deps,
})
}
func (t *prebuiltBuildTool) MakeVars(ctx MakeVarsModuleContext) {