summaryrefslogtreecommitdiff
path: root/rust/project_json.go
diff options
context:
space:
mode:
authorThiƩbaud Weksteen <tweek@google.com>2021-03-25 09:26:07 +0100
committerThiƩbaud Weksteen <tweek@google.com>2021-03-25 09:59:49 +0100
commite8b0ee73f4c2545aa0597a270cf6c56fdb60b1ab (patch)
tree25a74b647725038762e9b41b03f3241e0ec9c836 /rust/project_json.go
parenta1063c09f6f47b68d946ff61cef71692b19d48e5 (diff)
rust: Add features list to rust_project.json
Bug: 183679729 Test: SOONG_GEN_RUST_PROJECT=1 m nothing Test: manually check v1 feature resolution for libprofcollectd Change-Id: Ib59b63372865f7f4545fe327e92d1642d76ce9c9
Diffstat (limited to 'rust/project_json.go')
-rw-r--r--rust/project_json.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/rust/project_json.go b/rust/project_json.go
index 8d3d250ce..c28bc7b76 100644
--- a/rust/project_json.go
+++ b/rust/project_json.go
@@ -49,7 +49,7 @@ type rustProjectCrate struct {
RootModule string `json:"root_module"`
Edition string `json:"edition,omitempty"`
Deps []rustProjectDep `json:"deps"`
- Cfgs []string `json:"cfgs"`
+ Cfg []string `json:"cfg"`
Env map[string]string `json:"env"`
}
@@ -230,7 +230,7 @@ func (singleton *projectGeneratorSingleton) addCrate(ctx android.SingletonContex
RootModule: rootModule,
Edition: comp.edition(),
Deps: make([]rustProjectDep, 0),
- Cfgs: make([]string, 0),
+ Cfg: make([]string, 0),
Env: make(map[string]string),
}
@@ -238,6 +238,10 @@ func (singleton *projectGeneratorSingleton) addCrate(ctx android.SingletonContex
crate.Env["OUT_DIR"] = comp.CargoOutDir().String()
}
+ for _, feature := range comp.Properties.Features {
+ crate.Cfg = append(crate.Cfg, "feature=\""+feature+"\"")
+ }
+
deps := make(map[string]int)
singleton.mergeDependencies(ctx, rModule, &crate, deps)