From e81c924f0c70b07fdfac86ef1475622ee6444c36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thi=C3=A9baud=20Weksteen?= Date: Mon, 3 Aug 2020 10:46:28 +0200 Subject: [PATCH] Move getEdition to a baseCompiler method Test: cd build/soong; mma Test: cd external/rust/; mma Change-Id: Ide63b2e633e7c4345c6338e107f5d66688e4cf58 --- rust/compiler.go | 4 ++-- rust/project_json.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rust/compiler.go b/rust/compiler.go index 040219dc4..83a1f27cc 100644 --- a/rust/compiler.go +++ b/rust/compiler.go @@ -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()) diff --git a/rust/project_json.go b/rust/project_json.go index a50e73a95..24e769175 100644 --- a/rust/project_json.go +++ b/rust/project_json.go @@ -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)