summaryrefslogtreecommitdiff
path: root/build_extra/rust/BUILD.gn
diff options
context:
space:
mode:
Diffstat (limited to 'build_extra/rust/BUILD.gn')
-rw-r--r--build_extra/rust/BUILD.gn58
1 files changed, 46 insertions, 12 deletions
diff --git a/build_extra/rust/BUILD.gn b/build_extra/rust/BUILD.gn
index 0889ad840..4aeac67e5 100644
--- a/build_extra/rust/BUILD.gn
+++ b/build_extra/rust/BUILD.gn
@@ -1,23 +1,57 @@
import("rust.gni")
+# Dependencies between third party crates is mapped out here manually. This is
+# not so difficult and having it be tedious to add dependencies might help us
+# avoid dependency hell later on.
+# Versioning for third party rust crates is controlled in //gclient_config.py
+# TODO(ry) Use Cargo for versioning?
+
# By compiling an empty file as crate-type=staticlib we get all the code
# for the rust stdlib, which are not included in the object file outputs
# of other libs.
-rust_component("stdlib") {
- crate_type = "staticlib"
+# TODO(ry) This is not used and maybe should be removed along with empty.rs.
+rust_staticlib("stdlib") {
source_root = "empty.rs"
- if (current_os == "mac") {
- libs = [ "resolv" ]
- }
- if (current_os == "win") {
- libs = [ "userenv.lib" ]
- }
}
+crates = "//third_party/rust_crates"
+
rust_component("libc") {
- source_root = "//third_party/rust_crates/libc/src/lib.rs"
- cfg = [
- "feature=\"default\"",
- "feature=\"use_std\"",
+ source_root = "$crates/libc/src/lib.rs"
+ cfg = [ "feature=\"use_std\"" ]
+}
+
+rust_component("url") {
+ source_root = "$crates/url/src/lib.rs"
+ extern = [
+ ":matches",
+ ":idna",
+ ":percent_encoding",
]
}
+
+rust_component("percent_encoding") {
+ source_root = "$crates/url/percent_encoding/lib.rs"
+}
+
+rust_component("matches") {
+ source_root = "$crates/rust-std-candidates/matches/lib.rs"
+}
+
+rust_component("idna") {
+ source_root = "$crates/url/idna/src/lib.rs"
+ extern = [
+ ":matches",
+ ":unicode_bidi",
+ ":unicode_normalization",
+ ]
+}
+
+rust_component("unicode_bidi") {
+ source_root = "$crates/unicode-bidi/src/lib.rs"
+ extern = [ ":matches" ]
+}
+
+rust_component("unicode_normalization") {
+ source_root = "$crates/unicode-normalization/src/lib.rs"
+}