Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Projects that have their own MODULE.bazel files
src/libnl3
src/libteam
src/libyang
src/libyang3
src/libyang3-py3
src/sflow/hsflowd
src/sflow/psample
src/sflow/sflowtool
src/sonic-build-infra
src/sonic-config-engine
src/sonic-dash-api
src/sonic-gnmi
src/sonic-host-services
src/sonic-mgmt-common
src/sonic-p4rt/sonic-pins
src/sonic-platform-common
src/sonic-platform-daemons
src/sonic-py-common
src/sonic-py-swsssdk
src/sonic-sairedis
src/sonic-supervisord-utilities
src/sonic-swss
src/sonic-swss-common
src/sonic-sysmgr
src/sonic-utilities
src/sonic-yang-mgmt
src/sonic-yang-mgmt
src/sonic-yang-models

# Modules that happen to have Bazel build files but we haven't migrated yet and are not supposed to work.
# TODO(bazel-ready): Make these modules work.
src/dhcprelay
src/sonic-genl-packet
19 changes: 19 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
common --registry=file://%workspace%/tools/bazel/registry
common --registry=https://raw.githubusercontent.com/aspect-build/bazel-central-registry/aspect_rules_py-v1.8.4
common --registry=https://bcr.bazel.build

common --@rules_python//python/config_settings:python_version=3.11

common --@pip//venv=default
common --per_file_copt=.*external.*@-w
common --cxxopt=-std=c++17 --host_cxxopt=-std=c++17
common --features=external_include_paths

# For vs, build sai from sources at @sai
common:vs --@sonic_build_infra//:asic_manufacturer=vs
common:vs --@sonic_build_infra//:sai=@sai//lib:sai

# For broadcom, we get the prebuilt version of SAI
common:broadcom --@sonic_build_infra//:asic_manufacturer=broadcom
common:broadcom --@sonic_build_infra//:sai=@libsaibcm_xgs-dev//:sai

1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8.5.1
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,6 @@ sources.list.*

# Generated mirror configs
apt-retries-count

# Bazel convenience symlinks (created at workspace root by `bazel build`)
/bazel-*
15 changes: 10 additions & 5 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
[submodule "sonic-swss-common"]
path = src/sonic-swss-common
url = https://github.com/sonic-net/sonic-swss-common
url = https://github.com/lunyue-ms/sonic-swss-common.git
branch = bazel-port-overlay
[submodule "sonic-linux-kernel"]
path = src/sonic-linux-kernel
url = https://github.com/sonic-net/sonic-linux-kernel
[submodule "sonic-sairedis"]
path = src/sonic-sairedis
url = https://github.com/sonic-net/sonic-sairedis
url = https://github.com/lunyue-ms/sonic-sairedis.git
branch = bazel-port-overlay
[submodule "sonic-swss"]
path = src/sonic-swss
url = https://github.com/sonic-net/sonic-swss
url = https://github.com/lunyue-ms/sonic-swss.git
branch = bazel-port-overlay
[submodule "src/p4c-bm/p4c-bm"]
path = platform/p4/p4c-bm/p4c-bm
url = https://github.com/krambn/p4c-bm
Expand All @@ -21,7 +24,8 @@
url = https://github.com/sonic-net/sonic-dbsyncd
[submodule "src/sonic-py-swsssdk"]
path = src/sonic-py-swsssdk
url = https://github.com/sonic-net/sonic-py-swsssdk.git
url = https://github.com/lunyue-ms/sonic-py-swsssdk.git
branch = bazel-port-overlay
[submodule "src/sonic-snmpagent"]
path = src/sonic-snmpagent
url = https://github.com/sonic-net/sonic-snmpagent
Expand Down Expand Up @@ -116,7 +120,8 @@
url = https://github.com/sonic-net/sonic-dhcpmon.git
[submodule "src/sonic-dash-api"]
path = src/sonic-dash-api
url = https://github.com/sonic-net/sonic-dash-api.git
url = https://github.com/lunyue-ms/sonic-dash-api.git
branch = bazel-port-overlay
[submodule "src/sonic-dash-ha"]
path = src/sonic-dash-ha
url = https://github.com/sonic-net/sonic-dash-ha
Expand Down
Empty file added BUILD.bazel
Empty file.
75 changes: 75 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
module(name = "sonic-buildimage")

