summaryrefslogtreecommitdiff
path: root/rust/project_json_test.go
diff options
context:
space:
mode:
authorThiƩbaud Weksteen <tweek@google.com>2021-02-25 16:30:57 +0100
committerThiƩbaud Weksteen <tweek@google.com>2021-03-15 08:13:20 +0000
commitee6a89ba440aedbf7f1c89333f5046418e6e3459 (patch)
treecd1cf61bbecbbbf14605233ffcf02b133d322558 /rust/project_json_test.go
parentaa52d66cd572d2cc62573078c02cad062e7ddeb5 (diff)
Export OUT_DIR variable to rust-project.json
This variable is required by rust-analyzer to correctly process crates that uses the include!(concat!(env!("OUT_DIR"), ...)) pattern. Adds an initialize method to baseCompiler to save the computed path for this directory. It is not possible to use the BeginMutator as the BaseModuleContext does not contain enough information to use PathForModuleOut. Bug: 175004835 Test: SOONG_GEN_RUST_PROJECT=1 m nothing; inspect rust-project.json Change-Id: If47b3832d3cca5712ae87773c174a61f5ee27bf8
Diffstat (limited to 'rust/project_json_test.go')
-rw-r--r--rust/project_json_test.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/rust/project_json_test.go b/rust/project_json_test.go
index ba66215c5..289bcb81d 100644
--- a/rust/project_json_test.go
+++ b/rust/project_json_test.go
@@ -190,8 +190,8 @@ func TestProjectJsonBindGen(t *testing.T) {
}
}
}
- // Check that liba depends on libbindings1
if strings.Contains(rootModule, "d/src/lib.rs") {
+ // Check that libd depends on libbindings1
found := false
for _, depName := range validateDependencies(t, crate) {
if depName == "bindings1" {
@@ -200,8 +200,17 @@ func TestProjectJsonBindGen(t *testing.T) {
}
}
if !found {
- t.Errorf("liba does not depend on libbindings1: %v", crate)
+ t.Errorf("libd does not depend on libbindings1: %v", crate)
}
+ // Check that OUT_DIR is populated.
+ env, ok := crate["env"].(map[string]interface{})
+ if !ok {
+ t.Errorf("libd does not have its environment variables set: %v", crate)
+ }
+ if _, ok = env["OUT_DIR"]; !ok {
+ t.Errorf("libd does not have its OUT_DIR set: %v", env)
+ }
+
}
}
}