summaryrefslogtreecommitdiff
path: root/rust/project_json.go
diff options
context:
space:
mode:
author Matthew Maurer <mmaurer@google.com> 2024-11-01 18:38:58 +0000
committer Matthew Maurer <mmaurer@google.com> 2024-11-04 17:15:28 +0000
commit5524b5b7e9b166196901e2faa3e3dfc71849b05d (patch)
treea018eace8ac9e60ebe35443ba89f904f76ea44d6 /rust/project_json.go
parent2b3da4636af97ef6fe349d503473db6f60d02550 (diff)
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
Diffstat (limited to 'rust/project_json.go')
-rw-r--r--rust/project_json.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/rust/project_json.go b/rust/project_json.go
index 6cf492b49..6e8cebeed 100644
--- a/rust/project_json.go
+++ b/rust/project_json.go
@@ -19,6 +19,7 @@ import (
"fmt"
"android/soong/android"
+ "android/soong/rust/config"
)
// This singleton collects Rust crate definitions and generates a JSON file
@@ -55,7 +56,8 @@ type rustProjectCrate struct {
}
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 @@ func (singleton *projectGeneratorSingleton) GenerateBuildActions(ctx android.Sin
return
}
+ singleton.project.Sysroot = config.RustPath(ctx)
+
singleton.knownCrates = make(map[string]crateInfo)
ctx.VisitAllModules(func(module android.Module) {
singleton.appendCrateAndDependencies(ctx, module)