Loading rust/binary.go +2 −8 Original line number Diff line number Diff line Loading @@ -24,9 +24,6 @@ func init() { } type BinaryCompilerProperties struct { // path to the main source file that contains the program entry point (e.g. src/main.rs) Srcs []string `android:"path,arch_variant"` // passes -C prefer-dynamic to rustc, which tells it to dynamically link the stdlib // (assuming it has no dylib dependencies already) Prefer_dynamic *bool Loading @@ -36,9 +33,6 @@ type binaryDecorator struct { *baseCompiler Properties BinaryCompilerProperties distFile android.OptionalPath coverageOutputZipFile android.OptionalPath unstrippedOutputFile android.Path } var _ compiler = (*binaryDecorator)(nil) Loading Loading @@ -112,7 +106,7 @@ func (binary *binaryDecorator) nativeCoverage() bool { func (binary *binaryDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) android.Path { fileName := binary.getStem(ctx) + ctx.toolchain().ExecutableSuffix() srcPath := srcPathFromModuleSrcs(ctx, binary.Properties.Srcs) srcPath := srcPathFromModuleSrcs(ctx, binary.baseCompiler.Properties.Srcs) outputFile := android.PathForModuleOut(ctx, fileName) binary.unstrippedOutputFile = outputFile Loading rust/compiler.go +11 −11 Original line number Diff line number Diff line Loading @@ -53,6 +53,9 @@ const ( ) type BaseCompilerProperties struct { // path to the source file that is the main entry point of the program (e.g. main.rs or lib.rs) Srcs []string `android:"path,arch_variant"` // whether to pass "-D warnings" to rustc. Defaults to true. Deny_warnings *bool Loading Loading @@ -101,15 +104,8 @@ type BaseCompilerProperties struct { type baseCompiler struct { Properties BaseCompilerProperties pathDeps android.Paths rustFlagsDeps android.Paths linkFlagsDeps android.Paths flags string linkFlags string depFlags []string linkDirs []string edition string src android.Path //rustc takes a single src file coverageFile android.Path //rustc generates a single gcno file // Install related Loading @@ -119,6 +115,10 @@ type baseCompiler struct { relative string path android.InstallPath location installLocation coverageOutputZipFile android.OptionalPath unstrippedOutputFile android.Path distFile android.OptionalPath } func (compiler *baseCompiler) coverageOutputZipPath() android.OptionalPath { Loading rust/library.go +4 −10 Original line number Diff line number Diff line Loading @@ -45,9 +45,6 @@ type LibraryCompilerProperties struct { Shared VariantLibraryProperties `android:"arch_variant"` Static VariantLibraryProperties `android:"arch_variant"` // path to the source file that is the main entry point of the program (e.g. src/lib.rs) Srcs []string `android:"path,arch_variant"` // path to include directories to pass to cc_* modules, only relevant for static/shared variants. Include_dirs []string `android:"path,arch_variant"` } Loading Loading @@ -77,9 +74,6 @@ type libraryDecorator struct { Properties LibraryCompilerProperties MutatedProperties LibraryMutatedProperties distFile android.OptionalPath coverageOutputZipFile android.OptionalPath unstrippedOutputFile android.Path includeDirs android.Paths } Loading Loading @@ -350,7 +344,7 @@ func (library *libraryDecorator) compilerFlags(ctx ModuleContext, flags Flags) F func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) android.Path { var outputFile android.WritablePath srcPath := srcPathFromModuleSrcs(ctx, library.Properties.Srcs) srcPath := srcPathFromModuleSrcs(ctx, library.baseCompiler.Properties.Srcs) flags.RustFlags = append(flags.RustFlags, deps.depFlags...) Loading rust/proc_macro.go +2 −10 Original line number Diff line number Diff line Loading @@ -23,20 +23,12 @@ func init() { } type ProcMacroCompilerProperties struct { // path to the source file that is the main entry point of the program (e.g. src/lib.rs) Srcs []string `android:"path,arch_variant"` // set name of the procMacro Stem *string `android:"arch_variant"` Suffix *string `android:"arch_variant"` } type procMacroDecorator struct { *baseCompiler Properties ProcMacroCompilerProperties distFile android.OptionalPath unstrippedOutputFile android.Path } type procMacroInterface interface { Loading Loading @@ -70,7 +62,7 @@ func (procMacro *procMacroDecorator) compile(ctx ModuleContext, flags Flags, dep fileName := procMacro.getStem(ctx) + ctx.toolchain().ProcMacroSuffix() outputFile := android.PathForModuleOut(ctx, fileName) srcPath := srcPathFromModuleSrcs(ctx, procMacro.Properties.Srcs) srcPath := srcPathFromModuleSrcs(ctx, procMacro.baseCompiler.Properties.Srcs) procMacro.unstrippedOutputFile = outputFile Loading rust/project_json.go +1 −1 Original line number Diff line number Diff line Loading @@ -114,7 +114,7 @@ func appendLibraryAndDeps(ctx android.SingletonContext, project *rustProjectJson return cInfo.ID, crateName, true } crate := rustProjectCrate{Deps: make([]rustProjectDep, 0), Cfgs: make([]string, 0)} src := rustLib.Properties.Srcs[0] src := rustLib.baseCompiler.Properties.Srcs[0] crate.RootModule = path.Join(ctx.ModuleDir(rModule), src) crate.Edition = getEdition(rustLib.baseCompiler) Loading Loading
rust/binary.go +2 −8 Original line number Diff line number Diff line Loading @@ -24,9 +24,6 @@ func init() { } type BinaryCompilerProperties struct { // path to the main source file that contains the program entry point (e.g. src/main.rs) Srcs []string `android:"path,arch_variant"` // passes -C prefer-dynamic to rustc, which tells it to dynamically link the stdlib // (assuming it has no dylib dependencies already) Prefer_dynamic *bool Loading @@ -36,9 +33,6 @@ type binaryDecorator struct { *baseCompiler Properties BinaryCompilerProperties distFile android.OptionalPath coverageOutputZipFile android.OptionalPath unstrippedOutputFile android.Path } var _ compiler = (*binaryDecorator)(nil) Loading Loading @@ -112,7 +106,7 @@ func (binary *binaryDecorator) nativeCoverage() bool { func (binary *binaryDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) android.Path { fileName := binary.getStem(ctx) + ctx.toolchain().ExecutableSuffix() srcPath := srcPathFromModuleSrcs(ctx, binary.Properties.Srcs) srcPath := srcPathFromModuleSrcs(ctx, binary.baseCompiler.Properties.Srcs) outputFile := android.PathForModuleOut(ctx, fileName) binary.unstrippedOutputFile = outputFile Loading
rust/compiler.go +11 −11 Original line number Diff line number Diff line Loading @@ -53,6 +53,9 @@ const ( ) type BaseCompilerProperties struct { // path to the source file that is the main entry point of the program (e.g. main.rs or lib.rs) Srcs []string `android:"path,arch_variant"` // whether to pass "-D warnings" to rustc. Defaults to true. Deny_warnings *bool Loading Loading @@ -101,15 +104,8 @@ type BaseCompilerProperties struct { type baseCompiler struct { Properties BaseCompilerProperties pathDeps android.Paths rustFlagsDeps android.Paths linkFlagsDeps android.Paths flags string linkFlags string depFlags []string linkDirs []string edition string src android.Path //rustc takes a single src file coverageFile android.Path //rustc generates a single gcno file // Install related Loading @@ -119,6 +115,10 @@ type baseCompiler struct { relative string path android.InstallPath location installLocation coverageOutputZipFile android.OptionalPath unstrippedOutputFile android.Path distFile android.OptionalPath } func (compiler *baseCompiler) coverageOutputZipPath() android.OptionalPath { Loading
rust/library.go +4 −10 Original line number Diff line number Diff line Loading @@ -45,9 +45,6 @@ type LibraryCompilerProperties struct { Shared VariantLibraryProperties `android:"arch_variant"` Static VariantLibraryProperties `android:"arch_variant"` // path to the source file that is the main entry point of the program (e.g. src/lib.rs) Srcs []string `android:"path,arch_variant"` // path to include directories to pass to cc_* modules, only relevant for static/shared variants. Include_dirs []string `android:"path,arch_variant"` } Loading Loading @@ -77,9 +74,6 @@ type libraryDecorator struct { Properties LibraryCompilerProperties MutatedProperties LibraryMutatedProperties distFile android.OptionalPath coverageOutputZipFile android.OptionalPath unstrippedOutputFile android.Path includeDirs android.Paths } Loading Loading @@ -350,7 +344,7 @@ func (library *libraryDecorator) compilerFlags(ctx ModuleContext, flags Flags) F func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) android.Path { var outputFile android.WritablePath srcPath := srcPathFromModuleSrcs(ctx, library.Properties.Srcs) srcPath := srcPathFromModuleSrcs(ctx, library.baseCompiler.Properties.Srcs) flags.RustFlags = append(flags.RustFlags, deps.depFlags...) Loading
rust/proc_macro.go +2 −10 Original line number Diff line number Diff line Loading @@ -23,20 +23,12 @@ func init() { } type ProcMacroCompilerProperties struct { // path to the source file that is the main entry point of the program (e.g. src/lib.rs) Srcs []string `android:"path,arch_variant"` // set name of the procMacro Stem *string `android:"arch_variant"` Suffix *string `android:"arch_variant"` } type procMacroDecorator struct { *baseCompiler Properties ProcMacroCompilerProperties distFile android.OptionalPath unstrippedOutputFile android.Path } type procMacroInterface interface { Loading Loading @@ -70,7 +62,7 @@ func (procMacro *procMacroDecorator) compile(ctx ModuleContext, flags Flags, dep fileName := procMacro.getStem(ctx) + ctx.toolchain().ProcMacroSuffix() outputFile := android.PathForModuleOut(ctx, fileName) srcPath := srcPathFromModuleSrcs(ctx, procMacro.Properties.Srcs) srcPath := srcPathFromModuleSrcs(ctx, procMacro.baseCompiler.Properties.Srcs) procMacro.unstrippedOutputFile = outputFile Loading
rust/project_json.go +1 −1 Original line number Diff line number Diff line Loading @@ -114,7 +114,7 @@ func appendLibraryAndDeps(ctx android.SingletonContext, project *rustProjectJson return cInfo.ID, crateName, true } crate := rustProjectCrate{Deps: make([]rustProjectDep, 0), Cfgs: make([]string, 0)} src := rustLib.Properties.Srcs[0] src := rustLib.baseCompiler.Properties.Srcs[0] crate.RootModule = path.Join(ctx.ModuleDir(rModule), src) crate.Edition = getEdition(rustLib.baseCompiler) Loading