-
Notifications
You must be signed in to change notification settings - Fork 589
Expand file tree
/
Copy pathBUILD.bazel
More file actions
127 lines (123 loc) · 3.73 KB
/
BUILD.bazel
File metadata and controls
127 lines (123 loc) · 3.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
load("@rules_rust//crate_universe:defs.bzl", "crate", "crates_vendor")
load("@rules_rust//rust:defs.bzl", "rust_static_library")
load("@bazel_skylib//lib:selects.bzl", "selects")
selects.config_setting_group(
name = "linux_x64",
match_all = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
],
)
selects.config_setting_group(
name = "linux_arm64",
match_all = [
"@platforms//os:linux",
"@platforms//cpu:aarch64",
],
)
selects.config_setting_group(
name = "macos_x64",
match_all = [
"@platforms//os:macos",
"@platforms//cpu:x86_64",
],
)
selects.config_setting_group(
name = "macos_arm64",
match_all = [
"@platforms//os:macos",
"@platforms//cpu:aarch64",
],
)
selects.config_setting_group(
name = "win_x64",
match_all = [
"@platforms//os:windows",
"@platforms//cpu:x86_64",
],
)
CARGO_BAZEL = select({
":linux_x64": "@cargo_bazel_linux_x64//file:downloaded",
":linux_arm64": "@cargo_bazel_linux_arm64//file:downloaded",
":macos_x64": "@cargo_bazel_macos_x64//file:downloaded",
":macos_arm64": "@cargo_bazel_macos_arm64//file:downloaded",
":win_x64": "@cargo_bazel_win_x64//file:downloaded.exe",
})
# Generates a repository containing all the crates we reference from our
# rust workspace
# To repin crates: bazel run //rust-deps:crates_vendor -- --repin
crates_vendor(
name = "crates_vendor",
annotations = {
"lolhtml": [crate.annotation(
shallow_since = "1686149015 +0100",
)],
"lol_html": [crate.annotation(
shallow_since = "1686149015 +0100",
)],
},
cargo_bazel = CARGO_BAZEL,
mode = "remote",
packages = {
"lolhtml": crate.spec(
git = "https://github.com/cloudflare/lol-html.git",
rev = "2681dcf0b3e6907111565199df8c43cc9aab7fe8",
),
# Crates used for RTTI parameter extraction
"anyhow": crate.spec(
features = ["default"],
version = "1",
),
"clang-ast": crate.spec(
version = "0.1",
),
"flate2": crate.spec(
version = "1.0.26",
),
"serde": crate.spec(
version = "1.0",
features = ["default", "derive"],
),
"serde_json": crate.spec(
version = "1.0",
features = ["default"]
),
"pico-args": crate.spec(
version = "0.5",
)
},
supported_platform_triples = [
"aarch64-apple-darwin",
"x86_64-apple-darwin",
"aarch64-unknown-linux-gnu",
"x86_64-unknown-linux-gnu",
"x86_64-pc-windows-msvc",
],
# Not needed, we have a well-defined set of supported platforms
generate_target_compatible_with = False,
)
rust_static_library(
name = "rust-deps",
srcs = ["src/lib.rs"],
stamp = -1, # default to bazel --stamp flag
# When stamping is enabled this will be replaced by the corresponding
# value in ./bazel-out/volatile-status.txt
rustc_env = {
"WORKERD_VERSION": "{WORKERD_VERSION}"
},
visibility = ["//visibility:public"],
deps = [
# On Windows, CXX is broken under Bazel (https://github.com/dtolnay/cxx/pull/125).
# Luckily, util.rs and addr2line.rs are only used in the internal build which just targets
# Linux, so we can safely disable compilation of any CXX-using code.
"@crates_vendor//:lolhtml",
],
)
# define the path to the lolhtml headers, this is clunky but allows us to avoid cloning the
# repository twice.
alias(
name = "lol_html_api",
actual = "@crates_vendor__lol_html-1.0.1//:c-api/include/lol_html.h",
tags = ["manual"],
visibility = ["//visibility:public"],
)