Skip to content

Commit 65fa0d2

Browse files
committed
Add build rules
Signed-off-by: Chris Frantz <cfrantz@google.com>
1 parent ebcfe25 commit 65fa0d2

File tree

6 files changed

+179
-2
lines changed

6 files changed

+179
-2
lines changed

BUILD.bazel

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
load(
2+
"@rules_rust//rust:defs.bzl",
3+
"rust_binary",
4+
"rust_library",
5+
"rust_proc_macro",
6+
"rust_test",
7+
)
8+
9+
package(default_visibility = [
10+
"//visibility:public",
11+
])
12+
13+
licenses([
14+
"notice", # Apache 2 license
15+
])
16+
17+
rust_library(
18+
name = "serde_annotate",
19+
srcs = glob(["**/*.rs"]),
20+
compile_data = ["src/relax.pest"],
21+
crate_features = [
22+
],
23+
crate_root = "src/lib.rs",
24+
data = [],
25+
edition = "2021",
26+
proc_macro_deps = [
27+
"//annotate_derive",
28+
"//third_party/rust/crates:pest_derive",
29+
],
30+
rustc_flags = [
31+
"--cap-lints=allow",
32+
],
33+
tags = [
34+
"crate-name=serde_annotate",
35+
],
36+
version = "0.1.0",
37+
deps = [
38+
"//third_party/rust/crates:ansi_term",
39+
"//third_party/rust/crates:inventory",
40+
"//third_party/rust/crates:num_traits",
41+
"//third_party/rust/crates:once_cell",
42+
"//third_party/rust/crates:pest",
43+
"//third_party/rust/crates:regex",
44+
"//third_party/rust/crates:serde",
45+
"//third_party/rust/crates:thiserror",
46+
],
47+
)
48+
49+
rust_test(
50+
name = "serde_annotate_test",
51+
crate = ":serde_annotate",
52+
deps = [
53+
"//third_party/rust/crates:anyhow",
54+
],
55+
)

annotate_derive/BUILD.bazel

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
load(
2+
"@rules_rust//rust:defs.bzl",
3+
"rust_binary",
4+
"rust_library",
5+
"rust_proc_macro",
6+
"rust_test",
7+
)
8+
9+
package(default_visibility = [
10+
"//visibility:public",
11+
])
12+
13+
licenses([
14+
"notice", # Apache 2 license
15+
])
16+
17+
rust_proc_macro(
18+
name = "annotate_derive",
19+
srcs = glob(["**/*.rs"]),
20+
crate_features = [
21+
],
22+
crate_root = "src/lib.rs",
23+
data = [],
24+
edition = "2021",
25+
rustc_flags = [
26+
"--cap-lints=allow",
27+
],
28+
tags = [
29+
"crate-name=annotate_derive",
30+
],
31+
version = "0.1.0",
32+
deps = [
33+
"//third_party/rust/crates:proc_macro2",
34+
"//third_party/rust/crates:proc_macro_error",
35+
"//third_party/rust/crates:quote",
36+
"//third_party/rust/crates:syn",
37+
],
38+
)

examples/BUILD.bazel

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
load(
2+
"@rules_rust//rust:defs.bzl",
3+
"rust_binary",
4+
"rust_library",
5+
"rust_proc_macro",
6+
"rust_test",
7+
)
8+
9+
package(default_visibility = [
10+
"//visibility:public",
11+
])
12+
13+
licenses([
14+
"notice", # Apache 2 license
15+
])
16+
17+
rust_binary(
18+
name = "autoschema",
19+
srcs = ["autoschema.rs"],
20+
edition = "2021",
21+
deps = [
22+
"//:serde_annotate",
23+
"//third_party/rust/crates:ansi_term",
24+
"//third_party/rust/crates:anyhow",
25+
"//third_party/rust/crates:clap",
26+
],
27+
)
28+
29+
rust_binary(
30+
name = "samples",
31+
srcs = ["samples.rs"],
32+
edition = "2021",
33+
deps = [
34+
"//:serde_annotate",
35+
"//third_party/rust/crates:anyhow",
36+
"//third_party/rust/crates:clap",
37+
"//third_party/rust/crates:inventory",
38+
"//third_party/rust/crates:serde",
39+
"//third_party/rust/crates:serde_bytes",
40+
],
41+
)
42+
43+
rust_binary(
44+
name = "transcode",
45+
srcs = ["transcode.rs"],
46+
edition = "2021",
47+
deps = [
48+
"//:serde_annotate",
49+
"//third_party/rust/crates:anyhow",
50+
"//third_party/rust/crates:clap",
51+
],
52+
)

examples/samples.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use anyhow::{anyhow, Result};
22
use clap::{ArgEnum, Parser};
33
use serde_annotate::annotate::Annotate;
44
use serde_annotate::{serialize, ColorProfile};
5-
use serde_derive::{Deserialize, Serialize};
5+
use serde::{Deserialize, Serialize};
66

77
#[derive(Serialize, Deserialize, Annotate, Debug, PartialEq)]
88
struct Coordinate {

tests/BUILD.bazel

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
load(
2+
"@rules_rust//rust:defs.bzl",
3+
"rust_binary",
4+
"rust_library",
5+
"rust_proc_macro",
6+
"rust_test",
7+
)
8+
9+
package(default_visibility = [
10+
"//visibility:public",
11+
])
12+
13+
licenses([
14+
"notice", # Apache 2 license
15+
])
16+
17+
rust_test(
18+
name = "test_format",
19+
srcs = ["test_format.rs"],
20+
edition = "2021",
21+
deps = [
22+
"//:serde_annotate",
23+
"//third_party/rust/crates:anyhow",
24+
"//third_party/rust/crates:deser_hjson",
25+
"//third_party/rust/crates:inventory",
26+
"//third_party/rust/crates:json5",
27+
"//third_party/rust/crates:serde",
28+
"//third_party/rust/crates:serde_bytes",
29+
"//third_party/rust/crates:serde_json",
30+
"//third_party/rust/crates:serde_yaml",
31+
],
32+
)

tests/test_format.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use anyhow::Result;
22
use serde_annotate::annotate::Annotate;
33
use serde_annotate::serialize;
4-
use serde_derive::{Deserialize, Serialize};
4+
use serde::{Deserialize, Serialize};
55

66
fn fixdoc(doc: &str) -> String {
77
let mut s = String::new();

0 commit comments

Comments
 (0)