diff options
Diffstat (limited to 'rust/compiler.go')
-rw-r--r-- | rust/compiler.go | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/rust/compiler.go b/rust/compiler.go index efc1ce4ca..92a3b07f2 100644 --- a/rust/compiler.go +++ b/rust/compiler.go @@ -28,10 +28,6 @@ func getEdition(compiler *baseCompiler) string { return proptools.StringDefault(compiler.Properties.Edition, config.DefaultEdition) } -func getDenyWarnings(compiler *baseCompiler) bool { - return BoolDefault(compiler.Properties.Deny_warnings, config.DefaultDenyWarnings) -} - func (compiler *baseCompiler) setNoStdlibs() { compiler.Properties.No_stdlibs = proptools.BoolPtr(true) } @@ -56,8 +52,8 @@ 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 + // whether to suppress the standard lint flags - default to false + No_lint *bool // flags to pass to rustc Flags []string `android:"path,arch_variant"` @@ -71,6 +67,9 @@ type BaseCompilerProperties struct { // list of rust dylib crate dependencies Dylibs []string `android:"arch_variant"` + // list of rust automatic crate dependencies + Rustlibs []string `android:"arch_variant"` + // list of rust proc_macro crate dependencies Proc_macros []string `android:"arch_variant"` @@ -104,8 +103,6 @@ type BaseCompilerProperties struct { type baseCompiler struct { Properties BaseCompilerProperties - depFlags []string - linkDirs []string coverageFile android.Path //rustc generates a single gcno file // Install related @@ -145,8 +142,8 @@ func (compiler *baseCompiler) featuresToFlags(features []string) []string { func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flags { - if getDenyWarnings(compiler) { - flags.RustFlags = append(flags.RustFlags, "-D warnings") + if !Bool(compiler.Properties.No_lint) { + flags.RustFlags = append(flags.RustFlags, config.RustcLintsForDir(ctx.ModuleDir())) } flags.RustFlags = append(flags.RustFlags, compiler.Properties.Flags...) flags.RustFlags = append(flags.RustFlags, compiler.featuresToFlags(compiler.Properties.Features)...) @@ -182,6 +179,7 @@ func (compiler *baseCompiler) compile(ctx ModuleContext, flags Flags, deps PathD func (compiler *baseCompiler) compilerDeps(ctx DepsContext, deps Deps) Deps { deps.Rlibs = append(deps.Rlibs, compiler.Properties.Rlibs...) deps.Dylibs = append(deps.Dylibs, compiler.Properties.Dylibs...) + deps.Rustlibs = append(deps.Rustlibs, compiler.Properties.Rustlibs...) deps.ProcMacros = append(deps.ProcMacros, compiler.Properties.Proc_macros...) deps.StaticLibs = append(deps.StaticLibs, compiler.Properties.Static_libs...) deps.SharedLibs = append(deps.SharedLibs, compiler.Properties.Shared_libs...) @@ -193,17 +191,7 @@ func (compiler *baseCompiler) compilerDeps(ctx DepsContext, deps Deps) Deps { stdlib = stdlib + "_" + ctx.toolchain().RustTriple() } - // This check is technically insufficient - on the host, where - // static linking is the default, if one of our static - // dependencies uses a dynamic library, we need to dynamically - // link the stdlib as well. - if (len(deps.Dylibs) > 0) || ctx.Device() { - // Dynamically linked stdlib - deps.Dylibs = append(deps.Dylibs, stdlib) - } else if ctx.Host() && !ctx.TargetPrimary() { - // Otherwise use the static in-tree stdlib for host secondary arch - deps.Rlibs = append(deps.Rlibs, stdlib+".static") - } + deps.Rustlibs = append(deps.Rustlibs, stdlib) } } return deps @@ -253,7 +241,7 @@ func (compiler *baseCompiler) getStem(ctx ModuleContext) string { } func (compiler *baseCompiler) getStemWithoutSuffix(ctx BaseModuleContext) string { - stem := ctx.baseModuleName() + stem := ctx.ModuleName() if String(compiler.Properties.Stem) != "" { stem = String(compiler.Properties.Stem) } |