Skip to content

Commit

Permalink
Use pb2 files generated by bazel (was make)
Browse files Browse the repository at this point in the history
CMK-19491

Change-Id: Id2531f0c59fd339c36f8b46190ef4d7d726b8a8a
  • Loading branch information
Synss committed Oct 23, 2024
1 parent 39e2925 commit 9bb0281
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 3 deletions.
33 changes: 33 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
load("@bazel_skylib//rules:copy_file.bzl", "copy_file")
load("@hedron_compile_commands//:refresh_compile_commands.bzl", "refresh_compile_commands")
load("@repo_license//:license.bzl", "REPO_LICENSE")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@rules_python//python:pip.bzl", "compile_pip_requirements")

exports_files([
Expand Down Expand Up @@ -108,3 +110,34 @@ compile_pip_requirements(
tags = ["manual"],
visibility = ["//visibility:public"],
)

copy_file(
name = "_cmc_config_proto",
src = "//non-free/cmc-protocols/protocols:checkmk/cmc/config/v1/types.proto",
out = "cmc_proto/config/v1/types.proto",
)

copy_file(
name = "_cmc_cycletime_proto",
src = "//non-free/cmc-protocols/protocols:checkmk/cmc/cycletime/v1/types.proto",
out = "cmc_proto/cycletime/v1/types.proto",
)

proto_library(
name = "cycletime_proto",
srcs = ["cmc_proto/cycletime/v1/types.proto"],
strip_import_prefix = "cmc_proto",
visibility = ["//visibility:public"],
)

proto_library(
name = "config_proto",
srcs = ["cmc_proto/config/v1/types.proto"],
strip_import_prefix = "cmc_proto",
visibility = ["//visibility:public"],
deps = [
":cycletime_proto",
"@com_google_protobuf//:duration_proto",
"@com_google_protobuf//:timestamp_proto",
],
)
30 changes: 27 additions & 3 deletions cmk/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ load("@aspect_rules_py//py:defs.bzl", "py_library")
load("@cmk_requirements//:requirements.bzl", "requirement")
load("@com_google_protobuf//:protobuf_version.bzl", "PROTOBUF_PYTHON_VERSION")
load("@rules_python//python:packaging.bzl", "py_wheel")
load("@rules_python//python:proto.bzl", "py_proto_library")

genrule(
name = "_generate_requirements_in",
Expand Down Expand Up @@ -194,14 +195,19 @@ py_library(
],
)

py_proto_library(
name = "config_proto_pb2",
deps = ["//:config_proto"],
)

[py_library(
name = "lib_cmk_" + edition,
srcs = srcs,
imports = [".."],
visibility = ["//tests:__subpackages__"],
deps = [
"config_proto_pb2",
"lib_cmk",
"//non-free/cmc-protocols/protocols:py_config_proto",
],
) for edition, srcs in [
("cce", CCE_PY),
Expand All @@ -219,7 +225,25 @@ py_library(
visibility = ["//tests/unit:__pkg__"],
deps = [
"@rrdtool_native//:rrdtool_python_lib",
] + CMK_PACKAGES + [requirement(dep) for dep in REQUIRED_EXTERNAL_DEPS],
] + select({
"@//:gpl_repo": [],
"@//:gpl+enterprise_repo": [
"config_proto_pb2",
],
}) + CMK_PACKAGES + [requirement(dep) for dep in REQUIRED_EXTERNAL_DEPS],
)

py_wheel(
name = "cmk_cre",
distribution = "checkmk",
requires = REQUIRED_EXTERNAL_DEPS,
# TODO(ml): cmk_version vs. PEP 440?
version = "1+cre",
visibility = ["//visibility:public"],
deps = [
"lib_cmk",
"lib_cmk_cre",
],
)

[py_wheel(
Expand All @@ -232,9 +256,9 @@ py_library(
deps = [
"lib_cmk",
"lib_cmk_" + edition,
"config_proto_pb2",
],
) for edition in [
"cre",
"cce",
"cee",
"cme",
Expand Down

0 comments on commit 9bb0281

Please sign in to comment.