aboutsummaryrefslogtreecommitdiff
path: root/rust/project_json_test.go
Commit message (Collapse)AuthorAgeFilesLines
* Include proc macro crates in rust-project.jsonSeth Moore2021-10-061-0/+52
| | | | | | | | | | These crates were skipped before, leaving dependencies missing in rust-project.json. Include them and mark them as `"is_proc_macro": true` so that rust-analyzer can process them. Fixes: 202290038 Test: SOONG_GEN_RUST_PROJECT=1 m nothing Change-Id: Ia80e6f5e2f56a76608ba057075600e6b4424281b
* Rename BuildDir and NinjaBuildDir.Lukacs T. Berki2021-08-271-1/+1
| | | | | | | | | | These are just out/ and out/soong/ and the old names were quite confusing. Test: Presubmits. Merged-In: I999ca62162062f27e449f83ffb00fa580d4065b8 Merged-In: I2fcd80a9e376a6842a06aa104a9f6f5c5e16f8c7 Change-Id: Ib481d2aac40df8da1b74174dc8ec576c1cb48be0
* Replace android.BuildOs with Config.BuildOSColin Cross2021-07-201-2/+4
| | | | | | | | | Replace the android.BuildOs constant with Config.BuildOS so that it can vary based on the product config. Bug: 190084016 Test: all Soong tests Change-Id: Ia67f872d8b2ab788747a22e3a9659dc21c9775cd
* Remove FixturePreparer.Extend()Paul Duffin2021-04-011-3/+4
| | | | | | | | Use GroupFixturePreparers instead. Bug: 182885307 Test: m nothing Change-Id: Idc01d3cc5a57576a4cf417e9105d1ab851126e10
* rust: Add features list to rust_project.jsonThiébaud Weksteen2021-03-251-0/+36
| | | | | | | Bug: 183679729 Test: SOONG_GEN_RUST_PROJECT=1 m nothing Test: manually check v1 feature resolution for libprofcollectd Change-Id: Ib59b63372865f7f4545fe327e92d1642d76ce9c9
* Support test fixtures in rust packagePaul Duffin2021-03-231-5/+4
| | | | | | | | | | | | Replaces the rust specific rustTestCtx mechanism with the general test fixtures mechanism as converting it to use preparers was not possible. Also, removes usages of the buildDir variable and removes it as it is no longer needed. Bug: 181070625 Test: m nothing Change-Id: I0176a7b6fb2d390ae23693f1e198da5124b4be63
* Export OUT_DIR variable to rust-project.jsonThiébaud Weksteen2021-03-151-2/+11
| | | | | | | | | | | | | | 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
* Add dependencies for source-generated cratesThiébaud Weksteen2020-12-071-10/+23
| | | | | | | | | | | | | | | | | | When using SourceProviders, the dependency tree does not include directly the source variant, only the built variant. For instance: liba --> libbingena_rlib --> libbingena_source However, libbindgena_rlib did not have a source associated with the module, and was therefore not added as a dependency. Modify the logic so that a SourceProvider library will find the right variant and always have a source defined. Adds display_name fields to the crate description to ease debugging. Test: rust-analyzer analysis-stats . Bug: 174158339 Change-Id: Id65708d57cd176f7e1da353f4a5f7ad65b003090
* Includes rust_binary in rust-project.jsonThiébaud Weksteen2020-12-031-27/+68
| | | | | | | | | | Until now, only rust_library (and their derivatives such as rust_library_host) were reported in rust-project.json. Adds support for rust_binary and rust_tests. Bug: 174743191 Test: Validate auto-completion in keystore2_main.rs Change-Id: I17b3ec29e233f29b7abd16dc771070ada48d17fb
* Ignore variant dependencies in rust-project.jsonThiébaud Weksteen2020-11-251-0/+16
| | | | | | | | | Source-generated library modules will have a dependency on the source variant. This creates a cycle in the dependency graph which triggers a warning from rust-analyzer. Ignore this type of dependency. Test: m nothing Change-Id: I13365093ebb88b00f6a72734b01114ec3e9a320e
* rust: refactor tests setupThiébaud Weksteen2020-10-081-30/+11
| | | | | | | | | Move to a builder pattern to increase flexibility when generating the test configuration. The testRust, testRustCov and testRustError are kept as main entry points for standard tests. Add documentation. Test: m nothing Change-Id: I891bec982ff2d65413f150d2395edf0fb0d68a43
* rust: add darwin as host archThiébaud Weksteen2020-09-301-3/+4
| | | | | | Bug: 169739272 Test: m nothing Change-Id: I3ef2a3dd7e80b9fe47edb6eb04ed9d37e8d58096
* rust: Add ref to generated sources (aidl, bindgen)Thiébaud Weksteen2020-09-291-5/+34
| | | | | | | | Test: SOONG_GEN_RUST_PROJECT=1 m nothing; Edit system/security/keystore2/selinux/src/lib.rs; Check name resolution in IDE. Bug: 168263887 Change-Id: Icbbf176c4355c3043807ce3fe0c3967c4a1374e2
* rust: validate existence of library sourceThiébaud Weksteen2020-08-061-13/+77
| | | | | | | | | | | | While rust_bindgen modules may be interpreted as libraries, they do not have a reference to the generated source until bindgen has been executed. For now, ignore these modules. Update the unit tests to cover the rust_bindgen case. Test: SOONG_GEN_RUST_PROJECT=1 m nothing Bug: 162881856 Change-Id: I329d0fe3d94b77d395c3684f55ab01544ff7c18f
* rust: handle modules with same crate_nameThiébaud Weksteen2020-08-061-0/+52
| | | | | | | | | | crate_name do not need to be unique. A library may depend on two different versions of the same crate. Use the module name instead of the crate name when indexing the modules for rust-project.json. Test: SOONG_GEN_RUST_PROJECT=1 m nothing Bug: 162896400 Change-Id: I8af9115b106fda2bed5b9fe96059cc29a33ac247
* Revert "rust: validate existence of library source"Thiébaud Weksteen2020-08-061-77/+13
| | | | | | | | | | | Revert submission 1391076 Reason for revert: Broken downstream Darwin build (b/162975597) Reverted Changes: I275f04639:rust: handle modules with same crate_name Ie736d7ebb:rust: validate existence of library source Change-Id: I1732d50a08546864f17cd826c8af574c1064c670
* Revert "rust: handle modules with same crate_name"Thiébaud Weksteen2020-08-061-52/+0
| | | | | | | | | | | Revert submission 1391076 Reason for revert: Broken downstream Darwin build (b/162975597) Reverted Changes: I275f04639:rust: handle modules with same crate_name Ie736d7ebb:rust: validate existence of library source Change-Id: I995923153c11db26b4af985f2eabe94912fb04d3
* rust: handle modules with same crate_nameThiébaud Weksteen2020-08-051-0/+52
| | | | | | | | | | crate_name do not need to be unique. A library may depend on two different versions of the same crate. Use the module name instead of the crate name when indexing the modules for rust-project.json. Test: SOONG_GEN_RUST_PROJECT=1 m nothing Bug: 162896400 Change-Id: I275f04639ef05f2b649c30168046e13b2efcacb9
* rust: validate existence of library sourceThiébaud Weksteen2020-08-051-13/+77
| | | | | | | | | | | | While rust_bindgen modules may be interpreted as libraries, they do not have a reference to the generated source until bindgen has been executed. For now, ignore these modules. Update the unit tests to cover the rust_bindgen case. Test: SOONG_GEN_RUST_PROJECT=1 m nothing Bug: 162881856 Change-Id: Ie736d7ebb115f2c1f9a90be006c972ce24265c6a
* Add rust-project.json generatorThiébaud Weksteen2020-06-111-0/+55
Because we are not relying on Cargo.toml for our crate dependencies, we need to provide a structured file to rust-analyzer which describes the locations of the crates. Add a generator for that purpose, similarly to cc/compdb and cc/ccdeps. Bug: 156395307 Test: SOONG_GEN_RUST_PROJECT=1 m nothing && \ cat ${ANDROID_BUILD_TOP}/out/soong/rust-project.json Change-Id: I46efe0adeddae281eaf86707504c3aa15b5e80b8