summaryrefslogtreecommitdiff
path: root/rust/library.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/library.go
parentf2b16069bbe3608e4443d38bd84af7dc0fc17fd1 (diff)
Revert^4 "add crate_root property to rust modules"
9c64274b275a00d7753bbe1a15945652521b2044 Change-Id: I1c4dad76842cebf18cd82e04e435910f09038d07
Diffstat (limited to 'rust/library.go')
-rw-r--r--rust/library.go18
1 files changed, 10 insertions, 8 deletions
diff --git a/rust/library.go b/rust/library.go
index 035708674..f4a2b5441 100644
--- a/rust/library.go
+++ b/rust/library.go
@@ -489,7 +489,7 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa
var outputFile android.ModuleOutPath
var ret buildOutput
var fileName string
- srcPath := library.srcPath(ctx, deps)
+ crateRootPath := library.crateRootPath(ctx, deps)
if library.sourceProvider != nil {
deps.srcProviderFiles = append(deps.srcProviderFiles, library.sourceProvider.Srcs()...)
@@ -536,13 +536,13 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa
// Call the appropriate builder for this library type
if library.rlib() {
- ret.kytheFile = TransformSrctoRlib(ctx, srcPath, deps, flags, outputFile).kytheFile
+ ret.kytheFile = TransformSrctoRlib(ctx, crateRootPath, deps, flags, outputFile).kytheFile
} else if library.dylib() {
- ret.kytheFile = TransformSrctoDylib(ctx, srcPath, deps, flags, outputFile).kytheFile
+ ret.kytheFile = TransformSrctoDylib(ctx, crateRootPath, deps, flags, outputFile).kytheFile
} else if library.static() {
- ret.kytheFile = TransformSrctoStatic(ctx, srcPath, deps, flags, outputFile).kytheFile
+ ret.kytheFile = TransformSrctoStatic(ctx, crateRootPath, deps, flags, outputFile).kytheFile
} else if library.shared() {
- ret.kytheFile = TransformSrctoShared(ctx, srcPath, deps, flags, outputFile).kytheFile
+ ret.kytheFile = TransformSrctoShared(ctx, crateRootPath, deps, flags, outputFile).kytheFile
}
if library.rlib() || library.dylib() {
@@ -585,13 +585,15 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa
return ret
}
-func (library *libraryDecorator) srcPath(ctx ModuleContext, _ PathDeps) android.Path {
+func (library *libraryDecorator) crateRootPath(ctx ModuleContext, _ PathDeps) android.Path {
if library.sourceProvider != nil {
// Assume the first source from the source provider is the library entry point.
return library.sourceProvider.Srcs()[0]
- } else {
+ } else if library.baseCompiler.Properties.Crate_root == nil {
path, _ := srcPathFromModuleSrcs(ctx, library.baseCompiler.Properties.Srcs)
return path
+ } else {
+ return android.PathForModuleSrc(ctx, *library.baseCompiler.Properties.Crate_root)
}
}
@@ -606,7 +608,7 @@ func (library *libraryDecorator) rustdoc(ctx ModuleContext, flags Flags,
return android.OptionalPath{}
}
- return android.OptionalPathForPath(Rustdoc(ctx, library.srcPath(ctx, deps),
+ return android.OptionalPathForPath(Rustdoc(ctx, library.crateRootPath(ctx, deps),
deps, flags))
}