Repository navigation
Expand file tree
/
Copy pathsdk_targets.bzl
More file actions
109 lines (101 loc) · 3.66 KB
/
Copy pathsdk_targets.bzl
File metadata and controls
109 lines (101 loc) · 3.66 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
"Defines the Rust SDK targets shared by its independent and runtime-local graphs."
load("@rules_rust//cargo:defs.bzl", "cargo_build_script")
load("@rules_rust//rust:defs.bzl", "rust_library")
load("//src/sdk/rust/bazel/crates:defs.bzl", "aliases", "all_crate_deps", "crate_deps")
_LOCAL_RUNTIME_DEPS = [
"@vendor__base64-0.23.1//:base64",
"@vendor__bytes-1.12.1//:bytes",
"@vendor__dirs-7.0.0//:dirs",
"@vendor__futures-util-0.3.34//:futures_util",
"@vendor__getrandom-0.4.3//:getrandom",
"@vendor__http-1.5.0//:http",
"@vendor__indexmap-2.14.2//:indexmap",
"@vendor__libloading-0.9.0//:libloading",
"@vendor__parking_lot-0.12.5//:parking_lot",
"@vendor__regex-1.13.1//:regex",
"@vendor__serde-1.0.229//:serde",
"@vendor__serde_json-1.0.154//:serde_json",
"@vendor//tokio",
"@vendor__tokio-stream-0.1.19//:tokio_stream",
"@vendor__tokio-util-0.7.20//:tokio_util",
"@vendor__tracing-0.1.44//:tracing",
"@vendor__uuid-1.28.0//:uuid",
] + select({
"@rules_rust//rust/platform:aarch64-pc-windows-msvc": [
"@vendor__windows-sys-0.61.2//:windows_sys",
],
"@rules_rust//rust/platform:x86_64-pc-windows-msvc": [
"@vendor__windows-sys-0.61.2//:windows_sys",
],
"//conditions:default": [],
})
def sdk_targets():
"""Declares the standalone SDK and CLI-specific local-runtime libraries."""
native.exports_files([
".rustfmt.toml",
"Cargo.lock",
"Cargo.toml",
"rust-toolchain.toml",
])
sdk_features = [
"bundled-cli",
"bundled-in-process",
"derive",
"in-process",
"local-runtime",
"network-forwarding",
"runtime",
"test-support",
]
cargo_build_script(
name = "build_script",
srcs = [
"build.rs",
"src/cache_paths.rs",
] + native.glob(["build/**/*.rs"]),
aliases = aliases(build = True),
build_script_env = {
"COPILOT_SKIP_CLI_DOWNLOAD": "1",
},
crate_features = sdk_features,
crate_name = "build_script_build",
crate_root = "build.rs",
# crate_universe can classify shared build/dev dependencies as dev-only.
deps = all_crate_deps(build = True) + crate_deps(["sha2", "ureq"]),
)
rust_library(
name = "github-copilot-sdk",
srcs = native.glob(["src/**/*.rs"]),
aliases = {
"@sdk_vendor//libloading-0.9.0": "libloading",
},
compile_data = ["README.md"],
crate_features = sdk_features,
crate_name = "github_copilot_sdk",
crate_root = "src/lib.rs",
proc_macro_deps = all_crate_deps(proc_macro = True),
visibility = ["//visibility:public"],
deps = [":build_script"] + all_crate_deps() + crate_deps(["schemars"]),
)
rust_library(
name = "github-copilot-sdk-local-runtime",
srcs = native.glob(["src/**/*.rs"]),
compile_data = ["README.md"],
crate_features = [
"in-process",
"local-runtime",
"runtime",
],
crate_name = "github_copilot_sdk",
crate_root = "src/lib.rs",
proc_macro_deps = ["@vendor__async-trait-0.1.92//:async_trait"],
rustc_flags = [
"--check-cfg=cfg(docsrs)",
"--check-cfg=cfg(has_bundled_cli)",
"--check-cfg=cfg(has_extracted_cli)",
"--check-cfg=cfg(test)",
'--check-cfg=cfg(feature,values("bundled-cli","bundled-in-process","derive","in-process","local-runtime","network-forwarding","runtime","test-support"))',
],
visibility = ["//visibility:public"],
deps = _LOCAL_RUNTIME_DEPS,
)