[rust] Migrate to using workspace Use `cargo build` and `cargo test` at the root dir to test all of the rust packages in the membership. Prefer workspace dependencies over single-package dependencies. Consolidate all LICENSE and PATENTS as they apply to all crates in this dir. Test: cargo build && cargo test in rust/ Change-Id: I62e42c0bbd71c0a41db33c98be9bd2ea3530e5ca Reviewed-on: https://bluetooth-review.git.corp.google.com/c/bluetooth/+/1461 Reviewed-by: Dayeong Lee <dayeonglee@google.com>
diff --git a/rust/.gitignore b/rust/.gitignore new file mode 100644 index 0000000..438e2b1 --- /dev/null +++ b/rust/.gitignore
@@ -0,0 +1,17 @@ +# Generated by Cargo +# will have compiled files and executables +debug/ +target/ + +# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries +# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html +Cargo.lock + +# These are backup files generated by rustfmt +**/*.rs.bk + +# MSVC Windows builds of rustc generate these, which store debugging information +*.pdb + +# Vim swap files. +*.swp
diff --git a/rust/Cargo.toml b/rust/Cargo.toml new file mode 100644 index 0000000..405aec0 --- /dev/null +++ b/rust/Cargo.toml
@@ -0,0 +1,27 @@ +# Common workspace for all rust libs +[workspace] +members = ["bt-*"] +exclude = ["target"] +resolver = "2" + +[workspace.package] +license = "BSD-2-Clause" +edition = "2021" + +[workspace.dependencies] + +## Local path dependencies (keep sorted) +bt-bass = { path = "bt-bass" } +bt-common = { path = "bt-common" } +bt-gatt = { path = "bt-gatt" } +bt-pacs = { path = "bt-pacs" } + +## External dependencies +assert_matches = "1.5.0" +futures = "0.3.19" # 0.3.19 in Fuchsia +lazy_static = "1" +parking_lot = "0.12.0" # 0.12.0 in Fuchsia +pretty_assertions = "1" +thiserror = "1.0.23" +tracing = "0.1.40" +uuid = { version = "1.4.1", features = ["macro-diagnostics"] }
diff --git a/rust/bt-gatt/LICENSE b/rust/LICENSE similarity index 100% rename from rust/bt-gatt/LICENSE rename to rust/LICENSE
diff --git a/rust/bt-gatt/PATENTS b/rust/PATENTS similarity index 100% rename from rust/bt-gatt/PATENTS rename to rust/PATENTS
diff --git a/rust/bt-bass/Cargo.toml b/rust/bt-bass/Cargo.toml index 74f3ba8..81e18a2 100644 --- a/rust/bt-bass/Cargo.toml +++ b/rust/bt-bass/Cargo.toml
@@ -1,13 +1,13 @@ [package] name = "bt-bass" version = "0.0.1" -edition = "2021" -license = "BSD-2-Clause" +edition.workspace = true +license.workspace = true [dependencies] -bt-common = { path = "../bt-common" } -bt-gatt = { path = "../bt-gatt", features = ["test-utils"] } -futures = "0.3.28" -parking_lot = "0.12.1" -thiserror = "1.0" -tracing = "0.1.40" +bt-common.workspace = true +bt-gatt = { workspace = true , features = ["test-utils"] } +futures.workspace = true +parking_lot.workspace = true +thiserror.workspace = true +tracing.workspace = true
diff --git a/rust/bt-bass/LICENSE b/rust/bt-bass/LICENSE deleted file mode 100644 index e5de3c8..0000000 --- a/rust/bt-bass/LICENSE +++ /dev/null
@@ -1,24 +0,0 @@ -Copyright 2023 Google LLC - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/rust/bt-bass/PATENTS b/rust/bt-bass/PATENTS deleted file mode 100644 index 3a21f11..0000000 --- a/rust/bt-bass/PATENTS +++ /dev/null
@@ -1,22 +0,0 @@ -Additional IP Rights Grant (Patents) - -"This implementation" means the copyrightable works distributed by -Google as part of this crate - -Google hereby grants to you a perpetual, worldwide, non-exclusive, -no-charge, royalty-free, irrevocable (except as stated in this -section) patent license to make, have made, use, offer to sell, sell, -import, transfer, and otherwise run, modify and propagate the contents -of this implementation, where such license applies only to -those patent claims, both currently owned by Google and acquired in -the future, licensable by Google that are necessarily infringed by -this implementation. This grant does not include claims that would be -infringed only as a consequence of further modification of this -implementation. If you or your agent or exclusive licensee institute -or order or agree to the institution of patent litigation or any other -patent enforcement activity against any entity (including a -cross-claim or counterclaim in a lawsuit) alleging that this -implementation constitutes direct or contributory patent -infringement, or inducement of patent infringement, then any patent -rights granted to you under this License for this implementation -shall terminate as of the date such litigation is filed.
diff --git a/rust/bt-common/Cargo.toml b/rust/bt-common/Cargo.toml index 874319b..3006f41 100644 --- a/rust/bt-common/Cargo.toml +++ b/rust/bt-common/Cargo.toml
@@ -1,13 +1,10 @@ [package] name = "bt-common" version = "0.0.1" -edition = "2021" -license = "BSD-2-Clause" +edition.workspace = true +license.workspace = true [dependencies] -thiserror = "1.0" -lazy_static = "1" - -[dependencies.uuid] -version = "1.4.1" -features = ["macro-diagnostics"] +thiserror.workspace = true +lazy_static.workspace = true +uuid.workspace = true
diff --git a/rust/bt-common/LICENSE b/rust/bt-common/LICENSE deleted file mode 100644 index e5de3c8..0000000 --- a/rust/bt-common/LICENSE +++ /dev/null
@@ -1,24 +0,0 @@ -Copyright 2023 Google LLC - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/rust/bt-common/PATENTS b/rust/bt-common/PATENTS deleted file mode 100644 index 3a21f11..0000000 --- a/rust/bt-common/PATENTS +++ /dev/null
@@ -1,22 +0,0 @@ -Additional IP Rights Grant (Patents) - -"This implementation" means the copyrightable works distributed by -Google as part of this crate - -Google hereby grants to you a perpetual, worldwide, non-exclusive, -no-charge, royalty-free, irrevocable (except as stated in this -section) patent license to make, have made, use, offer to sell, sell, -import, transfer, and otherwise run, modify and propagate the contents -of this implementation, where such license applies only to -those patent claims, both currently owned by Google and acquired in -the future, licensable by Google that are necessarily infringed by -this implementation. This grant does not include claims that would be -infringed only as a consequence of further modification of this -implementation. If you or your agent or exclusive licensee institute -or order or agree to the institution of patent litigation or any other -patent enforcement activity against any entity (including a -cross-claim or counterclaim in a lawsuit) alleging that this -implementation constitutes direct or contributory patent -infringement, or inducement of patent infringement, then any patent -rights granted to you under this License for this implementation -shall terminate as of the date such litigation is filed.
diff --git a/rust/bt-gatt/Cargo.toml b/rust/bt-gatt/Cargo.toml index 930c7e9..24d4084 100644 --- a/rust/bt-gatt/Cargo.toml +++ b/rust/bt-gatt/Cargo.toml
@@ -1,21 +1,19 @@ [package] name = "bt-gatt" version = "0.0.1" -edition = "2021" -license = "BSD-2-Clause" +edition.workspace = true +license.workspace = true [features] default = [] test-utils = [] [dependencies] -thiserror = "1.0.23" -futures = "0.3.19" -parking_lot = "0.12.1" - -### in-tree dependencies -bt-common = { path = "../bt-common" } +bt-common.workspace = true +thiserror.workspace = true +futures.workspace = true +parking_lot.workspace = true [dev-dependencies] -assert_matches = "1.5.0" +assert_matches.workspace = true bt-gatt = { path = ".", features = ["test-utils"] }
diff --git a/rust/bt-pacs/Cargo.toml b/rust/bt-pacs/Cargo.toml index 9a471b2..0fd767d 100644 --- a/rust/bt-pacs/Cargo.toml +++ b/rust/bt-pacs/Cargo.toml
@@ -2,14 +2,13 @@ name = "bt-pacs" description = "Client and server library for the Published Audio Capabilities Service" version = "0.0.1" -edition = "2021" -license = "BSD-2-Clause" +edition.workspace = true +license.workspace = true [dependencies] - ### In-tree dependencies -bt-gatt = { path = "../bt-gatt" } -bt-common = { path = "../bt-common" } +bt-gatt.workspace = true +bt-common.workspace = true [dev-dependencies] -pretty_assertions = "1" +pretty_assertions.workspace = true
diff --git a/rust/bt-pacs/LICENSE b/rust/bt-pacs/LICENSE deleted file mode 100644 index e5de3c8..0000000 --- a/rust/bt-pacs/LICENSE +++ /dev/null
@@ -1,24 +0,0 @@ -Copyright 2023 Google LLC - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/rust/bt-pacs/PATENTS b/rust/bt-pacs/PATENTS deleted file mode 100644 index 3a21f11..0000000 --- a/rust/bt-pacs/PATENTS +++ /dev/null
@@ -1,22 +0,0 @@ -Additional IP Rights Grant (Patents) - -"This implementation" means the copyrightable works distributed by -Google as part of this crate - -Google hereby grants to you a perpetual, worldwide, non-exclusive, -no-charge, royalty-free, irrevocable (except as stated in this -section) patent license to make, have made, use, offer to sell, sell, -import, transfer, and otherwise run, modify and propagate the contents -of this implementation, where such license applies only to -those patent claims, both currently owned by Google and acquired in -the future, licensable by Google that are necessarily infringed by -this implementation. This grant does not include claims that would be -infringed only as a consequence of further modification of this -implementation. If you or your agent or exclusive licensee institute -or order or agree to the institution of patent litigation or any other -patent enforcement activity against any entity (including a -cross-claim or counterclaim in a lawsuit) alleging that this -implementation constitutes direct or contributory patent -infringement, or inducement of patent infringement, then any patent -rights granted to you under this License for this implementation -shall terminate as of the date such litigation is filed.