diff --git a/.bazelrc b/.bazelrc index f097dde..fa6c0b4 100644 --- a/.bazelrc +++ b/.bazelrc @@ -8,8 +8,3 @@ build --host_cxxopt=-std=c++17 # Use Clang. build --action_env=CC=clang build --action_env=CXX=clang++ - -# Use `WORKSPACE.bazel` instead of Bzlmod (`MODULE.bazel`). -# TODO - migrate to Bzlmod. -common --noenable_bzlmod -common --enable_workspace diff --git a/.bazelversion b/.bazelversion index 815da58..19b860c 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -7.4.1 +6.4.0 diff --git a/.github/workflows/ci-native.yml b/.github/workflows/ci-native.yml index 7d87df8..366a50c 100644 --- a/.github/workflows/ci-native.yml +++ b/.github/workflows/ci-native.yml @@ -21,7 +21,7 @@ jobs: os: [ubuntu-22.04, ubuntu-latest] # See Bazelisk README for legal values. # TODO - Add `latest` once it is supported. Requires using Bzlmod. - bazel_version: [7.x] + bazel_version: [6.x] # Don't abort other runs when one of them fails, to ease debugging. fail-fast: false diff --git a/WORKSPACE.bazel b/WORKSPACE similarity index 84% rename from WORKSPACE.bazel rename to WORKSPACE index f7a16e6..f0e769f 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE @@ -40,11 +40,14 @@ load("@com_github_nelhage_rules_boost//:boost/boost.bzl", "boost_deps") boost_deps() +# -- Load GRPC ----------------------------------------------------------------- + load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_language") switched_rules_by_language( name = "com_google_googleapis_imports", cc = True, + go = True, grpc = True, ) @@ -56,12 +59,6 @@ load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps") grpc_extra_deps() -# -- Load Rules CC ------------------------------------------------------------- -# See https://github.com/bazelbuild/rules_cc. -load("@rules_cc//cc:repositories.bzl", "rules_cc_dependencies") - -rules_cc_dependencies() - # -- Load Rules Foreign CC (for building Z3) ----------------------------------- # Used for Z3. @@ -75,10 +72,10 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "buildifier_prebuilt", - sha256 = "5dbf72e4f93917edfb91f53958d6289736adb845b2b89dbfb9bfc199a492030c", - strip_prefix = "buildifier-prebuilt-8.0.1", + sha256 = "7f85b688a4b558e2d9099340cfb510ba7179f829454fba842370bccffb67d6cc", + strip_prefix = "buildifier-prebuilt-7.3.1", urls = [ - "http://github.com/keith/buildifier-prebuilt/archive/8.0.1.tar.gz", + "http://github.com/keith/buildifier-prebuilt/archive/7.3.1.tar.gz", ], ) diff --git a/p4_constraints/BUILD.bazel b/p4_constraints/BUILD.bazel index 4e07c51..b430bdb 100644 --- a/p4_constraints/BUILD.bazel +++ b/p4_constraints/BUILD.bazel @@ -1,8 +1,4 @@ -load("@com_google_protobuf//bazel:cc_proto_library.bzl", "cc_proto_library") -load("@rules_cc//cc:cc_library.bzl", "cc_library") -load("@rules_cc//cc:cc_test.bzl", "cc_test") -# GOOGLE ONLY (DO NOT REMOVE): load("//third_party/protobuf/bazel:proto_library.bzl", "proto_library") - +load("@com_google_googleapis_imports//:imports.bzl", "cc_proto_library") load("@rules_proto//proto:defs.bzl", "proto_library") package( diff --git a/p4_constraints/backend/BUILD.bazel b/p4_constraints/backend/BUILD.bazel index f775a7a..9d0f2aa 100644 --- a/p4_constraints/backend/BUILD.bazel +++ b/p4_constraints/backend/BUILD.bazel @@ -1,5 +1,3 @@ -load("@rules_cc//cc:cc_library.bzl", "cc_library") -load("@rules_cc//cc:cc_test.bzl", "cc_test") load("//e2e_tests:p4check.bzl", "cmd_diff_test") package( diff --git a/p4_constraints/cli/BUILD.bazel b/p4_constraints/cli/BUILD.bazel index b8b6107..7c7aa4d 100644 --- a/p4_constraints/cli/BUILD.bazel +++ b/p4_constraints/cli/BUILD.bazel @@ -1,5 +1,3 @@ -load("@rules_cc//cc:cc_binary.bzl", "cc_binary") - package( default_visibility = ["//visibility:public"], licenses = ["notice"], # Apache 2.0 diff --git a/p4_constraints/frontend/BUILD.bazel b/p4_constraints/frontend/BUILD.bazel index b08751e..3336fb0 100644 --- a/p4_constraints/frontend/BUILD.bazel +++ b/p4_constraints/frontend/BUILD.bazel @@ -1,6 +1,3 @@ -load("@rules_cc//cc:cc_library.bzl", "cc_library") -load("@rules_cc//cc:cc_test.bzl", "cc_test") - package( licenses = ["notice"], # Apache 2.0 ) diff --git a/p4_constraints_deps.bzl b/p4_constraints_deps.bzl index f3c016c..460d70c 100644 --- a/p4_constraints_deps.bzl +++ b/p4_constraints_deps.bzl @@ -10,6 +10,13 @@ def p4_constraints_deps(): urls = ["https://github.com/abseil/abseil-cpp/releases/download/20240722.0/abseil-cpp-20240722.0.tar.gz"], strip_prefix = "abseil-cpp-20240722.0", ) + if not native.existing_rule("com_google_googleapis"): + http_archive( + name = "com_google_googleapis", + url = "https://github.com/googleapis/googleapis/archive/f405c718d60484124808adb7fb5963974d654bb4.zip", + strip_prefix = "googleapis-f405c718d60484124808adb7fb5963974d654bb4", + sha256 = "406b64643eede84ce3e0821a1d01f66eaf6254e79cb9c4f53be9054551935e79", + ) if not native.existing_rule("com_google_gutil"): http_archive( name = "com_google_gutil", @@ -46,15 +53,18 @@ def p4_constraints_deps(): if not native.existing_rule("com_github_p4lang_p4runtime"): http_archive( name = "com_github_p4lang_p4runtime", - urls = ["https://github.com/p4lang/p4runtime/archive/970cbdc1d8663356214d33e3ba213cb91676b491.tar.gz"], - strip_prefix = "p4runtime-970cbdc1d8663356214d33e3ba213cb91676b491/proto", + # Newest commit on main as of 2025-08-27. + urls = ["https://github.com/p4lang/p4runtime/archive/baaf39325ceabd89b04b0d03226b6f13fc9eca29.zip"], + strip_prefix = "p4runtime-baaf39325ceabd89b04b0d03226b6f13fc9eca29/proto", + sha256 = "8b71b8a9e59c3ee7d99653e394afc44a0bfc6437dec14df619d5e1f766f129c6", ) if not native.existing_rule("com_github_p4lang_p4c"): http_archive( name = "com_github_p4lang_p4c", - # Newest commit on main on 2021-12-07. - url = "https://github.com/p4lang/p4c/archive/80629201abb61d9172639fefc7bb5b9d6007db08.zip", - strip_prefix = "p4c-80629201abb61d9172639fefc7bb5b9d6007db08", + # Newest commit on main on 2024-08-01. + url = "https://github.com/p4lang/p4c/archive/44dbcda9c7e3d26d24baadb884b31b32d215edef.zip", + strip_prefix = "p4c-44dbcda9c7e3d26d24baadb884b31b32d215edef", + sha256 = "ae4d53d0fd41572c38b03e881a8e2d2e472df246f75d6a64555f9ff1b656b574", ) if not native.existing_rule("com_github_z3prover_z3"): http_archive( @@ -64,13 +74,6 @@ def p4_constraints_deps(): sha256 = "e3aaefde68b839299cbc988178529535e66048398f7d083b40c69fe0da55f8b7", build_file = "@//:bazel/BUILD.z3.bazel", ) - if not native.existing_rule("rules_cc"): - http_archive( - name = "rules_cc", - urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.16/rules_cc-0.0.16.tar.gz"], - sha256 = "bbf1ae2f83305b7053b11e4467d317a7ba3517a12cef608543c1b1c5bf48a4df", - strip_prefix = "rules_cc-0.0.16", - ) if not native.existing_rule("rules_foreign_cc"): # Required for Z3. http_archive( name = "rules_foreign_cc",