Move getEdition to a baseCompiler method

Test: cd build/soong; mma
Test: cd external/rust/; mma
Change-Id: Ide63b2e633e7c4345c6338e107f5d66688e4cf58
This commit is contained in:
Thiébaud Weksteen 2020-08-03 10:46:28 +02:00
parent d118b1c2b7
commit e81c924f0c
2 changed files with 3 additions and 3 deletions

View File

@ -24,7 +24,7 @@ import (
"android/soong/rust/config"
)
func getEdition(compiler *baseCompiler) string {
func (compiler *baseCompiler) edition() string {
return proptools.StringDefault(compiler.Properties.Edition, config.DefaultEdition)
}
@ -149,7 +149,7 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flag
}
flags.RustFlags = append(flags.RustFlags, compiler.Properties.Flags...)
flags.RustFlags = append(flags.RustFlags, compiler.featuresToFlags(compiler.Properties.Features)...)
flags.RustFlags = append(flags.RustFlags, "--edition="+getEdition(compiler))
flags.RustFlags = append(flags.RustFlags, "--edition="+compiler.edition())
flags.LinkFlags = append(flags.LinkFlags, compiler.Properties.Ld_flags...)
flags.GlobalRustFlags = append(flags.GlobalRustFlags, config.GlobalRustFlags...)
flags.GlobalRustFlags = append(flags.GlobalRustFlags, ctx.toolchain().ToolchainRustFlags())

View File

@ -116,7 +116,7 @@ func appendLibraryAndDeps(ctx android.SingletonContext, project *rustProjectJson
crate := rustProjectCrate{Deps: make([]rustProjectDep, 0), Cfgs: make([]string, 0)}
src := rustLib.baseCompiler.Properties.Srcs[0]
crate.RootModule = path.Join(ctx.ModuleDir(rModule), src)
crate.Edition = getEdition(rustLib.baseCompiler)
crate.Edition = rustLib.baseCompiler.edition()
deps := make(map[string]int)
mergeDependencies(ctx, project, knownCrates, module, &crate, deps)