From 3b4549ed94c88d24beb9205d94fe65c36ac6dc2b Mon Sep 17 00:00:00 2001 From: Tony Aiuto Date: Fri, 26 Aug 2022 15:46:53 -0400 Subject: [PATCH 1/5] Update WORKSPACE: - point to bazelbuild/platforms for @platforms - Use a newer version of rules_go for our internal rules. - Make a bzl file used in a test visible to the tests. I believe this fixes a build breakage in bazel at head and 5.3.0 --- WORKSPACE | 34 ++++++++++++++++++++++++++++++++++ cc/BUILD | 1 + 2 files changed, 35 insertions(+) diff --git a/WORKSPACE b/WORKSPACE index 008352c..b4c3639 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -2,6 +2,32 @@ workspace(name = "rules_cc") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +http_archive( + name = "platforms", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.6/platforms-0.0.6.tar.gz", + "https://github.com/bazelbuild/platforms/releases/download/0.0.6/platforms-0.0.6.tar.gz", + ], + sha256 = "5308fc1d8865406a49427ba24a9ab53087f17f5266a7aabbfc28823f3916e1ca", +) + +http_archive( + name = "io_bazel_rules_go", + sha256 = "16e9fca53ed6bd4ff4ad76facc9b7b651a89db1689a2877d6fd7b82aa824e366", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.34.0/rules_go-v0.34.0.zip", + "https://github.com/bazelbuild/rules_go/releases/download/v0.34.0/rules_go-v0.34.0.zip", + ], +) + +load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") + +go_rules_dependencies() + +go_register_toolchains(version = "1.18.4") + +print(1) + http_archive( name = "bazel_federation", sha256 = "0d6893f0d18f417a3324ce7f0ed2e6e5b825d6d5ab42f0f3d7877cb313f36453", @@ -10,6 +36,8 @@ http_archive( url = "https://github.com/bazelbuild/bazel-federation/archive/6ad33bc586701e9836a2bf4432c7aff1235b04d2.zip", # 2019-09-30 ) +print(2) + load("@bazel_federation//:repositories.bzl", "rules_cc_deps") rules_cc_deps() @@ -18,6 +46,8 @@ load("@bazel_federation//setup:rules_cc.bzl", "rules_cc_setup") rules_cc_setup() +print(10) + # # Dependencies for development of rules_cc itself. # @@ -25,6 +55,9 @@ load("//:internal_deps.bzl", "rules_cc_internal_deps") rules_cc_internal_deps() +print(20) + + load("//:internal_setup.bzl", "rules_cc_internal_setup") rules_cc_internal_setup() @@ -63,3 +96,4 @@ local_repository( name = "test_repo", path = "examples/test_cc_shared_library2", ) +print(99) diff --git a/cc/BUILD b/cc/BUILD index bcfa42f..9ddacb7 100644 --- a/cc/BUILD +++ b/cc/BUILD @@ -27,6 +27,7 @@ filegroup( exports_files([ "defs.bzl", "action_names.bzl", + "system_library.bzl", ]) # The toolchain type used to distinguish cc toolchains. From 8438f9e2acdd489a5625e7ea83461157e8f3b8d2 Mon Sep 17 00:00:00 2001 From: Tony Aiuto Date: Thu, 1 Sep 2022 12:23:41 -0400 Subject: [PATCH 2/5] dbg --- WORKSPACE | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index b4c3639..a066a36 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -26,8 +26,6 @@ go_rules_dependencies() go_register_toolchains(version = "1.18.4") -print(1) - http_archive( name = "bazel_federation", sha256 = "0d6893f0d18f417a3324ce7f0ed2e6e5b825d6d5ab42f0f3d7877cb313f36453", @@ -36,8 +34,6 @@ http_archive( url = "https://github.com/bazelbuild/bazel-federation/archive/6ad33bc586701e9836a2bf4432c7aff1235b04d2.zip", # 2019-09-30 ) -print(2) - load("@bazel_federation//:repositories.bzl", "rules_cc_deps") rules_cc_deps() @@ -46,8 +42,6 @@ load("@bazel_federation//setup:rules_cc.bzl", "rules_cc_setup") rules_cc_setup() -print(10) - # # Dependencies for development of rules_cc itself. # @@ -55,9 +49,6 @@ load("//:internal_deps.bzl", "rules_cc_internal_deps") rules_cc_internal_deps() -print(20) - - load("//:internal_setup.bzl", "rules_cc_internal_setup") rules_cc_internal_setup() @@ -96,4 +87,3 @@ local_repository( name = "test_repo", path = "examples/test_cc_shared_library2", ) -print(99) From eafcfc3c886f91b229e85db0f14b41de476a52c4 Mon Sep 17 00:00:00 2001 From: Tony Aiuto Date: Thu, 1 Sep 2022 12:27:58 -0400 Subject: [PATCH 3/5] linty --- WORKSPACE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WORKSPACE b/WORKSPACE index a066a36..7df8789 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -4,11 +4,11 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "platforms", + sha256 = "5308fc1d8865406a49427ba24a9ab53087f17f5266a7aabbfc28823f3916e1ca", urls = [ "https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.6/platforms-0.0.6.tar.gz", "https://github.com/bazelbuild/platforms/releases/download/0.0.6/platforms-0.0.6.tar.gz", ], - sha256 = "5308fc1d8865406a49427ba24a9ab53087f17f5266a7aabbfc28823f3916e1ca", ) http_archive( From 74f87ea2bac8fa31564eedc42294937b843a6629 Mon Sep 17 00:00:00 2001 From: Yun Peng Date: Mon, 19 Sep 2022 14:00:24 +0200 Subject: [PATCH 4/5] Fix MODULE.bazel file The next release for rules_cc would be 0.0.3, and migrate to new toolchain registration API. --- MODULE.bazel | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 08b0c51..77262d9 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -1,8 +1,7 @@ module( name = "rules_cc", compatibility_level = 1, - toolchains_to_register = ["@local_config_cc_toolchains//:all"], - version = "0.0.1", + version = "0.0.3", ) bazel_dep(name = "bazel_skylib", version = "1.0.3") @@ -11,3 +10,4 @@ bazel_dep(name = "platforms", version = "0.0.4") cc_configure = use_extension("@rules_cc//cc:extensions.bzl", "cc_configure") use_repo(cc_configure, "local_config_cc_toolchains") +register_toolchains("@local_config_cc_toolchains//:all") From 4ae6132a12d50bd4b37c40f1d8678b971f181e32 Mon Sep 17 00:00:00 2001 From: Yun Peng Date: Mon, 19 Sep 2022 14:03:31 +0200 Subject: [PATCH 5/5] Make buildifier happy --- MODULE.bazel | 1 + 1 file changed, 1 insertion(+) diff --git a/MODULE.bazel b/MODULE.bazel index 77262d9..31b70f1 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -10,4 +10,5 @@ bazel_dep(name = "platforms", version = "0.0.4") cc_configure = use_extension("@rules_cc//cc:extensions.bzl", "cc_configure") use_repo(cc_configure, "local_config_cc_toolchains") + register_toolchains("@local_config_cc_toolchains//:all")