Skip to content

Commit 1505f5b

Browse files
committed
local changes
1 parent fd1508e commit 1505f5b

File tree

3 files changed

+1305
-6
lines changed

3 files changed

+1305
-6
lines changed

BUILD

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,37 @@ cc_library(
1111
hdrs = glob([
1212
"common/*.h",
1313
"common/*.hpp",
14-
]),
14+
], allow_empty = True),
1515
copts = [
1616
"-std=c++14",
17-
"-I/usr/include/libnl3", # Expected location in the SONiC build container"
17+
# TODO: this is not required with apt.installed debs.
18+
# "-I/usr/include/libnl3", # Expected location in the SONiC build container"
1819
],
20+
# Not needed with apt.install
21+
# linkopts = ["-lpthread -lhiredis -lnl-genl-3 -lnl-nf-3 -lnl-route-3 -lnl-3 -lzmq -luuid -lyang"],
1922
includes = [
2023
"common",
2124
],
25+
# Approach 1:
26+
deps = [
27+
"@focal//libhiredis-dev:libhiredis",
28+
"@focal//nlohmann-json3-dev:nlohmann-json3",
29+
"@focal//libnl-3-dev:libnl-3",
30+
"@focal//libnl-route-3-dev:libnl-route-3",
31+
"@focal//libnl-nf-3-dev:libnl-nf-3",
32+
"@focal//libyang-dev:libyang",
33+
"@focal//libzmq3-dev:libzmq3",
34+
"@focal//uuid-dev:uuid",
35+
"@focal//libboost-dev:libboost"
36+
],
37+
# Approach 2: BCR entries compiled from source
2238
# deps = [
2339
# "@boost.algorithm",
2440
# "@boost.serialization",
2541
# "@nlohmann_json//:json",
2642
# "@libuuid//:libuuid",
2743
# "@swig//:swig",
2844
# ],
29-
linkopts = ["-lpthread -lhiredis -lnl-genl-3 -lnl-nf-3 -lnl-route-3 -lnl-3 -lzmq -luuid -lyang"],
3045
visibility = ["//visibility:public"],
3146
)
3247

@@ -35,7 +50,7 @@ cc_library(
3550
hdrs = glob([
3651
"common/*.h",
3752
"common/*.hpp",
38-
]),
53+
], allow_empty = True),
3954
include_prefix = "swss",
4055
strip_include_prefix = "common",
4156
deps = [":common"],

MODULE.bazel

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,69 @@
11
module(name = "sonic-swss-common")
22

3-
bazel_dep(name = "googletest", version = "1.11.0", repo_name = "com_google_googletest")
4-
bazel_dep(name = "glog", version = "0.5.0", repo_name = "com_github_google_glog")
3+
bazel_dep(name = "rules_distroless", version = "0.0.0")
4+
local_path_override(
5+
module_name = "rules_distroless",
6+
path = "../rules_distroless"
7+
)
58

9+
10+
apt = use_extension("@rules_distroless//apt:extensions.bzl", "apt")
11+
12+
apt.sources_list(
13+
architectures = ["amd64"],
14+
components = [
15+
"main",
16+
"restricted",
17+
"universe"
18+
],
19+
suites = [
20+
"focal",
21+
"focal-security",
22+
"focal-updates",
23+
],
24+
uris = [
25+
"https://snapshot.ubuntu.com/ubuntu/20240301T030400Z",
26+
"mirror+https://snapshot.ubuntu.com/ubuntu/20240301T030400Z",
27+
],
28+
)
29+
30+
31+
# sudo apt-get install -y
32+
# make libtool m4 autoconf dh-exec debhelper cmake pkg-config
33+
# nlohmann-json3-dev libhiredis-dev libnl-3-dev libnl-genl-3-dev
34+
# libnl-route-3-dev libnl-nf-3-dev swig3.0 libpython2.7-dev libboost-dev
35+
# libboost-serialization-dev uuid-dev libzmq3-dev
36+
37+
apt.install(
38+
dependency_set = "focal",
39+
target_release = "focal",
40+
packages = [
41+
"nlohmann-json3-dev",
42+
"libhiredis-dev",
43+
"libnl-3-dev",
44+
"libnl-genl-3-dev",
45+
"libnl-route-3-dev",
46+
"libnl-nf-3-dev",
47+
"libboost-dev",
48+
"libboost-serialization-dev",
49+
"uuid-dev",
50+
"libzmq3-dev",
51+
"libyang-dev",
52+
53+
# These seem to be unused
54+
# "swig3.0",
55+
# "libpython2.7-dev",
56+
# "libgtest-dev",
57+
# "libgmock-dev",
58+
]
59+
)
60+
61+
apt.lock(into = ":packages.lock")
62+
63+
use_repo(apt, "focal")
64+
65+
# bazel_dep(name = "googletest", version = "1.11.0", repo_name = "com_google_googletest")
66+
# bazel_dep(name = "glog", version = "0.5.0", repo_name = "com_github_google_glog")
667
# bazel_dep(name = "nlohmann_json", version = "3.12.0")
768
# bazel_dep(name = "boost.algorithm", version = "1.87.0")
869
# bazel_dep(name = "boost.serialization", version = "1.87.0")

0 commit comments

Comments
 (0)