diff options
author | 2021-09-23 11:50:33 -0400 | |
---|---|---|
committer | 2021-09-23 12:21:04 -0400 | |
commit | 67eada34db07986abde08d652cd249c977d4a55c (patch) | |
tree | e4b6e43db5c655ea496f9f0ff9ace05d702b2d80 /rust/rust.go | |
parent | 1b15345ac932793054a5d8e65cf4862ae7c12e49 (diff) |
rust: Refactor cfg and feature flag calculation
Move the cfg and feature flag calculation out of compilerFlags so that
it's a separate step.
The previous arrangement resulted in overridden compilerFlags which
must to set any additional cfgs/features before calling the base.
This is a bit confusing and undocumented behavior, so instead break
it out into a separate call that can itself be overriden.
Bug: N/A
Test: Soong tests pass
Change-Id: I28e4f707b3b3ca6eb621b7613c3737817f877bb8
Diffstat (limited to 'rust/rust.go')
-rw-r--r-- | rust/rust.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/rust/rust.go b/rust/rust.go index 0cd299dc1..0a7d68dee 100644 --- a/rust/rust.go +++ b/rust/rust.go @@ -436,6 +436,8 @@ type RustLibrary struct { type compiler interface { initialize(ctx ModuleContext) compilerFlags(ctx ModuleContext, flags Flags) Flags + cfgFlags(ctx ModuleContext, flags Flags) Flags + featureFlags(ctx ModuleContext, flags Flags) Flags compilerProps() []interface{} compile(ctx ModuleContext, flags Flags, deps PathDeps) android.Path compilerDeps(ctx DepsContext, deps Deps) Deps @@ -847,8 +849,11 @@ func (mod *Module) GenerateAndroidBuildActions(actx android.ModuleContext) { Toolchain: toolchain, } + // Calculate rustc flags if mod.compiler != nil { flags = mod.compiler.compilerFlags(ctx, flags) + flags = mod.compiler.cfgFlags(ctx, flags) + flags = mod.compiler.featureFlags(ctx, flags) } if mod.coverage != nil { flags, deps = mod.coverage.flags(ctx, flags, deps) |