Skip to content

Commit def79dc

Browse files
committed
added filegroup rule to the BUILD files
1 parent 9a77ec2 commit def79dc

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

BUILD

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Added BUILD file in the kubernetes c client repository helps integrating the library to external Bazel users.
2+
# Following are the changes required from the external Bazel users to do.
3+
4+
# WORKSPACE
5+
6+
# load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
7+
# http_archive(
8+
# name = "rules_foreign_cc",
9+
# sha256 = "a2e6fb56e649c1ee79703e99aa0c9d13c6cc53c8d7a0cbb8797ab2888bbc99a3",
10+
# strip_prefix = "rules_foreign_cc-0.12.0",
11+
# url = "https://github.com/bazelbuild/rules_foreign_cc/releases/download/0.12.0/rules_foreign_cc-0.12.0.tar.gz",
12+
# )
13+
14+
# load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")
15+
16+
# # This sets up some common toolchains for building targets. For more details, please see
17+
# # https://bazelbuild.github.io/rules_foreign_cc/0.12.0/flatten.html#rules_foreign_cc_dependencies
18+
# rules_foreign_cc_dependencies()
19+
20+
# load("@bazel_features//:deps.bzl", "bazel_features_deps")
21+
22+
# bazel_features_deps()
23+
24+
# http_archive(
25+
# name = "kubernetes_c_client",
26+
# sha256 = "10d0c5af1a52a1d2da379e8e45b53978b9dedc90ff195bdff171ae17c1f1dd50",
27+
# strip_prefix = "c-0.11.0",
28+
# url = "https://github.com/kubernetes-client/c/archive/refs/tags/v0.11.0.zip",
29+
# )
30+
31+
# BUILD file:
32+
33+
# load("@rules_cc//cc:defs.bzl", "cc_binary")
34+
# load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake")
35+
# load("@rules_foreign_cc//foreign_cc:defs.bzl", "make")
36+
# cmake(
37+
# name = "kube_c",
38+
# build_args = [
39+
# "--verbose",
40+
# "--", # <- Pass remaining options to the native tool.
41+
# "-j 1",
42+
# ],
43+
# lib_source = "@kubernetes_c_client//:kubernetes",
44+
# out_shared_libs = ["libkubernetes.so"],
45+
# )
46+
47+
# cc_binary(
48+
# name = "create_pod",
49+
# srcs = ["create_pod.c"],
50+
# deps = [":kube_c"],
51+
# )
52+
53+
# cc_binary(
54+
# name = "list_pod",
55+
# srcs = ["list_pod.c"],
56+
# deps = [":kube_c"],
57+
# )
58+
59+
# Make sure you install the pre-requisites (libyaml,libwebsocket etc.) beforehand. A working example can be found here https://github.com/joyanta55/kubernetes_c_bazel/tree/main
60+
61+
# In summary, the below filegroup allows to import kubernetes C client (i.e. lib_source = "@kubernetes_c_client//:kubernetes"), use cmake or make bazel rule provided by rules_foreign_cc (https://github.com/bazel-contrib/rules_foreign_cc) to build and use.
62+
filegroup(
63+
name = "kubernetes",
64+
srcs = glob(["kubernetes/**"]),
65+
visibility = ["//visibility:public"],
66+
)

0 commit comments

Comments
 (0)