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
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user