rust-project.json: Set sysroot in generated file
Bug: 372634041
Test: Go-to-definition for `.expect()` ends up in the prebuilt sources
Change-Id: I4b86b2e1714f1835f8be71850d3fea4b1b815853
diff --git a/rust/project_json.go b/rust/project_json.go
index 6cf492b..6e8cebe 100644
--- a/rust/project_json.go
+++ b/rust/project_json.go
@@ -19,6 +19,7 @@
"fmt"
"android/soong/android"
+ "android/soong/rust/config"
)
// This singleton collects Rust crate definitions and generates a JSON file
@@ -55,7 +56,8 @@
}
type rustProjectJson struct {
- Crates []rustProjectCrate `json:"crates"`
+ Sysroot string `json:"sysroot"`
+ Crates []rustProjectCrate `json:"crates"`
}
// crateInfo is used during the processing to keep track of the known crates.
@@ -203,6 +205,8 @@
return
}
+ singleton.project.Sysroot = config.RustPath(ctx)
+
singleton.knownCrates = make(map[string]crateInfo)
ctx.VisitAllModules(func(module android.Module) {
singleton.appendCrateAndDependencies(ctx, module)