diff options
author | 2024-05-24 20:52:27 +0000 | |
---|---|---|
committer | 2024-05-24 20:52:27 +0000 | |
commit | c6b5fdbc5c90c0b7ee9a65c4b9782f982bedb6f0 (patch) | |
tree | f3b2e835fca0723b47d0542cce53fed39487b1f9 /rust/compiler.go | |
parent | ce15fb72bf7127fbc63230ebb52d907d446c1085 (diff) | |
parent | fdec8723d574daf54b956cc0f6dc879087da70a6 (diff) |
Merge "Convert some properties to Configurable properties" into main
Diffstat (limited to 'rust/compiler.go')
-rw-r--r-- | rust/compiler.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/rust/compiler.go b/rust/compiler.go index efc3deef3..a2546a194 100644 --- a/rust/compiler.go +++ b/rust/compiler.go @@ -197,7 +197,7 @@ type BaseCompilerProperties struct { Features []string `android:"arch_variant"` // list of configuration options to enable for this crate. To enable features, use the "features" property. - Cfgs []string `android:"arch_variant"` + Cfgs proptools.Configurable[[]string] `android:"arch_variant"` // specific rust edition that should be used if the default version is not desired Edition *string `android:"arch_variant"` @@ -338,7 +338,7 @@ func (compiler *baseCompiler) compilerProps() []interface{} { } func cfgsToFlags(cfgs []string) []string { - flags := []string{} + flags := make([]string, 0, len(cfgs)) for _, cfg := range cfgs { flags = append(flags, "--cfg '"+cfg+"'") } @@ -385,8 +385,9 @@ func CommonDefaultCfgFlags(flags Flags, vendor bool, product bool) Flags { func (compiler *baseCompiler) cfgFlags(ctx ModuleContext, flags Flags) Flags { flags = CommonDefaultCfgFlags(flags, ctx.RustModule().InVendor(), ctx.RustModule().InProduct()) - flags.RustFlags = append(flags.RustFlags, cfgsToFlags(compiler.Properties.Cfgs)...) - flags.RustdocFlags = append(flags.RustdocFlags, cfgsToFlags(compiler.Properties.Cfgs)...) + cfgFlags := cfgsToFlags(compiler.Properties.Cfgs.GetOrDefault(ctx, nil)) + flags.RustFlags = append(flags.RustFlags, cfgFlags...) + flags.RustdocFlags = append(flags.RustdocFlags, cfgFlags...) return flags } |