summaryrefslogtreecommitdiff
path: root/rust/binary.go
diff options
context:
space:
mode:
author Sam Delmerico <delmerico@google.com> 2023-09-25 12:13:17 +0000
committer Sam Delmerico <delmerico@google.com> 2023-09-25 12:13:17 +0000
commit63ca14e9b74b913c5b6532bf13397a07b5f8a63f (patch)
tree045ddb322c801d20b17442454ad1ce8c6268a7d4 /rust/binary.go
parentf2b16069bbe3608e4443d38bd84af7dc0fc17fd1 (diff)
Revert^4 "add crate_root property to rust modules"
9c64274b275a00d7753bbe1a15945652521b2044 Change-Id: I1c4dad76842cebf18cd82e04e435910f09038d07
Diffstat (limited to 'rust/binary.go')
-rw-r--r--rust/binary.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/rust/binary.go b/rust/binary.go
index 1408ff17b..aee4da699 100644
--- a/rust/binary.go
+++ b/rust/binary.go
@@ -138,9 +138,14 @@ 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...)
@@ -155,7 +160,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, crateRootPath, deps, flags, outputFile).kytheFile
return ret
}