Skip to content

Commit

Permalink
add bazel example
Browse files Browse the repository at this point in the history
  • Loading branch information
arvid220u committed Mar 14, 2023
1 parent 0f42826 commit ddb236e
Show file tree
Hide file tree
Showing 11 changed files with 684 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
1 change: 1 addition & 0 deletions ex02-bazel/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bazel-*
27 changes: 27 additions & 0 deletions ex02-bazel/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test")

rust_library(
name = "example",
srcs = glob(["src/**/*.rs"]),
rustc_flags = [
# we allow unused imports, because they are annoying to avoid while developing
# and we don't want people to ignore warnings! which happens if there are too many warnings
"-Aunused_imports",
# we disallow unused results, because they are almost always bugs
"-Dunused_must_use",
],
visibility = ["//visibility:public"],
deps = [
"@global_crate_index//:tree-sitter",
"@tree_sitter_python",
"@tree_sitter_rust",
"@tree_sitter_go",
"@tree_sitter_javascript",
"@tree_sitter_typescript",
],
)

rust_test(
name = "test",
crate = ":example",
)
347 changes: 347 additions & 0 deletions ex02-bazel/Cargo.Bazel.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,347 @@
{
"checksum": "2c1b522e44766ebb40eeb869e7efa112f259b6bed84ba33bf5de8fa8930e4375",
"crates": {
"aho-corasick 0.7.20": {
"name": "aho-corasick",
"version": "0.7.20",
"repository": {
"Http": {
"url": "https://crates.io/api/v1/crates/aho-corasick/0.7.20/download",
"sha256": "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
}
},
"targets": [
{
"Library": {
"crate_name": "aho_corasick",
"crate_root": "src/lib.rs",
"srcs": [
"**/*.rs"
]
}
}
],
"library_target_name": "aho_corasick",
"common_attrs": {
"compile_data_glob": [
"**"
],
"crate_features": [
"default",
"std"
],
"deps": {
"common": [
{
"id": "memchr 2.5.0",
"target": "memchr"
}
],
"selects": {}
},
"edition": "2018",
"version": "0.7.20"
},
"license": "Unlicense OR MIT"
},
"cc 1.0.79": {
"name": "cc",
"version": "1.0.79",
"repository": {
"Http": {
"url": "https://crates.io/api/v1/crates/cc/1.0.79/download",
"sha256": "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
}
},
"targets": [
{
"Library": {
"crate_name": "cc",
"crate_root": "src/lib.rs",
"srcs": [
"**/*.rs"
]
}
}
],
"library_target_name": "cc",
"common_attrs": {
"compile_data_glob": [
"**"
],
"edition": "2018",
"version": "1.0.79"
},
"license": "MIT OR Apache-2.0"
},
"direct-cargo-bazel-deps 0.0.1": {
"name": "direct-cargo-bazel-deps",
"version": "0.0.1",
"repository": null,
"targets": [
{
"Library": {
"crate_name": "direct_cargo_bazel_deps",
"crate_root": ".direct_cargo_bazel_deps.rs",
"srcs": [
"**/*.rs"
]
}
}
],
"library_target_name": "direct_cargo_bazel_deps",
"common_attrs": {
"compile_data_glob": [
"**"
],
"deps": {
"common": [
{
"id": "tree-sitter 0.20.9",
"target": "tree_sitter"
}
],
"selects": {}
},
"edition": "2018",
"version": "0.0.1"
},
"license": null
},
"memchr 2.5.0": {
"name": "memchr",
"version": "2.5.0",
"repository": {
"Http": {
"url": "https://crates.io/api/v1/crates/memchr/2.5.0/download",
"sha256": "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
}
},
"targets": [
{
"Library": {
"crate_name": "memchr",
"crate_root": "src/lib.rs",
"srcs": [
"**/*.rs"
]
}
},
{
"BuildScript": {
"crate_name": "build_script_build",
"crate_root": "build.rs",
"srcs": [
"**/*.rs"
]
}
}
],
"library_target_name": "memchr",
"common_attrs": {
"compile_data_glob": [
"**"
],
"crate_features": [
"default",
"std"
],
"deps": {
"common": [
{
"id": "memchr 2.5.0",
"target": "build_script_build"
}
],
"selects": {}
},
"edition": "2018",
"version": "2.5.0"
},
"build_script_attrs": {
"data_glob": [
"**"
]
},
"license": "Unlicense/MIT"
},
"regex 1.7.1": {
"name": "regex",
"version": "1.7.1",
"repository": {
"Http": {
"url": "https://crates.io/api/v1/crates/regex/1.7.1/download",
"sha256": "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733"
}
},
"targets": [
{
"Library": {
"crate_name": "regex",
"crate_root": "src/lib.rs",
"srcs": [
"**/*.rs"
]
}
}
],
"library_target_name": "regex",
"common_attrs": {
"compile_data_glob": [
"**"
],
"crate_features": [
"aho-corasick",
"default",
"memchr",
"perf",
"perf-cache",
"perf-dfa",
"perf-inline",
"perf-literal",
"std",
"unicode",
"unicode-age",
"unicode-bool",
"unicode-case",
"unicode-gencat",
"unicode-perl",
"unicode-script",
"unicode-segment"
],
"deps": {
"common": [
{
"id": "aho-corasick 0.7.20",
"target": "aho_corasick"
},
{
"id": "memchr 2.5.0",
"target": "memchr"
},
{
"id": "regex-syntax 0.6.28",
"target": "regex_syntax"
}
],
"selects": {}
},
"edition": "2018",
"version": "1.7.1"
},
"license": "MIT OR Apache-2.0"
},
"regex-syntax 0.6.28": {
"name": "regex-syntax",
"version": "0.6.28",
"repository": {
"Http": {
"url": "https://crates.io/api/v1/crates/regex-syntax/0.6.28/download",
"sha256": "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
}
},
"targets": [
{
"Library": {
"crate_name": "regex_syntax",
"crate_root": "src/lib.rs",
"srcs": [
"**/*.rs"
]
}
}
],
"library_target_name": "regex_syntax",
"common_attrs": {
"compile_data_glob": [
"**"
],
"crate_features": [
"default",
"unicode",
"unicode-age",
"unicode-bool",
"unicode-case",
"unicode-gencat",
"unicode-perl",
"unicode-script",
"unicode-segment"
],
"edition": "2018",
"version": "0.6.28"
},
"license": "MIT OR Apache-2.0"
},
"tree-sitter 0.20.9": {
"name": "tree-sitter",
"version": "0.20.9",
"repository": {
"Http": {
"url": "https://crates.io/api/v1/crates/tree-sitter/0.20.9/download",
"sha256": "d4423c784fe11398ca91e505cdc71356b07b1a924fc8735cfab5333afe3e18bc"
}
},
"targets": [
{
"Library": {
"crate_name": "tree_sitter",
"crate_root": "binding_rust/lib.rs",
"srcs": [
"**/*.rs"
]
}
},
{
"BuildScript": {
"crate_name": "build_script_build",
"crate_root": "binding_rust/build.rs",
"srcs": [
"**/*.rs"
]
}
}
],
"library_target_name": "tree_sitter",
"common_attrs": {
"compile_data_glob": [
"**"
],
"deps": {
"common": [
{
"id": "regex 1.7.1",
"target": "regex"
},
{
"id": "tree-sitter 0.20.9",
"target": "build_script_build"
}
],
"selects": {}
},
"edition": "2018",
"version": "0.20.9"
},
"build_script_attrs": {
"data_glob": [
"**"
],
"deps": {
"common": [
{
"id": "cc 1.0.79",
"target": "cc"
}
],
"selects": {}
}
},
"license": "MIT"
}
},
"binary_crates": [],
"workspace_members": {
"direct-cargo-bazel-deps 0.0.1": ""
},
"conditions": {}
}
Loading

0 comments on commit ddb236e

Please sign in to comment.