Files

163 lines
4.2 KiB
Python

load("@crates//:defs.bzl", "aliases", "all_crate_deps")
load("@rules_rs//rs:rust_binary.bzl", "rust_binary")
load("@rules_rs//rs:rust_library.bzl", "rust_library")
load("@rules_rs//rs:rust_test.bzl", "rust_test")
load("@rules_rust//rust:defs.bzl", "rustfmt_test")
load("@workspace_version//:version.bzl", "WORKSPACE_VERSION")
rust_library(
name = "openshell-cli",
srcs = glob(
["src/**/*.rs"],
exclude = ["src/main.rs"],
),
aliases = aliases(),
version = WORKSPACE_VERSION,
deps = all_crate_deps(normal = True),
)
rust_binary(
name = "openshell",
srcs = ["src/main.rs"],
aliases = aliases(),
version = WORKSPACE_VERSION,
visibility = ["//visibility:public"],
deps = all_crate_deps(normal = True) + [":openshell-cli"],
)
rust_binary(
name = "fake-forward-process",
testonly = True,
srcs = ["tests/fixtures/fake_forward.rs"],
crate_root = "tests/fixtures/fake_forward.rs",
)
rust_test(
name = "openshell-cli_lib_test",
crate = ":openshell-cli",
deps = all_crate_deps(normal_dev = True),
)
rust_test(
name = "openshell-cli_bin_test",
srcs = ["src/main.rs"],
aliases = aliases(),
version = WORKSPACE_VERSION,
deps = all_crate_deps(
normal = True,
normal_dev = True,
) + [":openshell-cli"],
)
rust_test(
name = "ensure_providers_integration_test",
srcs = [
"tests/ensure_providers_integration.rs",
"tests/helpers/mod.rs",
],
aliases = aliases(),
crate_root = "tests/ensure_providers_integration.rs",
deps = all_crate_deps(
normal = True,
normal_dev = True,
) + [":openshell-cli"],
)
rust_test(
name = "mtls_integration_test",
srcs = [
"tests/helpers/mod.rs",
"tests/mtls_integration.rs",
],
aliases = aliases(),
crate_root = "tests/mtls_integration.rs",
deps = all_crate_deps(
normal = True,
normal_dev = True,
) + [":openshell-cli"],
)
rust_test(
name = "provider_commands_integration_test",
srcs = [
"tests/helpers/mod.rs",
"tests/provider_commands_integration.rs",
],
aliases = aliases(),
crate_root = "tests/provider_commands_integration.rs",
deps = all_crate_deps(
normal = True,
normal_dev = True,
) + [":openshell-cli"],
)
rust_test(
name = "sandbox_create_lifecycle_integration_test",
srcs = [
"tests/fixtures/fake_forward.rs",
"tests/helpers/mod.rs",
"tests/sandbox_create_lifecycle_integration.rs",
],
aliases = aliases(),
compile_data = [":openshell"],
crate_root = "tests/sandbox_create_lifecycle_integration.rs",
data = [
":fake-forward-process",
":openshell",
],
env = {
"OPENSHELL_TEST_FAKE_FORWARD_PATH": "$(rootpath :fake-forward-process)",
},
rustc_env = {
"CARGO_BIN_EXE_openshell": "$(rootpath :openshell)",
},
deps = all_crate_deps(
normal = True,
normal_dev = True,
) + [":openshell-cli"],
)
rust_test(
name = "sandbox_name_fallback_integration_test",
srcs = [
"tests/helpers/mod.rs",
"tests/sandbox_name_fallback_integration.rs",
],
aliases = aliases(),
crate_root = "tests/sandbox_name_fallback_integration.rs",
deps = all_crate_deps(
normal = True,
normal_dev = True,
) + [":openshell-cli"],
)
rust_test(
name = "sandbox_upload_integration_test",
srcs = ["tests/sandbox_upload_integration.rs"],
aliases = aliases(),
crate_root = "tests/sandbox_upload_integration.rs",
data = [":openshell"],
deps = all_crate_deps(
normal = True,
normal_dev = True,
) + [":openshell-cli"],
)
rustfmt_test(
name = "rustfmt_test",
targets = [
":ensure_providers_integration_test",
":fake-forward-process",
":mtls_integration_test",
":openshell",
":openshell-cli",
":openshell-cli_bin_test",
":openshell-cli_lib_test",
":provider_commands_integration_test",
":sandbox_create_lifecycle_integration_test",
":sandbox_name_fallback_integration_test",
":sandbox_upload_integration_test",
],
visibility = ["//crates:__pkg__"],
)