Loading rust/compiler.go +11 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,8 @@ type compiler interface { unstrippedOutputFilePath() android.Path strippedOutputFilePath() android.OptionalPath crateRootPath(ctx ModuleContext) android.Path } func (compiler *baseCompiler) edition() string { Loading Loading @@ -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 { Loading rust/library.go +4 −7 Original line number Diff line number Diff line Loading @@ -489,7 +489,7 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa var outputFile android.ModuleOutPath var ret buildOutput var fileName string crateRootPath := library.crateRootPath(ctx, deps) crateRootPath := library.crateRootPath(ctx) if library.sourceProvider != nil { deps.srcProviderFiles = append(deps.srcProviderFiles, library.sourceProvider.Srcs()...) Loading Loading @@ -584,15 +584,12 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa return ret } func (library *libraryDecorator) crateRootPath(ctx ModuleContext, _ PathDeps) android.Path { func (library *libraryDecorator) crateRootPath(ctx ModuleContext) 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 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) return library.baseCompiler.crateRootPath(ctx) } } Loading @@ -607,7 +604,7 @@ func (library *libraryDecorator) rustdoc(ctx ModuleContext, flags Flags, return android.OptionalPath{} } return android.OptionalPathForPath(Rustdoc(ctx, library.crateRootPath(ctx, deps), return android.OptionalPathForPath(Rustdoc(ctx, library.crateRootPath(ctx), deps, flags)) } Loading Loading
rust/compiler.go +11 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,8 @@ type compiler interface { unstrippedOutputFilePath() android.Path strippedOutputFilePath() android.OptionalPath crateRootPath(ctx ModuleContext) android.Path } func (compiler *baseCompiler) edition() string { Loading Loading @@ -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 { Loading
rust/library.go +4 −7 Original line number Diff line number Diff line Loading @@ -489,7 +489,7 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa var outputFile android.ModuleOutPath var ret buildOutput var fileName string crateRootPath := library.crateRootPath(ctx, deps) crateRootPath := library.crateRootPath(ctx) if library.sourceProvider != nil { deps.srcProviderFiles = append(deps.srcProviderFiles, library.sourceProvider.Srcs()...) Loading Loading @@ -584,15 +584,12 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa return ret } func (library *libraryDecorator) crateRootPath(ctx ModuleContext, _ PathDeps) android.Path { func (library *libraryDecorator) crateRootPath(ctx ModuleContext) 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 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) return library.baseCompiler.crateRootPath(ctx) } } Loading @@ -607,7 +604,7 @@ func (library *libraryDecorator) rustdoc(ctx ModuleContext, flags Flags, return android.OptionalPath{} } return android.OptionalPathForPath(Rustdoc(ctx, library.crateRootPath(ctx, deps), return android.OptionalPathForPath(Rustdoc(ctx, library.crateRootPath(ctx), deps, flags)) } Loading