Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e81c924f authored by Thiébaud Weksteen's avatar Thiébaud Weksteen
Browse files

Move getEdition to a baseCompiler method

Test: cd build/soong; mma
Test: cd external/rust/; mma
Change-Id: Ide63b2e633e7c4345c6338e107f5d66688e4cf58
parent d118b1c2
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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())
+1 −1
Original line number Diff line number Diff line
@@ -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)