bazel_dep(name = "rules_cc", version = "0.2.16")
bazel_dep(name = "platforms", version = "1.0.0")
bazel_dep(name = "bazel_skylib", version = "1.9.0")
bazel_dep(name = "rules_python", version = "1.7.0")
bazel_dep(name = "rules_oci", version = "2.2.6")
bazel_dep(name = "tar.bzl", version = "0.8.1")
git_override(
module_name = "tar.bzl",
commit = "9b76e660363ab2465d89d3aadbbc1f7afa02e65c",
remote = "https://github.com/bazel-contrib/tar.bzl",
)

# blorente fork has bookworm/gcc-12 compat fix
git_override(
module_name = "rules_m4",
commit = "54e35332761523b8b8c7e7a17c8fd3733e53e3e7",
remote = "https://github.com/blorente/rules_m4",
)

toolchains = use_extension("@tar.bzl//tar:extensions.bzl", "toolchains")
use_repo(toolchains, "bsd_tar_toolchains")

register_toolchains("@bsd_tar_toolchains//:all")

bazel_dep(name = "bazel_lib", version = "3.1.1")
bazel_dep(name = "rules_distroless", version = "0.0.0", repo_name = "rules_deb")
git_override(
module_name = "rules_distroless",
commit = "ebfd74a2e07b83235e064bb63ace98a1a5223e02",
remote = "https://github.com/bazel-contrib/rules_distroless",
)


bazel_dep(name = "aspect_rules_py", version = "1.8.4")
single_version_override(
module_name = "aspect_rules_py",
version = "1.8.4",
)

include("//dockers/docker-base-bookworm:base_bookworm.MODULE.bazel")

bazel_dep(name = "sonic-py-common", version = "0.0.0", repo_name = "sonic_py_common")
bazel_dep(name = "sonic-supervisord-utilities", version = "0.0.0", repo_name = "sonic_supervisord_utilities")
bazel_dep(name = "sonic-config-engine", version = "0.0.0", repo_name = "sonic_config_engine")
bazel_dep(name = "sonic-yang-mgmt", version = "0.0.0", repo_name = "sonic_yang_mgmt")
bazel_dep(name = "sonic-yang-models", version = "0.0.0", repo_name = "sonic_yang_models")

bazel_dep(name = "rules_boost", version = "0.0.0")
archive_override(
module_name = "rules_boost",
integrity = "sha256-T0VNi3xaWul0wHfiNRGqrtrTkhtS6sOSeu9jfiUrZO0=",
strip_prefix = "rules_boost-a0643ef5ea1f939da59c42a6a5f21d1c0ffcff4f",
urls = ["https://github.com/nelhage/rules_boost/archive/a0643ef5ea1f939da59c42a6a5f21d1c0ffcff4f.zip"],
)

bazel_dep(name = "sonic-swss-common", version = "0.0.0", repo_name = "sonic_swss_common")
bazel_dep(name = "sonic-py-swsssdk", version = "0.0.0", repo_name = "sonic_py_swsssdk")

bazel_dep(name = "sonic-build-infra", version = "0.0.0", repo_name = "sonic_build_infra")
register_toolchains("@sonic_build_infra//toolchains/gcc:host_gcc_toolchain")

bazel_dep(name = "libyang", version = "1.0.73")
bazel_dep(name = "libyang3", version = "3.12.2")
bazel_dep(name = "libnl3", version = "3.7.0")
bazel_dep(name = "libyang3_py3", version = "3.1.0")

bazel_dep(name = "rules_shell", version = "0.6.1")
bazel_dep(name = "sonic-swss", version = "0.0.0", repo_name = "sonic_swss")
bazel_dep(name = "sonic-sairedis", version = "0.0.0", repo_name = "sonic_sairedis")
bazel_dep(name = "sai", version = "0.0.0")
bazel_dep(name = "sonic-dash-api", version = "0.0.0", repo_name = "sonic_dash_api")

bazel_dep(name = "libteam", version = "1.31", repo_name = "libteam")
Loading
Loading