-
Notifications
You must be signed in to change notification settings - Fork 293
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[nfc] wd_rust_capnp_library and wd_capnp_library (#2794)
wd_capnp_library generates both c++ and rust versions
- Loading branch information
Showing
15 changed files
with
383 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
load("//:build/wd_cc_capnp_library.bzl", "wd_cc_capnp_library") | ||
load("//:build/wd_rust_capnp_library.bzl", "wd_rust_capnp_library") | ||
|
||
def wd_capnp_library( | ||
src, | ||
deps = [], | ||
tags = [], | ||
target_compatible_with = None, | ||
visibility = ["//visibility:public"]): | ||
"""Generates capnp library for multiple languages. | ||
For a given file-name.capnp it will produce: | ||
- `file-name_capnp` c++ library | ||
- `file-name_capnp_rust` rust library | ||
""" | ||
base_name = src.removesuffix(".capnp") | ||
|
||
wd_cc_capnp_library( | ||
name = base_name + "_capnp", | ||
visibility = visibility, | ||
deps = deps, | ||
srcs = [src], | ||
tags = ["manual"] + tags, | ||
target_compatible_with = target_compatible_with, | ||
) | ||
|
||
rust_deps = [dep + "_rust" if dep.endswith("_capnp") else dep for dep in deps] | ||
|
||
wd_rust_capnp_library( | ||
name = base_name + "_capnp_rust", | ||
crate_name = base_name.replace("-", "_") + "_capnp", | ||
visibility = visibility, | ||
deps = rust_deps, | ||
srcs = [src], | ||
tags = ["manual"] + tags, | ||
target_compatible_with = target_compatible_with, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
"""wd_rust_capnp_library definition""" | ||
|
||
load("@capnp-cpp//src/capnp:rust_capnp_library.bzl", "rust_capnp_library") | ||
|
||
def wd_rust_capnp_library(**kwargs): | ||
"""Wrapper for rust_capnp_library that sets common attributes | ||
""" | ||
rust_capnp_library( | ||
src_prefix = "src", | ||
**kwargs | ||
) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
############################################################################### | ||
# @generated | ||
# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To | ||
# regenerate this file, run the following: | ||
# | ||
# bazel run @//deps/rust:crates_vendor | ||
############################################################################### | ||
|
||
load("@rules_rust//rust:defs.bzl", "rust_library") | ||
|
||
package(default_visibility = ["//visibility:public"]) | ||
|
||
rust_library( | ||
name = "capnp", | ||
srcs = glob( | ||
include = ["**/*.rs"], | ||
allow_empty = True, | ||
), | ||
compile_data = glob( | ||
include = ["**"], | ||
allow_empty = True, | ||
exclude = [ | ||
"**/* *", | ||
".tmp_git_root/**/*", | ||
"BUILD", | ||
"BUILD.bazel", | ||
"WORKSPACE", | ||
"WORKSPACE.bazel", | ||
], | ||
), | ||
crate_features = [ | ||
"alloc", | ||
"default", | ||
"std", | ||
], | ||
crate_root = "src/lib.rs", | ||
edition = "2021", | ||
rustc_flags = [ | ||
"--cap-lints=allow", | ||
], | ||
tags = [ | ||
"cargo-bazel", | ||
"crate-name=capnp", | ||
"manual", | ||
"noclippy", | ||
"norustfmt", | ||
], | ||
version = "0.20.1", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
############################################################################### | ||
# @generated | ||
# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To | ||
# regenerate this file, run the following: | ||
# | ||
# bazel run @//deps/rust:crates_vendor | ||
############################################################################### | ||
|
||
load( | ||
"@rules_rust//rust:defs.bzl", | ||
"rust_binary", | ||
"rust_library", | ||
) | ||
|
||
package(default_visibility = ["//visibility:public"]) | ||
|
||
rust_library( | ||
name = "capnpc", | ||
srcs = glob( | ||
include = ["**/*.rs"], | ||
allow_empty = True, | ||
), | ||
compile_data = glob( | ||
include = ["**"], | ||
allow_empty = True, | ||
exclude = [ | ||
"**/* *", | ||
".tmp_git_root/**/*", | ||
"BUILD", | ||
"BUILD.bazel", | ||
"WORKSPACE", | ||
"WORKSPACE.bazel", | ||
], | ||
), | ||
crate_root = "src/lib.rs", | ||
edition = "2021", | ||
rustc_flags = [ | ||
"--cap-lints=allow", | ||
], | ||
tags = [ | ||
"cargo-bazel", | ||
"crate-name=capnpc", | ||
"manual", | ||
"noclippy", | ||
"norustfmt", | ||
], | ||
version = "0.20.0", | ||
deps = [ | ||
"@crates_vendor__capnp-0.20.1//:capnp", | ||
], | ||
) | ||
|
||
rust_binary( | ||
name = "capnpc-rust__bin", | ||
srcs = glob( | ||
include = ["**/*.rs"], | ||
allow_empty = True, | ||
), | ||
compile_data = glob( | ||
include = ["**"], | ||
allow_empty = True, | ||
exclude = [ | ||
"**/* *", | ||
".tmp_git_root/**/*", | ||
"BUILD", | ||
"BUILD.bazel", | ||
"WORKSPACE", | ||
"WORKSPACE.bazel", | ||
], | ||
), | ||
crate_root = "src/capnpc-rust.rs", | ||
edition = "2021", | ||
rustc_flags = [ | ||
"--cap-lints=allow", | ||
], | ||
tags = [ | ||
"cargo-bazel", | ||
"crate-name=capnpc", | ||
"manual", | ||
"noclippy", | ||
"norustfmt", | ||
], | ||
version = "0.20.0", | ||
deps = [ | ||
":capnpc", | ||
"@crates_vendor__capnp-0.20.1//:capnp", | ||
], | ||
) | ||
|
||
rust_binary( | ||
name = "capnpc-rust-bootstrap__bin", | ||
srcs = glob( | ||
include = ["**/*.rs"], | ||
allow_empty = True, | ||
), | ||
compile_data = glob( | ||
include = ["**"], | ||
allow_empty = True, | ||
exclude = [ | ||
"**/* *", | ||
".tmp_git_root/**/*", | ||
"BUILD", | ||
"BUILD.bazel", | ||
"WORKSPACE", | ||
"WORKSPACE.bazel", | ||
], | ||
), | ||
crate_root = "src/capnpc-rust-bootstrap.rs", | ||
edition = "2021", | ||
rustc_flags = [ | ||
"--cap-lints=allow", | ||
], | ||
tags = [ | ||
"cargo-bazel", | ||
"crate-name=capnpc", | ||
"manual", | ||
"noclippy", | ||
"norustfmt", | ||
], | ||
version = "0.20.0", | ||
deps = [ | ||
":capnpc", | ||
"@crates_vendor__capnp-0.20.1//:capnp", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
############################################################################### | ||
# @generated | ||
# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To | ||
# regenerate this file, run the following: | ||
# | ||
# bazel run @//deps/rust:crates_vendor | ||
############################################################################### | ||
|
||
load("@rules_rust//rust:defs.bzl", "rust_library") | ||
|
||
package(default_visibility = ["//visibility:public"]) | ||
|
||
rust_library( | ||
name = "embedded_io", | ||
srcs = glob( | ||
include = ["**/*.rs"], | ||
allow_empty = True, | ||
), | ||
compile_data = glob( | ||
include = ["**"], | ||
allow_empty = True, | ||
exclude = [ | ||
"**/* *", | ||
".tmp_git_root/**/*", | ||
"BUILD", | ||
"BUILD.bazel", | ||
"WORKSPACE", | ||
"WORKSPACE.bazel", | ||
], | ||
), | ||
crate_root = "src/lib.rs", | ||
edition = "2021", | ||
rustc_flags = [ | ||
"--cap-lints=allow", | ||
], | ||
tags = [ | ||
"cargo-bazel", | ||
"crate-name=embedded-io", | ||
"manual", | ||
"noclippy", | ||
"norustfmt", | ||
], | ||
version = "0.6.1", | ||
) |
Oops, something went wrong.