diff options
author | 2023-11-20 21:02:40 +0000 | |
---|---|---|
committer | 2023-11-20 21:02:40 +0000 | |
commit | d221d315340476b27308e205311d458ac440e17b (patch) | |
tree | b8edf0b8199dcb790d570afc256fe5bb7bae58f3 /rust/compiler.go | |
parent | cd41653b96d2285b11b010198e453cf688b66cbe (diff) |
rust: move crateRootPath to compiler
Test: m nothing
Bug: 309943184
Change-Id: I45028945357c394301d93ca7995a4f9adf281931
Diffstat (limited to 'rust/compiler.go')
-rw-r--r-- | rust/compiler.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/rust/compiler.go b/rust/compiler.go index 9666ce296..98bbcb645 100644 --- a/rust/compiler.go +++ b/rust/compiler.go @@ -70,6 +70,8 @@ type compiler interface { unstrippedOutputFilePath() android.Path strippedOutputFilePath() android.OptionalPath + + crateRootPath(ctx ModuleContext) android.Path } func (compiler *baseCompiler) edition() string { @@ -537,6 +539,15 @@ func (compiler *baseCompiler) relativeInstallPath() string { return String(compiler.Properties.Relative_install_path) } +func (compiler *baseCompiler) crateRootPath(ctx ModuleContext) android.Path { + if compiler.Properties.Crate_root == nil { + path, _ := srcPathFromModuleSrcs(ctx, compiler.Properties.Srcs) + return path + } else { + return android.PathForModuleSrc(ctx, *compiler.Properties.Crate_root) + } +} + // Returns the Path for the main source file along with Paths for generated source files from modules listed in srcs. func srcPathFromModuleSrcs(ctx ModuleContext, srcs []string) (android.Path, android.Paths) { if len(srcs) == 0 { |