summaryrefslogtreecommitdiff
path: root/rust/compiler.go
diff options
context:
space:
mode:
author Ivan Lozano <ivanlozano@google.com> 2021-11-05 16:36:47 -0400
committer Ivan Lozano <ivanlozano@google.com> 2021-11-09 21:43:58 -0500
commit8d10fc39afdda6a9c3f27f3ed0999db9c8c2199a (patch)
tree4394b9dee4d75914b212d9cecbde59d1be5171cd /rust/compiler.go
parentcd3af1e52c3560a6d63b1fe9c79b8fd11514b026 (diff)
rust: Refactor stripped output file path
Rust installed files reside in "$MODULE_OUT/stripped/" when they are stripped, otherwise they reside in "$MODULE_OUT". However, other parts of Soong assume that installed files are always in $MODULE_OUT (cc_modules place *unstripped* files in $MODULE_OUT/unstripped). This notably causes problems when adding Rust modules as test data in AndroidMkDataPaths. When Rust modules are parsed by AndroidMkDataPaths, if they are stripped then they incorrectly get installed as test data with the path: <install_root>/<relative_install_path>/stripped/file. This CL refactors how we handle Rust stripped output such that the installed file always resides in $MODULE_OUT. Bug: 171710847 Test: Installed files now always reside in $MODULE_OUT Change-Id: I53a6ff57a0a5a55cd95ea78ae592ce22abfa20c9
Diffstat (limited to 'rust/compiler.go')
-rw-r--r--rust/compiler.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/rust/compiler.go b/rust/compiler.go
index cada9854a..293b17b50 100644
--- a/rust/compiler.go
+++ b/rust/compiler.go
@@ -181,7 +181,11 @@ type baseCompiler struct {
sanitize *sanitize
distFile android.OptionalPath
- // Stripped output file. If Valid(), this file will be installed instead of outputFile.
+
+ // unstripped output file.
+ unstrippedOutputFile android.Path
+
+ // stripped output file.
strippedOutputFile android.OptionalPath
// If a crate has a source-generated dependency, a copy of the source file
@@ -340,6 +344,10 @@ func (compiler *baseCompiler) CargoPkgVersion() string {
return String(compiler.Properties.Cargo_pkg_version)
}
+func (compiler *baseCompiler) unstrippedOutputFilePath() android.Path {
+ return compiler.unstrippedOutputFile
+}
+
func (compiler *baseCompiler) strippedOutputFilePath() android.OptionalPath {
return compiler.strippedOutputFile
}