139 lines
3.7 KiB
Python
139 lines
3.7 KiB
Python
load("@rules_proto//proto:defs.bzl", "proto_library")
|
|
load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library", "rust_test")
|
|
|
|
# Prost generator binary for converting proto files to Rust code
|
|
rust_binary(
|
|
name = "prost_generator",
|
|
srcs = ["prost_generator.rs"],
|
|
edition = "2021",
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
"@crates//:prost",
|
|
"@crates//:prost-build",
|
|
"@crates//:serde",
|
|
"@crates//:schemars",
|
|
"@crates//:tempfile",
|
|
],
|
|
)
|
|
|
|
# Generate Rust code for databuild proto
|
|
genrule(
|
|
name = "generate_databuild_rust",
|
|
srcs = [
|
|
"databuild.proto",
|
|
],
|
|
outs = ["databuild.rs"],
|
|
cmd = "PROTOC=$(location @com_google_protobuf//:protoc) $(location :prost_generator) $(location databuild.proto) /dev/null $@",
|
|
tools = [
|
|
"//databuild:prost_generator",
|
|
"@com_google_protobuf//:protoc",
|
|
],
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
# DataBuild library using generated prost code
|
|
rust_library(
|
|
name = "databuild",
|
|
srcs = [
|
|
"event_log/mock.rs",
|
|
"event_log/mod.rs",
|
|
"event_log/postgres.rs",
|
|
"event_log/sqlite.rs",
|
|
"event_log/stdout.rs",
|
|
"event_log/writer.rs",
|
|
"format_consistency_test.rs",
|
|
"lib.rs",
|
|
"mermaid_utils.rs",
|
|
"orchestration/error.rs",
|
|
"orchestration/events.rs",
|
|
"orchestration/mod.rs",
|
|
"repositories/builds/mod.rs",
|
|
"repositories/jobs/mod.rs",
|
|
"repositories/mod.rs",
|
|
"repositories/partitions/mod.rs",
|
|
"repositories/tasks/mod.rs",
|
|
"service/handlers.rs",
|
|
"service/mod.rs",
|
|
"status_utils.rs",
|
|
":generate_databuild_rust",
|
|
],
|
|
edition = "2021",
|
|
proc_macro_deps = [
|
|
"@crates//:async-trait",
|
|
],
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
"@crates//:aide",
|
|
"@crates//:axum",
|
|
"@crates//:axum-jsonschema",
|
|
"@crates//:log",
|
|
"@crates//:prost",
|
|
"@crates//:prost-types",
|
|
"@crates//:rusqlite",
|
|
"@crates//:schemars",
|
|
"@crates//:serde",
|
|
"@crates//:serde_json",
|
|
"@crates//:thiserror",
|
|
"@crates//:tokio",
|
|
"@crates//:uuid",
|
|
],
|
|
)
|
|
|
|
# OpenAPI Spec Generator binary (no dashboard dependency)
|
|
# No need to run this manually - it will automatically generate source and it will be used in
|
|
# the related targets (e.g. //databuild/client:extract_openapi_spec)
|
|
rust_binary(
|
|
name = "openapi_spec_generator",
|
|
srcs = ["service/openapi_spec_generator.rs"],
|
|
edition = "2021",
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
":databuild",
|
|
"@crates//:log",
|
|
"@crates//:serde_json",
|
|
"@crates//:tokio",
|
|
],
|
|
)
|
|
|
|
# Build Graph Service binary
|
|
rust_binary(
|
|
name = "build_graph_service",
|
|
srcs = ["service/main.rs"],
|
|
data = ["//databuild/dashboard:dist"],
|
|
edition = "2021",
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
":databuild",
|
|
"@crates//:aide",
|
|
"@crates//:axum",
|
|
"@crates//:axum-jsonschema",
|
|
"@crates//:clap",
|
|
"@crates//:hyper",
|
|
"@crates//:log",
|
|
"@crates//:schemars",
|
|
"@crates//:serde",
|
|
"@crates//:serde_json",
|
|
"@crates//:simple_logger",
|
|
"@crates//:tokio",
|
|
"@crates//:tower",
|
|
"@crates//:tower-http",
|
|
"@crates//:uuid",
|
|
],
|
|
)
|
|
|
|
# Test for orchestration module
|
|
rust_test(
|
|
name = "orchestration_test",
|
|
crate = ":databuild",
|
|
edition = "2021",
|
|
deps = [
|
|
"@crates//:tokio",
|
|
],
|
|
)
|
|
|
|
# Legacy filegroup for backwards compatibility
|
|
filegroup(
|
|
name = "proto",
|
|
srcs = ["databuild.proto"],
|
|
visibility = ["//visibility:public"],
|
|
)
|