From 711fb58399a7ce2f279961e7d21e68c805880ed1 Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Tue, 5 Dec 2023 22:25:10 +0000 Subject: [PATCH 01/34] Use gazelle to generate bzl_library targets --- BUILD.bazel | 26 ++-- MODULE.bazel | 8 ++ foreign_cc/BUILD.bazel | 133 ++++++++++++++++-- foreign_cc/built_tools/BUILD.bazel | 46 +++++- foreign_cc/built_tools/private/BUILD.bazel | 13 +- foreign_cc/private/BUILD.bazel | 79 ++++++++++- foreign_cc/private/framework/BUILD.bazel | 26 +++- .../private/framework/toolchains/BUILD.bazel | 47 ++++++- test/BUILD.bazel | 18 +++ toolchains/BUILD.bazel | 38 ++++- toolchains/native_tools/BUILD.bazel | 10 +- 11 files changed, 397 insertions(+), 47 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 17707860e..2f96b2253 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,20 +1,20 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library") +load("@bazel_gazelle//:def.bzl", "DEFAULT_LANGUAGES", "gazelle", "gazelle_binary") -# "@bazel_tools//tools:bzl_srcs" is a filegroup. Convert define a `bzl_library` for it -bzl_library( - name = "bazel_tools_bzl_srcs", - srcs = ["@bazel_tools//tools:bzl_srcs"], +gazelle( + name = "gazelle", + gazelle = ":gazelle_bin", ) -bzl_library( - name = "bzl_srcs", - srcs = glob(["**/*.bzl"]) + [ - "@bazel_tools//tools:bzl_srcs", +gazelle_binary( + name = "gazelle_bin", + languages = DEFAULT_LANGUAGES + [ + "@bazel_skylib_gazelle_plugin//bzl", ], +) + +bzl_library( + name = "version", + srcs = ["version.bzl"], visibility = ["//visibility:public"], - deps = [ - ":bazel_tools_bzl_srcs", - "//foreign_cc:bzl_srcs", - "//toolchains:bzl_srcs", - ], ) diff --git a/MODULE.bazel b/MODULE.bazel index da990d8ac..3af85b781 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -10,6 +10,14 @@ bazel_dep(name = "bazel_skylib", version = "1.1.1") bazel_dep(name = "platforms", version = "0.0.5") bazel_dep(name = "rules_python", version = "0.20.0") +bazel_dep(name = "gazelle", version = "0.34.0", repo_name = "bazel_gazelle", dev_dependency = True) +bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.5.0", dev_dependency = True) +bazel_dep(name = "stardoc", version = "0.5.6", dev_dependency = True, repo_name = "io_bazel_stardoc") + +python = use_extension("@rules_python//python/extensions:python.bzl", "python") +python.toolchain(python_version = "3.9") +use_repo(python, "python_3_9") + tools = use_extension("@rules_foreign_cc//foreign_cc:extensions.bzl", "tools") use_repo( tools, diff --git a/foreign_cc/BUILD.bazel b/foreign_cc/BUILD.bazel index 40aee9b29..36ff30803 100644 --- a/foreign_cc/BUILD.bazel +++ b/foreign_cc/BUILD.bazel @@ -6,15 +6,130 @@ exports_files( ) bzl_library( - name = "bzl_srcs", - srcs = glob(["**/*.bzl"]), - visibility = ["//:__subpackages__"], + name = "boost_build", + srcs = ["boost_build.bzl"], + visibility = ["//visibility:public"], + deps = [ + "//foreign_cc/private:detect_root", + "//foreign_cc/private:framework", + ], +) + +bzl_library( + name = "cmake", + srcs = ["cmake.bzl"], + visibility = ["//visibility:public"], deps = [ - "//foreign_cc/built_tools:bzl_srcs", - "//foreign_cc/private:bzl_srcs", - "@bazel_skylib//lib:collections", - "@bazel_skylib//lib:paths", - "@bazel_skylib//lib:versions", - "@rules_python//docs:defs", + "//foreign_cc/private:cc_toolchain_util", + "//foreign_cc/private:cmake_script", + "//foreign_cc/private:detect_root", + "//foreign_cc/private:framework", + "//foreign_cc/private:transitions", + "//foreign_cc/private/framework:platform", + "//toolchains/native_tools:tool_access", ], ) + +bzl_library( + name = "configure", + srcs = ["configure.bzl"], + visibility = ["//visibility:public"], + deps = [ + "//foreign_cc/private:cc_toolchain_util", + "//foreign_cc/private:configure_script", + "//foreign_cc/private:detect_root", + "//foreign_cc/private:framework", + "//foreign_cc/private:transitions", + "//toolchains/native_tools:tool_access", + ], +) + +bzl_library( + name = "defs", + srcs = ["defs.bzl"], + visibility = ["//visibility:public"], + deps = [ + ":boost_build", + ":cmake", + ":configure", + ":make", + ":meson", + ":ninja", + ":utils", + ], +) + +bzl_library( + name = "extensions", + srcs = ["extensions.bzl"], + visibility = ["//visibility:public"], + deps = [ + ":repositories", + "//toolchains:prebuilt_toolchains", + ], +) + +bzl_library( + name = "make", + srcs = ["make.bzl"], + visibility = ["//visibility:public"], + deps = [ + "//foreign_cc/private:cc_toolchain_util", + "//foreign_cc/private:detect_root", + "//foreign_cc/private:framework", + "//foreign_cc/private:make_script", + "//foreign_cc/private:transitions", + "//toolchains/native_tools:tool_access", + ], +) + +bzl_library( + name = "meson", + srcs = ["meson.bzl"], + visibility = ["//visibility:public"], + deps = [ + ":utils", + "//foreign_cc/built_tools:meson_build", + "//foreign_cc/private:detect_root", + "//foreign_cc/private:framework", + "//foreign_cc/private:make_script", + "//foreign_cc/private:transitions", + "//toolchains/native_tools:native_tools_toolchain", + "//toolchains/native_tools:tool_access", + ], +) + +bzl_library( + name = "ninja", + srcs = ["ninja.bzl"], + visibility = ["//visibility:public"], + deps = [ + "//foreign_cc/private:detect_root", + "//foreign_cc/private:framework", + "//toolchains/native_tools:tool_access", + ], +) + +bzl_library( + name = "repositories", + srcs = ["repositories.bzl"], + visibility = ["//visibility:public"], + deps = [ + "//foreign_cc/private/framework:toolchain", + "//toolchains", + "@bazel_tools//tools/build_defs/repo:http.bzl", + "@bazel_tools//tools/build_defs/repo:utils.bzl", + ], +) + +bzl_library( + name = "providers", + srcs = ["providers.bzl"], + visibility = ["//visibility:public"], +) + +bzl_library( + name = "utils", + srcs = ["utils.bzl"], + visibility = ["//visibility:public"], +) diff --git a/foreign_cc/built_tools/BUILD.bazel b/foreign_cc/built_tools/BUILD.bazel index 8d2354ebc..862ee3198 100644 --- a/foreign_cc/built_tools/BUILD.bazel +++ b/foreign_cc/built_tools/BUILD.bazel @@ -1,10 +1,48 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library") bzl_library( - name = "bzl_srcs", - srcs = glob(["**/*.bzl"]), - visibility = ["//:__subpackages__"], + name = "cmake_build", + srcs = ["cmake_build.bzl"], + visibility = ["//visibility:public"], + deps = ["//foreign_cc:defs"], +) + +bzl_library( + name = "make_build", + srcs = ["make_build.bzl"], + visibility = ["//visibility:public"], + deps = [ + "//foreign_cc/built_tools/private:built_tools_framework", + "//foreign_cc/private:cc_toolchain_util", + "//foreign_cc/private/framework:platform", + "@bazel_tools//tools/cpp:toolchain_utils.bzl", + ], +) + +bzl_library( + name = "meson_build", + srcs = ["meson_build.bzl"], + visibility = ["//visibility:public"], + deps = ["@rules_python//python:defs"], +) + +bzl_library( + name = "ninja_build", + srcs = ["ninja_build.bzl"], + visibility = ["//visibility:public"], + deps = [ + "//foreign_cc/built_tools/private:built_tools_framework", + "//foreign_cc/private/framework:platform", + ], +) + +bzl_library( + name = "pkgconfig_build", + srcs = ["pkgconfig_build.bzl"], + visibility = ["//visibility:public"], deps = [ - "//foreign_cc/built_tools/private:bzl_srcs", + "//foreign_cc:defs", + "//foreign_cc/built_tools/private:built_tools_framework", + "//toolchains/native_tools:tool_access", ], ) diff --git a/foreign_cc/built_tools/private/BUILD.bazel b/foreign_cc/built_tools/private/BUILD.bazel index e4db260d3..c54965456 100644 --- a/foreign_cc/built_tools/private/BUILD.bazel +++ b/foreign_cc/built_tools/private/BUILD.bazel @@ -1,7 +1,14 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library") bzl_library( - name = "bzl_srcs", - srcs = glob(["**/*.bzl"]), - visibility = ["//:__subpackages__"], + name = "built_tools_framework", + srcs = ["built_tools_framework.bzl"], + visibility = ["//foreign_cc/built_tools:__subpackages__"], + deps = [ + "//foreign_cc/private:cc_toolchain_util", + "//foreign_cc/private:detect_root", + "//foreign_cc/private:framework", + "//foreign_cc/private/framework:helpers", + "@bazel_tools//tools/cpp:toolchain_utils.bzl", + ], ) diff --git a/foreign_cc/private/BUILD.bazel b/foreign_cc/private/BUILD.bazel index 4f1acabfc..cd1cf93f2 100644 --- a/foreign_cc/private/BUILD.bazel +++ b/foreign_cc/private/BUILD.bazel @@ -5,10 +5,81 @@ exports_files([ ]) bzl_library( - name = "bzl_srcs", - srcs = glob(["**/*.bzl"]), - visibility = ["//:__subpackages__"], + name = "cc_toolchain_util", + srcs = ["cc_toolchain_util.bzl"], + visibility = ["//foreign_cc:__subpackages__"], deps = [ - "//foreign_cc/private/framework:bzl_srcs", + "@bazel_skylib//lib:collections", + "@bazel_tools//tools/build_defs/cc:action_names.bzl", + "@bazel_tools//tools/cpp:toolchain_utils.bzl", ], ) + +bzl_library( + name = "cmake_script", + srcs = ["cmake_script.bzl"], + visibility = ["//foreign_cc:__subpackages__"], + deps = [":cc_toolchain_util"], +) + +bzl_library( + name = "configure_script", + srcs = ["configure_script.bzl"], + visibility = ["//foreign_cc:__subpackages__"], + deps = [ + ":make_env_vars", + ":make_script", + ], +) + +bzl_library( + name = "framework", + srcs = ["framework.bzl"], + visibility = ["//foreign_cc:__subpackages__"], + deps = [ + ":cc_toolchain_util", + ":detect_root", + ":run_shell_file_utils", + "//foreign_cc:providers", + "//foreign_cc/private/framework:helpers", + "@bazel_skylib//lib:collections", + "@bazel_skylib//lib:paths", + "@bazel_tools//tools/cpp:toolchain_utils.bzl", + ], +) + +bzl_library( + name = "make_env_vars", + srcs = ["make_env_vars.bzl"], + visibility = ["//foreign_cc:__subpackages__"], + deps = [ + ":cc_toolchain_util", + ":framework", + ], +) + +bzl_library( + name = "make_script", + srcs = ["make_script.bzl"], + visibility = ["//foreign_cc:__subpackages__"], + deps = [":make_env_vars"], +) + +bzl_library( + name = "transitions", + srcs = ["transitions.bzl"], + visibility = ["//foreign_cc:__subpackages__"], + deps = ["//foreign_cc:providers"], +) + +bzl_library( + name = "detect_root", + srcs = ["detect_root.bzl"], + visibility = ["//foreign_cc:__subpackages__"], +) + +bzl_library( + name = "run_shell_file_utils", + srcs = ["run_shell_file_utils.bzl"], + visibility = ["//foreign_cc:__subpackages__"], +) diff --git a/foreign_cc/private/framework/BUILD.bazel b/foreign_cc/private/framework/BUILD.bazel index e7c6a0cee..bc56360b5 100644 --- a/foreign_cc/private/framework/BUILD.bazel +++ b/foreign_cc/private/framework/BUILD.bazel @@ -6,11 +6,27 @@ toolchain_type( visibility = ["//visibility:public"], ) +framework_platform_info() + bzl_library( - name = "bzl_srcs", - srcs = glob(["**/*.bzl"]), - visibility = ["//:__subpackages__"], - deps = ["//foreign_cc/private/framework/toolchains:bzl_srcs"], + name = "helpers", + srcs = ["helpers.bzl"], + visibility = ["//foreign_cc:__subpackages__"], + deps = [ + "//foreign_cc/private/framework/toolchains:access", + "//foreign_cc/private/framework/toolchains:commands", + ], ) -framework_platform_info() +bzl_library( + name = "toolchain", + srcs = ["toolchain.bzl"], + visibility = ["//foreign_cc:__subpackages__"], + deps = ["//foreign_cc/private/framework/toolchains:mappings"], +) + +bzl_library( + name = "platform", + srcs = ["platform.bzl"], + visibility = ["//foreign_cc:__subpackages__"], +) diff --git a/foreign_cc/private/framework/toolchains/BUILD.bazel b/foreign_cc/private/framework/toolchains/BUILD.bazel index e4db260d3..0c2dc6be9 100644 --- a/foreign_cc/private/framework/toolchains/BUILD.bazel +++ b/foreign_cc/private/framework/toolchains/BUILD.bazel @@ -1,7 +1,48 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library") bzl_library( - name = "bzl_srcs", - srcs = glob(["**/*.bzl"]), - visibility = ["//:__subpackages__"], + name = "access", + srcs = ["access.bzl"], + visibility = ["//foreign_cc:__subpackages__"], + deps = [":commands"], +) + +bzl_library( + name = "freebsd_commands", + srcs = ["freebsd_commands.bzl"], + visibility = ["//foreign_cc:__subpackages__"], + deps = [":commands"], +) + +bzl_library( + name = "linux_commands", + srcs = ["linux_commands.bzl"], + visibility = ["//foreign_cc:__subpackages__"], + deps = [":commands"], +) + +bzl_library( + name = "macos_commands", + srcs = ["macos_commands.bzl"], + visibility = ["//foreign_cc:__subpackages__"], + deps = [":commands"], +) + +bzl_library( + name = "windows_commands", + srcs = ["windows_commands.bzl"], + visibility = ["//foreign_cc:__subpackages__"], + deps = [":commands"], +) + +bzl_library( + name = "commands", + srcs = ["commands.bzl"], + visibility = ["//foreign_cc:__subpackages__"], +) + +bzl_library( + name = "mappings", + srcs = ["mappings.bzl"], + visibility = ["//foreign_cc:__subpackages__"], ) diff --git a/test/BUILD.bazel b/test/BUILD.bazel index 710da2ccd..9521ec4b5 100644 --- a/test/BUILD.bazel +++ b/test/BUILD.bazel @@ -1,3 +1,4 @@ +load("@bazel_skylib//:bzl_library.bzl", "bzl_library") load("@bazel_skylib//rules:diff_test.bzl", "diff_test") load(":cmake_text_tests.bzl", "cmake_script_test_suite") load(":convert_shell_script_test.bzl", "shell_script_conversion_suite") @@ -71,3 +72,20 @@ diff_test( }), file2 = ":symlink_dirs", ) + +bzl_library( + name = "shell_script_helper_test_rule", + srcs = ["shell_script_helper_test_rule.bzl"], + visibility = ["//visibility:public"], + deps = ["//foreign_cc/private/framework:helpers"], +) + +bzl_library( + name = "symlink_contents_to_dir_test_rule", + srcs = ["symlink_contents_to_dir_test_rule.bzl"], + visibility = ["//visibility:public"], + deps = [ + "@rules_foreign_cc//foreign_cc/private:detect_root", + "@rules_foreign_cc//foreign_cc/private/framework:helpers", + ], +) diff --git a/toolchains/BUILD.bazel b/toolchains/BUILD.bazel index e41886bb6..d1a2a5aad 100644 --- a/toolchains/BUILD.bazel +++ b/toolchains/BUILD.bazel @@ -334,10 +334,40 @@ native_tool_toolchain( ) bzl_library( - name = "bzl_srcs", - srcs = glob(["**/*.bzl"]), - visibility = ["//:__subpackages__"], + name = "built_toolchains", + srcs = ["built_toolchains.bzl"], deps = [ - "//toolchains/native_tools:bzl_srcs", + "@bazel_tools//tools/build_defs/repo:http.bzl", + "@bazel_tools//tools/build_defs/repo:utils.bzl", + "@rules_foreign_cc//toolchains:cmake_versions", ], ) + +bzl_library( + name = "prebuilt_toolchains", + srcs = ["prebuilt_toolchains.bzl"], + deps = [ + "@bazel_tools//tools/build_defs/repo:http.bzl", + "@bazel_tools//tools/build_defs/repo:utils.bzl", + "@rules_foreign_cc//toolchains:prebuilt_toolchains_repository", + ], +) + +bzl_library( + name = "toolchains", + srcs = ["toolchains.bzl"], + deps = [ + ":built_toolchains", + ":prebuilt_toolchains", + ], +) + +bzl_library( + name = "cmake_versions", + srcs = ["cmake_versions.bzl"], +) + +bzl_library( + name = "prebuilt_toolchains_repository", + srcs = ["prebuilt_toolchains_repository.bzl"], +) diff --git a/toolchains/native_tools/BUILD.bazel b/toolchains/native_tools/BUILD.bazel index d42fc71c8..0991ecb60 100644 --- a/toolchains/native_tools/BUILD.bazel +++ b/toolchains/native_tools/BUILD.bazel @@ -1,7 +1,13 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library") bzl_library( - name = "bzl_srcs", - srcs = glob(["**/*.bzl"]), + name = "native_tools_toolchain", + srcs = ["native_tools_toolchain.bzl"], + visibility = ["//visibility:public"], +) + +bzl_library( + name = "tool_access", + srcs = ["tool_access.bzl"], visibility = ["//visibility:public"], ) From 6acd6609dad01cb437d1ed5c578534a66df3b9b2 Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Tue, 5 Dec 2023 22:42:10 +0000 Subject: [PATCH 02/34] Add gazelle to WORKSPACE --- WORKSPACE.bazel | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index a0827399b..ff50b05b5 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -41,3 +41,49 @@ rbe_preconfig( name = "buildkite_config", toolchain = "ubuntu1804-bazel-java11", ) + +# Gazelle dependencies + +http_archive( + name = "io_bazel_rules_go", + sha256 = "91585017debb61982f7054c9688857a2ad1fd823fc3f9cb05048b0025c47d023", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.42.0/rules_go-v0.42.0.zip", + "https://github.com/bazelbuild/rules_go/releases/download/v0.42.0/rules_go-v0.42.0.zip", + ], +) + +http_archive( + name = "bazel_gazelle", + sha256 = "b7387f72efb59f876e4daae42f1d3912d0d45563eac7cb23d1de0b094ab588cf", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.34.0/bazel-gazelle-v0.34.0.tar.gz", + "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.34.0/bazel-gazelle-v0.34.0.tar.gz", + ], +) + +http_archive( + name = "bazel_skylib_gazelle_plugin", + sha256 = "747addf3f508186234f6232674dd7786743efb8c68619aece5fb0cac97b8f415", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.5.0/bazel-skylib-gazelle-plugin-1.5.0.tar.gz", + "https://github.com/bazelbuild/bazel-skylib/releases/download/1.5.0/bazel-skylib-gazelle-plugin-1.5.0.tar.gz", + ], +) + +load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") +load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository") + +go_rules_dependencies() + +go_register_toolchains(version = "1.20.5") + +gazelle_dependencies(go_repository_default_config = "//:WORKSPACE.bazel") + +load("@bazel_skylib_gazelle_plugin//:workspace.bzl", "bazel_skylib_gazelle_plugin_workspace") + +bazel_skylib_gazelle_plugin_workspace() + +load("@bazel_skylib_gazelle_plugin//:setup.bzl", "bazel_skylib_gazelle_plugin_setup") + +bazel_skylib_gazelle_plugin_setup() From 4c162b0dcc7964eecf7f4ad1b0cbee6c41c52d71 Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Tue, 5 Dec 2023 22:43:54 +0000 Subject: [PATCH 03/34] Reorder --- WORKSPACE.bazel | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index ff50b05b5..44e1836e6 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -76,8 +76,6 @@ load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository") go_rules_dependencies() -go_register_toolchains(version = "1.20.5") - gazelle_dependencies(go_repository_default_config = "//:WORKSPACE.bazel") load("@bazel_skylib_gazelle_plugin//:workspace.bzl", "bazel_skylib_gazelle_plugin_workspace") @@ -87,3 +85,5 @@ bazel_skylib_gazelle_plugin_workspace() load("@bazel_skylib_gazelle_plugin//:setup.bzl", "bazel_skylib_gazelle_plugin_setup") bazel_skylib_gazelle_plugin_setup() + +go_register_toolchains(version = "1.20.5") From a63da6297ee30caa0355639645b89e3046542f56 Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Tue, 5 Dec 2023 22:51:20 +0000 Subject: [PATCH 04/34] Updates --- .bazelci/config.yaml | 9 +-------- WORKSPACE.bazel | 2 +- docs/WORKSPACE.bazel | 46 +++++++++++++++++++++++++++++++++++++++++++ examples/MODULE.bazel | 3 +-- 4 files changed, 49 insertions(+), 11 deletions(-) diff --git a/.bazelci/config.yaml b/.bazelci/config.yaml index e689c45c2..3bf83fbb8 100644 --- a/.bazelci/config.yaml +++ b/.bazelci/config.yaml @@ -201,19 +201,12 @@ tasks: - //... min_supported_version: name: "Minimum Supported Version" - bazel: "4.0.0" - skip_in_bazel_downstream_pipeline: "Bazel 4 required" + bazel: "5.4.0" platform: ubuntu1804 build_targets: - "//..." - # experimental_enable_aggregating_middleman=False is required in bazel 4 otherwise ctx.resolve_command fails. - # This was resolved in https://github.com/bazelbuild/bazel/commit/fb1c369530bd26f9a13560c5979929a999e585e2 - build_flags: - - "--experimental_enable_aggregating_middleman=False" test_targets: - "//..." - test_flags: - - "--experimental_enable_aggregating_middleman=False" min_supported_version_examples: name: "Minimum Supported Version Examples" bazel: "5.4.0" diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index 44e1836e6..e7fa735a7 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -72,7 +72,7 @@ http_archive( ) load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") -load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository") +load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") go_rules_dependencies() diff --git a/docs/WORKSPACE.bazel b/docs/WORKSPACE.bazel index 4de80bb0c..e01248e9a 100644 --- a/docs/WORKSPACE.bazel +++ b/docs/WORKSPACE.bazel @@ -16,3 +16,49 @@ stardoc_repository() load("//:stardoc_deps.bzl", "stardoc_deps") stardoc_deps() + +# Gazelle dependencies + +http_archive( + name = "io_bazel_rules_go", + sha256 = "91585017debb61982f7054c9688857a2ad1fd823fc3f9cb05048b0025c47d023", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.42.0/rules_go-v0.42.0.zip", + "https://github.com/bazelbuild/rules_go/releases/download/v0.42.0/rules_go-v0.42.0.zip", + ], +) + +http_archive( + name = "bazel_gazelle", + sha256 = "b7387f72efb59f876e4daae42f1d3912d0d45563eac7cb23d1de0b094ab588cf", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.34.0/bazel-gazelle-v0.34.0.tar.gz", + "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.34.0/bazel-gazelle-v0.34.0.tar.gz", + ], +) + +http_archive( + name = "bazel_skylib_gazelle_plugin", + sha256 = "747addf3f508186234f6232674dd7786743efb8c68619aece5fb0cac97b8f415", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.5.0/bazel-skylib-gazelle-plugin-1.5.0.tar.gz", + "https://github.com/bazelbuild/bazel-skylib/releases/download/1.5.0/bazel-skylib-gazelle-plugin-1.5.0.tar.gz", + ], +) + +load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") +load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") + +go_rules_dependencies() + +gazelle_dependencies(go_repository_default_config = "//:WORKSPACE.bazel") + +load("@bazel_skylib_gazelle_plugin//:workspace.bzl", "bazel_skylib_gazelle_plugin_workspace") + +bazel_skylib_gazelle_plugin_workspace() + +load("@bazel_skylib_gazelle_plugin//:setup.bzl", "bazel_skylib_gazelle_plugin_setup") + +bazel_skylib_gazelle_plugin_setup() + +go_register_toolchains(version = "1.20.5") diff --git a/examples/MODULE.bazel b/examples/MODULE.bazel index 2b6a3ca22..66fe64207 100644 --- a/examples/MODULE.bazel +++ b/examples/MODULE.bazel @@ -23,8 +23,7 @@ python.toolchain( name = "python3_9", python_version = "3.9", ) -use_repo(python, "python3_9") -use_repo(python, "python3_9_toolchains") +use_repo(python, "python3_9", "python3_9_toolchains") register_toolchains( "@python3_9_toolchains//:all", From 318e6ab83e88fa252cc9fc7d3147295d2aad57ba Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Tue, 5 Dec 2023 23:04:45 +0000 Subject: [PATCH 05/34] Remove version for go --- WORKSPACE.bazel | 2 +- docs/WORKSPACE.bazel | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index e7fa735a7..9a14d4f76 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -86,4 +86,4 @@ load("@bazel_skylib_gazelle_plugin//:setup.bzl", "bazel_skylib_gazelle_plugin_se bazel_skylib_gazelle_plugin_setup() -go_register_toolchains(version = "1.20.5") +go_register_toolchains() diff --git a/docs/WORKSPACE.bazel b/docs/WORKSPACE.bazel index e01248e9a..d4af88dfe 100644 --- a/docs/WORKSPACE.bazel +++ b/docs/WORKSPACE.bazel @@ -61,4 +61,4 @@ load("@bazel_skylib_gazelle_plugin//:setup.bzl", "bazel_skylib_gazelle_plugin_se bazel_skylib_gazelle_plugin_setup() -go_register_toolchains(version = "1.20.5") +go_register_toolchains() From c7ba568d9ad653e2838e45a5093df36f43c58084 Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Tue, 5 Dec 2023 23:17:26 +0000 Subject: [PATCH 06/34] Fix --- WORKSPACE.bazel | 19 ++----------------- docs/WORKSPACE.bazel | 19 ++----------------- 2 files changed, 4 insertions(+), 34 deletions(-) diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index 9a14d4f76..5d8be6686 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -44,15 +44,6 @@ rbe_preconfig( # Gazelle dependencies -http_archive( - name = "io_bazel_rules_go", - sha256 = "91585017debb61982f7054c9688857a2ad1fd823fc3f9cb05048b0025c47d023", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.42.0/rules_go-v0.42.0.zip", - "https://github.com/bazelbuild/rules_go/releases/download/v0.42.0/rules_go-v0.42.0.zip", - ], -) - http_archive( name = "bazel_gazelle", sha256 = "b7387f72efb59f876e4daae42f1d3912d0d45563eac7cb23d1de0b094ab588cf", @@ -71,19 +62,13 @@ http_archive( ], ) -load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") -load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") - -go_rules_dependencies() - -gazelle_dependencies(go_repository_default_config = "//:WORKSPACE.bazel") - load("@bazel_skylib_gazelle_plugin//:workspace.bzl", "bazel_skylib_gazelle_plugin_workspace") bazel_skylib_gazelle_plugin_workspace() +load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") load("@bazel_skylib_gazelle_plugin//:setup.bzl", "bazel_skylib_gazelle_plugin_setup") bazel_skylib_gazelle_plugin_setup() -go_register_toolchains() +gazelle_dependencies(go_repository_default_config = "//:WORKSPACE.bazel") diff --git a/docs/WORKSPACE.bazel b/docs/WORKSPACE.bazel index d4af88dfe..46937165b 100644 --- a/docs/WORKSPACE.bazel +++ b/docs/WORKSPACE.bazel @@ -19,15 +19,6 @@ stardoc_deps() # Gazelle dependencies -http_archive( - name = "io_bazel_rules_go", - sha256 = "91585017debb61982f7054c9688857a2ad1fd823fc3f9cb05048b0025c47d023", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.42.0/rules_go-v0.42.0.zip", - "https://github.com/bazelbuild/rules_go/releases/download/v0.42.0/rules_go-v0.42.0.zip", - ], -) - http_archive( name = "bazel_gazelle", sha256 = "b7387f72efb59f876e4daae42f1d3912d0d45563eac7cb23d1de0b094ab588cf", @@ -46,19 +37,13 @@ http_archive( ], ) -load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") -load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") - -go_rules_dependencies() - -gazelle_dependencies(go_repository_default_config = "//:WORKSPACE.bazel") - load("@bazel_skylib_gazelle_plugin//:workspace.bzl", "bazel_skylib_gazelle_plugin_workspace") bazel_skylib_gazelle_plugin_workspace() +load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") load("@bazel_skylib_gazelle_plugin//:setup.bzl", "bazel_skylib_gazelle_plugin_setup") bazel_skylib_gazelle_plugin_setup() -go_register_toolchains() +gazelle_dependencies(go_repository_default_config = "//:WORKSPACE.bazel") From 70e09ee1be1177ad63fe1202e33df1fec1d7557a Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Tue, 5 Dec 2023 23:24:44 +0000 Subject: [PATCH 07/34] Fix --- foreign_cc/built_tools/BUILD.bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foreign_cc/built_tools/BUILD.bazel b/foreign_cc/built_tools/BUILD.bazel index 862ee3198..29f8d06ba 100644 --- a/foreign_cc/built_tools/BUILD.bazel +++ b/foreign_cc/built_tools/BUILD.bazel @@ -23,7 +23,7 @@ bzl_library( name = "meson_build", srcs = ["meson_build.bzl"], visibility = ["//visibility:public"], - deps = ["@rules_python//python:defs"], + deps = ["@rules_python//python:defs_bzl"], ) bzl_library( From d7599d14c1bd151aa78a21a8d523a26e39fc4cba Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Tue, 5 Dec 2023 23:25:33 +0000 Subject: [PATCH 08/34] Fix --- docs/WORKSPACE.bazel | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/WORKSPACE.bazel b/docs/WORKSPACE.bazel index 46937165b..5fba82513 100644 --- a/docs/WORKSPACE.bazel +++ b/docs/WORKSPACE.bazel @@ -19,6 +19,8 @@ stardoc_deps() # Gazelle dependencies +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + http_archive( name = "bazel_gazelle", sha256 = "b7387f72efb59f876e4daae42f1d3912d0d45563eac7cb23d1de0b094ab588cf", From 13eb203aaeeae5f385450f7195ad2b52a07de4ab Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Tue, 5 Dec 2023 23:33:00 +0000 Subject: [PATCH 09/34] Fix visibility --- foreign_cc/private/BUILD.bazel | 2 +- foreign_cc/private/framework/BUILD.bazel | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/foreign_cc/private/BUILD.bazel b/foreign_cc/private/BUILD.bazel index cd1cf93f2..f0b7244ac 100644 --- a/foreign_cc/private/BUILD.bazel +++ b/foreign_cc/private/BUILD.bazel @@ -75,7 +75,7 @@ bzl_library( bzl_library( name = "detect_root", srcs = ["detect_root.bzl"], - visibility = ["//foreign_cc:__subpackages__"], + visibility = ["//foreign_cc:__subpackages__", "//test:__subpackages__"], ) bzl_library( diff --git a/foreign_cc/private/framework/BUILD.bazel b/foreign_cc/private/framework/BUILD.bazel index bc56360b5..46e5bf5b9 100644 --- a/foreign_cc/private/framework/BUILD.bazel +++ b/foreign_cc/private/framework/BUILD.bazel @@ -11,7 +11,7 @@ framework_platform_info() bzl_library( name = "helpers", srcs = ["helpers.bzl"], - visibility = ["//foreign_cc:__subpackages__"], + visibility = ["//foreign_cc:__subpackages__", "//test:__subpackages__"], deps = [ "//foreign_cc/private/framework/toolchains:access", "//foreign_cc/private/framework/toolchains:commands", From ead33119baa7095e0afa249059dc19d60b5774fe Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Tue, 5 Dec 2023 23:41:01 +0000 Subject: [PATCH 10/34] Docs fix --- docs/BUILD.bazel | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/BUILD.bazel b/docs/BUILD.bazel index ac11cd87b..67c0401d2 100644 --- a/docs/BUILD.bazel +++ b/docs/BUILD.bazel @@ -29,7 +29,7 @@ stardoc( out = "stardoc_cmake.md", header_template = "common_header.vm", input = "@rules_foreign_cc//foreign_cc:cmake.bzl", - deps = ["@rules_foreign_cc//:bzl_srcs"], + deps = ["@rules_foreign_cc//foreign_cc:cmake"], ) stardoc( @@ -37,7 +37,7 @@ stardoc( out = "stardoc_make.md", header_template = "common_header.vm", input = "@rules_foreign_cc//foreign_cc:make.bzl", - deps = ["@rules_foreign_cc//:bzl_srcs"], + deps = ["@rules_foreign_cc//foreign_cc:make"], ) stardoc( @@ -45,7 +45,7 @@ stardoc( out = "stardoc_ninja.md", header_template = "common_header.vm", input = "@rules_foreign_cc//foreign_cc:ninja.bzl", - deps = ["@rules_foreign_cc//:bzl_srcs"], + deps = ["@rules_foreign_cc//foreign_cc:ninja"], ) stardoc( @@ -53,7 +53,7 @@ stardoc( out = "stardoc_configure_make.md", header_template = "common_header.vm", input = "@rules_foreign_cc//foreign_cc:configure.bzl", - deps = ["@rules_foreign_cc//:bzl_srcs"], + deps = ["@rules_foreign_cc//foreign_cc:configure"], ) stardoc( @@ -61,7 +61,7 @@ stardoc( out = "stardoc_meson.md", header_template = "common_header.vm", input = "@rules_foreign_cc//foreign_cc:meson.bzl", - deps = ["@rules_foreign_cc//:bzl_srcs"], + deps = ["@rules_foreign_cc//foreign_cc:meson"], ) stardoc( @@ -69,7 +69,7 @@ stardoc( out = "stardoc_providers.md", header_template = "common_header.vm", input = "@rules_foreign_cc//foreign_cc:providers.bzl", - deps = ["@rules_foreign_cc//:bzl_srcs"], + deps = ["@rules_foreign_cc//foreign_cc:providers"], ) DOCS_TARGETS = [ From 234cf31a3428ca1bc8c2c17e9ddcf195dd1294a2 Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Tue, 5 Dec 2023 23:43:51 +0000 Subject: [PATCH 11/34] Format --- MODULE.bazel | 12 +++++++----- foreign_cc/private/BUILD.bazel | 5 ++++- foreign_cc/private/framework/BUILD.bazel | 5 ++++- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 3af85b781..ec8d7b02f 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -2,23 +2,25 @@ module( name = "rules_foreign_cc", - version = "0.0.0", compatibility_level = 1, + version = "0.0.0", ) bazel_dep(name = "bazel_skylib", version = "1.1.1") bazel_dep(name = "platforms", version = "0.0.5") bazel_dep(name = "rules_python", version = "0.20.0") - -bazel_dep(name = "gazelle", version = "0.34.0", repo_name = "bazel_gazelle", dev_dependency = True) -bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.5.0", dev_dependency = True) -bazel_dep(name = "stardoc", version = "0.5.6", dev_dependency = True, repo_name = "io_bazel_stardoc") +bazel_dep(name = "gazelle", dev_dependency = True, repo_name = "bazel_gazelle", version = "0.34.0") +bazel_dep(name = "bazel_skylib_gazelle_plugin", dev_dependency = True, version = "1.5.0") +bazel_dep(name = "stardoc", dev_dependency = True, repo_name = "io_bazel_stardoc", version = "0.5.6") python = use_extension("@rules_python//python/extensions:python.bzl", "python") + python.toolchain(python_version = "3.9") + use_repo(python, "python_3_9") tools = use_extension("@rules_foreign_cc//foreign_cc:extensions.bzl", "tools") + use_repo( tools, "cmake_3.23.2_toolchains", diff --git a/foreign_cc/private/BUILD.bazel b/foreign_cc/private/BUILD.bazel index f0b7244ac..ccbe9db95 100644 --- a/foreign_cc/private/BUILD.bazel +++ b/foreign_cc/private/BUILD.bazel @@ -75,7 +75,10 @@ bzl_library( bzl_library( name = "detect_root", srcs = ["detect_root.bzl"], - visibility = ["//foreign_cc:__subpackages__", "//test:__subpackages__"], + visibility = [ + "//foreign_cc:__subpackages__", + "//test:__subpackages__", + ], ) bzl_library( diff --git a/foreign_cc/private/framework/BUILD.bazel b/foreign_cc/private/framework/BUILD.bazel index 46e5bf5b9..e41256186 100644 --- a/foreign_cc/private/framework/BUILD.bazel +++ b/foreign_cc/private/framework/BUILD.bazel @@ -11,7 +11,10 @@ framework_platform_info() bzl_library( name = "helpers", srcs = ["helpers.bzl"], - visibility = ["//foreign_cc:__subpackages__", "//test:__subpackages__"], + visibility = [ + "//foreign_cc:__subpackages__", + "//test:__subpackages__", + ], deps = [ "//foreign_cc/private/framework/toolchains:access", "//foreign_cc/private/framework/toolchains:commands", From 5f0922294a97ac53cac5809fd68e451752851391 Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Tue, 5 Dec 2023 23:49:57 +0000 Subject: [PATCH 12/34] Bump min python version --- MODULE.bazel | 8 +------- examples/MODULE.bazel | 23 ++--------------------- 2 files changed, 3 insertions(+), 28 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index ec8d7b02f..b6b5f9451 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -8,17 +8,11 @@ module( bazel_dep(name = "bazel_skylib", version = "1.1.1") bazel_dep(name = "platforms", version = "0.0.5") -bazel_dep(name = "rules_python", version = "0.20.0") +bazel_dep(name = "rules_python", version = "0.23.0") bazel_dep(name = "gazelle", dev_dependency = True, repo_name = "bazel_gazelle", version = "0.34.0") bazel_dep(name = "bazel_skylib_gazelle_plugin", dev_dependency = True, version = "1.5.0") bazel_dep(name = "stardoc", dev_dependency = True, repo_name = "io_bazel_stardoc", version = "0.5.6") -python = use_extension("@rules_python//python/extensions:python.bzl", "python") - -python.toolchain(python_version = "3.9") - -use_repo(python, "python_3_9") - tools = use_extension("@rules_foreign_cc//foreign_cc:extensions.bzl", "tools") use_repo( diff --git a/examples/MODULE.bazel b/examples/MODULE.bazel index 66fe64207..0fb5ec9a5 100644 --- a/examples/MODULE.bazel +++ b/examples/MODULE.bazel @@ -16,30 +16,11 @@ bazel_dep(name = "platforms", version = "0.0.6") bazel_dep(name = "rules_swift", version = "1.6.0", repo_name = "build_bazel_rules_swift") bazel_dep(name = "rules_apple", version = "3.0.0-rc1", repo_name = "build_bazel_rules_apple") bazel_dep(name = "apple_support", version = "1.4.1", repo_name = "build_bazel_apple_support") -bazel_dep(name = "rules_python", version = "0.22.0") - -python = use_extension("@rules_python//python/extensions:python.bzl", "python") -python.toolchain( - name = "python3_9", - python_version = "3.9", -) -use_repo(python, "python3_9", "python3_9_toolchains") - -register_toolchains( - "@python3_9_toolchains//:all", -) - -interpreter = use_extension("@rules_python//python/extensions:interpreter.bzl", "interpreter") -interpreter.install( - name = "interpreter_python3_9", - python_name = "python3_9", -) -use_repo(interpreter, "interpreter_python3_9") +bazel_dep(name = "rules_python", version = "0.23.0") pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip") pip.parse( - name = "pip", - python_interpreter_target = "@interpreter_python3_9//:python", + hub_name = "pip", requirements_lock = "//:requirements_lock.txt", requirements_windows = "//:requirements_windows.txt", ) From dd15cb76ba79b1c1c313b0eb201cb1bc91a2304c Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Tue, 5 Dec 2023 23:52:51 +0000 Subject: [PATCH 13/34] python pip --- examples/MODULE.bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/MODULE.bazel b/examples/MODULE.bazel index 0fb5ec9a5..61e8685b6 100644 --- a/examples/MODULE.bazel +++ b/examples/MODULE.bazel @@ -20,7 +20,7 @@ bazel_dep(name = "rules_python", version = "0.23.0") pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip") pip.parse( - hub_name = "pip", + name = "pip", requirements_lock = "//:requirements_lock.txt", requirements_windows = "//:requirements_windows.txt", ) From 0a2a59bae77f6c07fe747d579240b189ef16f54c Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Wed, 20 Dec 2023 11:29:14 +0000 Subject: [PATCH 14/34] Set python to 3.10 --- examples/MODULE.bazel | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/examples/MODULE.bazel b/examples/MODULE.bazel index 61e8685b6..eb72db713 100644 --- a/examples/MODULE.bazel +++ b/examples/MODULE.bazel @@ -18,6 +18,14 @@ bazel_dep(name = "rules_apple", version = "3.0.0-rc1", repo_name = "build_bazel_ bazel_dep(name = "apple_support", version = "1.4.1", repo_name = "build_bazel_apple_support") bazel_dep(name = "rules_python", version = "0.23.0") +python = use_extension("@rules_python//python/extensions:python.bzl", "python") +python.toolchain( + configure_coverage_tool = True, + # Only set when you have mulitple toolchain versions. + is_default = True, + python_version = "3.10", +) + pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip") pip.parse( name = "pip", From 46aedc845c06855d1dc9f34c3c4c5012123e40be Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Wed, 20 Dec 2023 11:31:15 +0000 Subject: [PATCH 15/34] Remove noenable_bzlmod workaround from some CI targets --- .bazelci/config.yaml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/.bazelci/config.yaml b/.bazelci/config.yaml index 9a9660877..9a54450ff 100644 --- a/.bazelci/config.yaml +++ b/.bazelci/config.yaml @@ -6,30 +6,18 @@ tasks: - "//..." test_targets: - "//..." - build_flags: - - "--noenable_bzlmod" - test_flags: - - "--noenable_bzlmod" rbe_ubuntu1604: platform: rbe_ubuntu1604 build_targets: - "//..." test_targets: - "//..." - build_flags: - - "--noenable_bzlmod" - test_flags: - - "--noenable_bzlmod" macos: platform: macos build_targets: - "//..." test_targets: - "//..." - build_flags: - - "--noenable_bzlmod" - test_flags: - - "--noenable_bzlmod" windows: platform: windows build_targets: @@ -39,10 +27,6 @@ tasks: # TODO: https://github.com/bazelbuild/rules_foreign_cc/issues/495 - "-//test:shell_method_symlink_contents_to_dir_test" - "-//test:shell_script_inner_fun_test" - build_flags: - - "--noenable_bzlmod" - test_flags: - - "--noenable_bzlmod" ubuntu1804_examples_standalone: name: Examples (spawn_strategy=standalone) platform: ubuntu1804 From d1c81fc91be2a0bf8fca778828555e659c9b4a29 Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Wed, 20 Dec 2023 11:36:19 +0000 Subject: [PATCH 16/34] Bump requirements_lock.txt --- examples/requirements_lock.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/requirements_lock.txt b/examples/requirements_lock.txt index dc3976bc2..d34a81d2f 100644 --- a/examples/requirements_lock.txt +++ b/examples/requirements_lock.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.9 +# This file is autogenerated by pip-compile with Python 3.10 # by the following command: # # bazel run //:requirements.update From c2256632601d58b9513596b7949bb8b2d75c5592 Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Wed, 20 Dec 2023 11:37:58 +0000 Subject: [PATCH 17/34] Add dev dep on rules_cc for RBE --- MODULE.bazel | 1 + 1 file changed, 1 insertion(+) diff --git a/MODULE.bazel b/MODULE.bazel index b6b5f9451..5d1f400b6 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -12,6 +12,7 @@ bazel_dep(name = "rules_python", version = "0.23.0") bazel_dep(name = "gazelle", dev_dependency = True, repo_name = "bazel_gazelle", version = "0.34.0") bazel_dep(name = "bazel_skylib_gazelle_plugin", dev_dependency = True, version = "1.5.0") bazel_dep(name = "stardoc", dev_dependency = True, repo_name = "io_bazel_stardoc", version = "0.5.6") +bazel_dep(name = "rules_cc", dev_dependency = True, version = "0.0.9") tools = use_extension("@rules_foreign_cc//foreign_cc:extensions.bzl", "tools") From c0e0a778dd3c28ef23aee17db5fb7f4d7e153a9f Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Wed, 20 Dec 2023 11:41:42 +0000 Subject: [PATCH 18/34] Add dep on glib_dev for Windows --- MODULE.bazel | 1 + 1 file changed, 1 insertion(+) diff --git a/MODULE.bazel b/MODULE.bazel index 5d1f400b6..47f529772 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -20,6 +20,7 @@ use_repo( tools, "cmake_3.23.2_toolchains", "cmake_src", + "glib_dev", "gnumake_src", "meson_src", "ninja_1.11.1_toolchains", From 8b757d2eac8f618263b79f4dacba6ac3d005872e Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Wed, 20 Dec 2023 11:42:28 +0000 Subject: [PATCH 19/34] Bump python version --- WORKSPACE.bazel | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index 5d8be6686..7079c0aad 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -17,8 +17,8 @@ bazel_skylib_workspace() load("@rules_python//python:repositories.bzl", "python_register_toolchains") python_register_toolchains( - name = "python3_9", - python_version = "3.9", + name = "python3_10", + python_version = "3.10", ) load("//:docs/stardoc_repository.bzl", "stardoc_repository") From 55bc15bcac95f0f678954c9669e72c3d58fbeb1f Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Wed, 20 Dec 2023 11:43:01 +0000 Subject: [PATCH 20/34] Bump python version --- examples/WORKSPACE.bazel | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/WORKSPACE.bazel b/examples/WORKSPACE.bazel index df3b36ac3..2cebbb1c0 100644 --- a/examples/WORKSPACE.bazel +++ b/examples/WORKSPACE.bazel @@ -38,11 +38,11 @@ deps_jvm_external() load("@rules_python//python:repositories.bzl", "python_register_toolchains") python_register_toolchains( - name = "python3_9", - python_version = "3.9", + name = "python3_10", + python_version = "3.10", ) -load("@python3_9//:defs.bzl", py3_interpreter = "interpreter") +load("@python3_10//:defs.bzl", py3_interpreter = "interpreter") load("@rules_python//python:pip.bzl", "pip_parse") pip_parse( From 3299958291cdf248e93be3e4b1901a4cb29d3246 Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Wed, 20 Dec 2023 11:47:21 +0000 Subject: [PATCH 21/34] Add glib_src --- MODULE.bazel | 1 + 1 file changed, 1 insertion(+) diff --git a/MODULE.bazel b/MODULE.bazel index 47f529772..8867ba576 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -21,6 +21,7 @@ use_repo( "cmake_3.23.2_toolchains", "cmake_src", "glib_dev", + "glib_src", "gnumake_src", "meson_src", "ninja_1.11.1_toolchains", From 229dfb317ea51bcd85a16c8d19f1b19685850ae4 Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Wed, 20 Dec 2023 11:48:57 +0000 Subject: [PATCH 22/34] Add gettext_runtime --- MODULE.bazel | 1 + 1 file changed, 1 insertion(+) diff --git a/MODULE.bazel b/MODULE.bazel index 8867ba576..8551282c3 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -20,6 +20,7 @@ use_repo( tools, "cmake_3.23.2_toolchains", "cmake_src", + "gettext_runtime", "glib_dev", "glib_src", "gnumake_src", From 24bf9df64d54ee6d843e4e0115225233f5676698 Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Wed, 20 Dec 2023 11:52:07 +0000 Subject: [PATCH 23/34] Buildifier --- BUILD.bazel | 2 +- MODULE.bazel | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 2f96b2253..d83f276d2 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,5 +1,5 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library") -load("@bazel_gazelle//:def.bzl", "DEFAULT_LANGUAGES", "gazelle", "gazelle_binary") +load("@bazel_gazelle//:def.bzl", "DEFAULT_LANGUAGES", "gazelle_binary", "gazelle") gazelle( name = "gazelle", diff --git a/MODULE.bazel b/MODULE.bazel index 8551282c3..e3a9643f9 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -2,20 +2,20 @@ module( name = "rules_foreign_cc", - compatibility_level = 1, version = "0.0.0", + compatibility_level = 1, ) bazel_dep(name = "bazel_skylib", version = "1.1.1") bazel_dep(name = "platforms", version = "0.0.5") bazel_dep(name = "rules_python", version = "0.23.0") -bazel_dep(name = "gazelle", dev_dependency = True, repo_name = "bazel_gazelle", version = "0.34.0") -bazel_dep(name = "bazel_skylib_gazelle_plugin", dev_dependency = True, version = "1.5.0") -bazel_dep(name = "stardoc", dev_dependency = True, repo_name = "io_bazel_stardoc", version = "0.5.6") -bazel_dep(name = "rules_cc", dev_dependency = True, version = "0.0.9") -tools = use_extension("@rules_foreign_cc//foreign_cc:extensions.bzl", "tools") +bazel_dep(name = "gazelle", version = "0.34.0", dev_dependency = True, repo_name = "bazel_gazelle") +bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.5.0", dev_dependency = True) +bazel_dep(name = "stardoc", version = "0.5.6", dev_dependency = True, repo_name = "io_bazel_stardoc") +bazel_dep(name = "rules_cc", version = "0.0.9", dev_dependency = True) +tools = use_extension("@rules_foreign_cc//foreign_cc:extensions.bzl", "tools") use_repo( tools, "cmake_3.23.2_toolchains", From 9a39dec93e3e47723dd9ed4551769dd726a62929 Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Wed, 20 Dec 2023 12:01:28 +0000 Subject: [PATCH 24/34] Revert windows CI flags change --- .bazelci/config.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.bazelci/config.yaml b/.bazelci/config.yaml index 9a54450ff..3bfb1e4ad 100644 --- a/.bazelci/config.yaml +++ b/.bazelci/config.yaml @@ -27,6 +27,10 @@ tasks: # TODO: https://github.com/bazelbuild/rules_foreign_cc/issues/495 - "-//test:shell_method_symlink_contents_to_dir_test" - "-//test:shell_script_inner_fun_test" + build_flags: + - "--noenable_bzlmod" + test_flags: + - "--noenable_bzlmod" ubuntu1804_examples_standalone: name: Examples (spawn_strategy=standalone) platform: ubuntu1804 From 896f758aef1acdac9cb01d20edd080c87f2ee6d6 Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Wed, 20 Dec 2023 20:43:23 +0000 Subject: [PATCH 25/34] Correct typos --- docs/BUILD.bazel | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/BUILD.bazel b/docs/BUILD.bazel index 67c0401d2..28bcfdd18 100644 --- a/docs/BUILD.bazel +++ b/docs/BUILD.bazel @@ -14,7 +14,7 @@ genrule( # Note that the stardoc `out` files are prefixed with `stardoc_` so the # `diff_test` targets which ensure documentation is up to date can access the -# committed markdown files instead ouf the `out` targets from the stardoc rules +# committed markdown files instead of the `out` targets from the stardoc rules stardoc( name = "flatten_docs", @@ -110,7 +110,7 @@ release="$${RELEASE}" release_archive="$${RELEASE}" # TODO: If a release is set, we assume it's set to a branch name. -# thus we defautl the archive value to a commit. This is likely +# thus we default the archive value to a commit. This is likely # only appropriate when publishing on the branch in specified # and a smarter solution should be found to avoid unexpected behavior. if [[ -n "\\$${RELEASE:-}" ]]; then @@ -125,7 +125,7 @@ cat \\$${BUILD_WORKSPACE_DIRECTORY}/$(location //:ninja_docs) > \\$${BUILD_WORKS cat \\$${BUILD_WORKSPACE_DIRECTORY}/$(location //:make_docs) > \\$${BUILD_WORKSPACE_DIRECTORY}/src/make.md cat \\$${BUILD_WORKSPACE_DIRECTORY}/$(location //:configure_make_docs) > \\$${BUILD_WORKSPACE_DIRECTORY}/src/configure_make.md cat \\$${BUILD_WORKSPACE_DIRECTORY}/$(location //:providers_docs) > \\$${BUILD_WORKSPACE_DIRECTORY}/src/providers.md -# Non generated sourrces +# Non generated sources cp \\$${BUILD_WORKSPACE_DIRECTORY}/$(rootpath rules.md) \\$${BUILD_WORKSPACE_DIRECTORY}/src/rules.md cat \\$${BUILD_WORKSPACE_DIRECTORY}/$(rootpath index.md) \ | sed "s/{short_commit}/\\$${short_commit}/" \ From b40770386a38ae7a8aed691b4977907e4a78801b Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Wed, 20 Dec 2023 20:43:56 +0000 Subject: [PATCH 26/34] Fix buildifier warnings --- BUILD.bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILD.bazel b/BUILD.bazel index d83f276d2..2f96b2253 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,5 +1,5 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library") -load("@bazel_gazelle//:def.bzl", "DEFAULT_LANGUAGES", "gazelle_binary", "gazelle") +load("@bazel_gazelle//:def.bzl", "DEFAULT_LANGUAGES", "gazelle", "gazelle_binary") gazelle( name = "gazelle", From f33814a7cd123724d756773e9bde4921c7cdb55a Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Wed, 20 Dec 2023 20:53:17 +0000 Subject: [PATCH 27/34] Turn off bzlmod for docs --- docs/.bazelrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/.bazelrc b/docs/.bazelrc index dc6a3f77c..f46f66595 100644 --- a/docs/.bazelrc +++ b/docs/.bazelrc @@ -1,3 +1,4 @@ -# Bazel configuration flags for rules_foregin_cc_docs +# Bazel configuration flags for rules_foreign_cc_docs +common --noenable_bzlmod build --workspace_status_command=tools/workspace_status.sh From cb2bf8312c6d470fe9af7a36d2919a07e2c3950f Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Wed, 20 Dec 2023 20:53:31 +0000 Subject: [PATCH 28/34] Meson docs --- docs/BUILD.bazel | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/BUILD.bazel b/docs/BUILD.bazel index 28bcfdd18..42cc60902 100644 --- a/docs/BUILD.bazel +++ b/docs/BUILD.bazel @@ -21,7 +21,14 @@ stardoc( out = "stardoc_flatten.md", header_template = ":flatten_header_vm", input = "docs.bzl", - deps = ["@rules_foreign_cc//:bzl_srcs"], + deps = [ + "@rules_foreign_cc//foreign_cc:cmake", + "@rules_foreign_cc//foreign_cc:make", + "@rules_foreign_cc//foreign_cc:ninja", + "@rules_foreign_cc//foreign_cc:configure", + "@rules_foreign_cc//foreign_cc:meson", + "@rules_foreign_cc//foreign_cc:providers", + ], ) stardoc( @@ -123,6 +130,7 @@ cat \\$${BUILD_WORKSPACE_DIRECTORY}/$(location //:flatten_docs) > \\$${BUILD_WOR cat \\$${BUILD_WORKSPACE_DIRECTORY}/$(location //:cmake_docs) > \\$${BUILD_WORKSPACE_DIRECTORY}/src/cmake.md cat \\$${BUILD_WORKSPACE_DIRECTORY}/$(location //:ninja_docs) > \\$${BUILD_WORKSPACE_DIRECTORY}/src/ninja.md cat \\$${BUILD_WORKSPACE_DIRECTORY}/$(location //:make_docs) > \\$${BUILD_WORKSPACE_DIRECTORY}/src/make.md +cat \\$${BUILD_WORKSPACE_DIRECTORY}/$(location //:meson_docs) > \\$${BUILD_WORKSPACE_DIRECTORY}/src/meson.md cat \\$${BUILD_WORKSPACE_DIRECTORY}/$(location //:configure_make_docs) > \\$${BUILD_WORKSPACE_DIRECTORY}/src/configure_make.md cat \\$${BUILD_WORKSPACE_DIRECTORY}/$(location //:providers_docs) > \\$${BUILD_WORKSPACE_DIRECTORY}/src/providers.md # Non generated sources From 92cb2a726903252b29f73d888d0e74e64d3eb6c2 Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Wed, 20 Dec 2023 21:03:12 +0000 Subject: [PATCH 29/34] Doc build fixes --- docs/.bazelrc | 3 +++ docs/BUILD.bazel | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/docs/.bazelrc b/docs/.bazelrc index f46f66595..9eb0697f7 100644 --- a/docs/.bazelrc +++ b/docs/.bazelrc @@ -1,4 +1,7 @@ # Bazel configuration flags for rules_foreign_cc_docs +# https://github.com/bazelbuild/stardoc/issues/112 +common --incompatible_allow_tags_propagation + common --noenable_bzlmod build --workspace_status_command=tools/workspace_status.sh diff --git a/docs/BUILD.bazel b/docs/BUILD.bazel index 42cc60902..5e90773f6 100644 --- a/docs/BUILD.bazel +++ b/docs/BUILD.bazel @@ -21,7 +21,11 @@ stardoc( out = "stardoc_flatten.md", header_template = ":flatten_header_vm", input = "docs.bzl", + tags = ["no-sandbox"], # https://github.com/bazelbuild/stardoc/issues/112 deps = [ + "@rules_foreign_cc//foreign_cc:defs", + "@rules_foreign_cc//foreign_cc:repositories", + ] + [ "@rules_foreign_cc//foreign_cc:cmake", "@rules_foreign_cc//foreign_cc:make", "@rules_foreign_cc//foreign_cc:ninja", From dee2c7f0fc32043758b6ef9cb692eae6b8fc30de Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Wed, 20 Dec 2023 21:04:05 +0000 Subject: [PATCH 30/34] Buildifier --- docs/BUILD.bazel | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/BUILD.bazel b/docs/BUILD.bazel index 5e90773f6..48e4e4fa8 100644 --- a/docs/BUILD.bazel +++ b/docs/BUILD.bazel @@ -21,16 +21,16 @@ stardoc( out = "stardoc_flatten.md", header_template = ":flatten_header_vm", input = "docs.bzl", - tags = ["no-sandbox"], # https://github.com/bazelbuild/stardoc/issues/112 + tags = ["no-sandbox"], # https://github.com/bazelbuild/stardoc/issues/112 deps = [ "@rules_foreign_cc//foreign_cc:defs", "@rules_foreign_cc//foreign_cc:repositories", ] + [ "@rules_foreign_cc//foreign_cc:cmake", - "@rules_foreign_cc//foreign_cc:make", - "@rules_foreign_cc//foreign_cc:ninja", "@rules_foreign_cc//foreign_cc:configure", + "@rules_foreign_cc//foreign_cc:make", "@rules_foreign_cc//foreign_cc:meson", + "@rules_foreign_cc//foreign_cc:ninja", "@rules_foreign_cc//foreign_cc:providers", ], ) From 3f5ad2846511812058082d31a72455d39570b48a Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Wed, 20 Dec 2023 21:06:18 +0000 Subject: [PATCH 31/34] buildifier --- BUILD.bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILD.bazel b/BUILD.bazel index 2f96b2253..499a98d59 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,5 +1,5 @@ -load("@bazel_skylib//:bzl_library.bzl", "bzl_library") load("@bazel_gazelle//:def.bzl", "DEFAULT_LANGUAGES", "gazelle", "gazelle_binary") +load("@bazel_skylib//:bzl_library.bzl", "bzl_library") gazelle( name = "gazelle", From 5fea0877fb39ce2effc0f6cd229fddf10a3d7d82 Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Wed, 20 Dec 2023 21:08:11 +0000 Subject: [PATCH 32/34] 0.10.1 docs --- .github/workflows/pages.yaml | 1 + docs/root/src/index.md | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/pages.yaml b/.github/workflows/pages.yaml index 55fcdefb5..cfc70e710 100644 --- a/.github/workflows/pages.yaml +++ b/.github/workflows/pages.yaml @@ -17,6 +17,7 @@ jobs: # Create a job for release include: - ref: main + - ref: "0.10.1" - ref: "0.9.0" - ref: "0.8.0" - ref: "0.7.1" diff --git a/docs/root/src/index.md b/docs/root/src/index.md index 3d13d0b31..8aeb08428 100644 --- a/docs/root/src/index.md +++ b/docs/root/src/index.md @@ -5,6 +5,7 @@ Rules for building C/C++ projects using foreign build systems (non Bazel) inside ## Versions - [main](main/index.md) +- [0.10.1](0.10.1/index.md) - [0.9.0](0.9.0/index.md) - [0.8.0](0.8.0/index.md) - [0.7.1](0.7.1/index.md) From cb68343aea4c722c205e1989463a861cb7c37bbb Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Wed, 20 Dec 2023 22:45:43 +0000 Subject: [PATCH 33/34] macOS flags --- .bazelci/config.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.bazelci/config.yaml b/.bazelci/config.yaml index 3bfb1e4ad..63915f3ce 100644 --- a/.bazelci/config.yaml +++ b/.bazelci/config.yaml @@ -104,14 +104,15 @@ tasks: - "-c" - "dbg" - "--spawn_strategy=standalone" - - "-k" - "--noincompatible_enable_cc_toolchain_resolution" + - "--noenable_bzlmod" test_targets: *macos_targets_standalone test_flags: - "-c" - "dbg" - "--spawn_strategy=standalone" - "--noincompatible_enable_cc_toolchain_resolution" + - "--noenable_bzlmod" macos_examples: name: Examples platform: macos @@ -125,9 +126,11 @@ tasks: build_targets: *macos_targets build_flags: - "--noincompatible_enable_cc_toolchain_resolution" + - "--noenable_bzlmod" test_targets: *macos_targets test_flags: - "--noincompatible_enable_cc_toolchain_resolution" + - "--noenable_bzlmod" windows_examples: name: Examples platform: windows From d4e3d60c0f8d3b1ec565cbbce0a0dc49ac1be8ca Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Wed, 20 Dec 2023 22:59:34 +0000 Subject: [PATCH 34/34] Disable cmake android on macos --- .bazelci/config.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.bazelci/config.yaml b/.bazelci/config.yaml index 63915f3ce..f130ae789 100644 --- a/.bazelci/config.yaml +++ b/.bazelci/config.yaml @@ -96,6 +96,7 @@ tasks: macos_targets: &macos_targets_standalone - "//..." - "//:third_party_examples_macos_tests" + - "-//cmake_android/..." # Remove tests that depend on shared libraries, which currently doesn't work on MacOS - https://github.com/bazelbuild/bazel/issues/10254 - "-@rules_foreign_cc_examples_third_party//curl:curl_test" - "-@rules_foreign_cc_examples_third_party//openssl:openssl_test" @@ -120,6 +121,7 @@ tasks: macos_targets: &macos_targets - "//..." - "//:third_party_examples_macos_tests" + - "-//cmake_android/..." # Remove tests that depend on shared libraries, which currently doesn't work on MacOS - https://github.com/bazelbuild/bazel/issues/10254 - "-@rules_foreign_cc_examples_third_party//curl:curl_test" - "-@rules_foreign_cc_examples_third_party//openssl:openssl_test"