Merge changes from topics "revert-2746976-revert-2605644-rulebuilder-ninja-vars-OAAWYCDDLT-KMAGKVIXAT", "sandbox-rust-inputs" into main

* changes:
  support sandboxed rust rules
  conditionally escape rule builder command
  Revert^2 "allow Ninja variables in RuleBuilder API"
  Revert^2 "add crate_root property to rust modules"
  Revert^2 "add rust_toolchain_rustc_prebuilt module type"
This commit is contained in:
Sam Delmerico
2023-09-20 18:48:21 +00:00
committed by Gerrit Code Review
32 changed files with 1620 additions and 424 deletions

View File

@@ -138,13 +138,17 @@ func (binary *binaryDecorator) preferRlib() bool {
func (binary *binaryDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) buildOutput {
fileName := binary.getStem(ctx) + ctx.toolchain().ExecutableSuffix()
srcPath, _ := srcPathFromModuleSrcs(ctx, binary.baseCompiler.Properties.Srcs)
outputFile := android.PathForModuleOut(ctx, fileName)
ret := buildOutput{outputFile: outputFile}
var crateRootPath android.Path
if binary.baseCompiler.Properties.Crate_root == nil {
crateRootPath, _ = srcPathFromModuleSrcs(ctx, binary.baseCompiler.Properties.Srcs)
} else {
crateRootPath = android.PathForModuleSrc(ctx, *binary.baseCompiler.Properties.Crate_root)
}
flags.RustFlags = append(flags.RustFlags, deps.depFlags...)
flags.LinkFlags = append(flags.LinkFlags, deps.depLinkFlags...)
flags.LinkFlags = append(flags.LinkFlags, deps.linkObjects.Strings()...)
if binary.stripper.NeedsStrip(ctx) {
strippedOutputFile := outputFile
@@ -155,7 +159,7 @@ func (binary *binaryDecorator) compile(ctx ModuleContext, flags Flags, deps Path
}
binary.baseCompiler.unstrippedOutputFile = outputFile
ret.kytheFile = TransformSrcToBinary(ctx, srcPath, deps, flags, outputFile).kytheFile
ret.kytheFile = TransformSrcToBinary(ctx, binary, crateRootPath, deps, flags, outputFile).kytheFile
return ret
}