diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3bb13b267..d2203a4f2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -43,10 +43,8 @@ jobs: run: echo "bazelversion=$(head -n 1 .bazelversion)" >> $GITHUB_OUTPUT - id: bazel_7 run: echo "bazelversion=7.0.0" >> $GITHUB_OUTPUT - - id: bazel_5 - run: echo "bazelversion=5.4.1" >> $GITHUB_OUTPUT outputs: - # Will look like '["", "7.0.0", "5.4.1"]' + # Will look like '["", "7.0.0"]' bazelversions: ${{ toJSON(steps.*.outputs.bazelversion) }} matrix-prep-os: diff --git a/docs/BUILD.bazel b/docs/BUILD.bazel index fe8d7d201..86f728b58 100644 --- a/docs/BUILD.bazel +++ b/docs/BUILD.bazel @@ -1,5 +1,3 @@ -# These loads are in the docs/ package rather than anything users depend on -# so that the dependency on stardoc doesn't leak to them. load("//lib:docs.bzl", "stardoc_with_diff_test", "update_docs") stardoc_with_diff_test( diff --git a/lib/BUILD.bazel b/lib/BUILD.bazel index 85ebcd028..4c6df5e6a 100644 --- a/lib/BUILD.bazel +++ b/lib/BUILD.bazel @@ -83,19 +83,11 @@ toolchain_type( name = "tar_toolchain_type", ) -bzl_library( - name = "docs", - srcs = ["docs.bzl"], - deps = ["//lib/private/docs"], -) - bzl_library( name = "expand_make_vars", srcs = ["expand_make_vars.bzl"], deps = [ ":expand_template", - "//lib/private/docs:expand_locations", - "//lib/private/docs:expand_variables", ], ) @@ -103,9 +95,7 @@ bzl_library( name = "expand_template", srcs = ["expand_template.bzl"], deps = [ - "//lib/private/docs:expand_locations", - "//lib/private/docs:expand_template", - "//lib/private/docs:expand_variables", + "//lib/private:expand_template", "@bazel_skylib//lib:types", "@bazel_skylib//rules:write_file", ], @@ -114,19 +104,19 @@ bzl_library( bzl_library( name = "params_file", srcs = ["params_file.bzl"], - deps = ["//lib/private/docs:params_file"], + deps = ["//lib/private:params_file"], ) bzl_library( name = "paths", srcs = ["paths.bzl"], - deps = ["//lib/private/docs:paths"], + deps = ["//lib/private:paths"], ) bzl_library( name = "utils", srcs = ["utils.bzl"], - deps = ["//lib/private/docs:utils"], + deps = ["//lib/private:utils"], ) bzl_library( @@ -134,44 +124,51 @@ bzl_library( srcs = ["jq.bzl"], visibility = ["//visibility:public"], deps = [ - "//lib/private/docs:jq", + "//lib/private:jq", ], ) bzl_library( name = "directory_path", srcs = ["directory_path.bzl"], - deps = ["//lib/private/docs:directory_path"], + deps = ["//lib/private:directory_path"], ) bzl_library( name = "output_files", srcs = ["output_files.bzl"], - deps = ["//lib/private/docs:output_files"], + deps = ["//lib/private:output_files"], ) bzl_library( name = "copy_file", srcs = ["copy_file.bzl"], - deps = ["//lib/private/docs:copy_file"], + deps = ["//lib/private:copy_file"], ) bzl_library( name = "copy_directory", srcs = ["copy_directory.bzl"], - deps = ["//lib/private/docs:copy_directory"], + deps = ["//lib/private:copy_directory"], ) bzl_library( name = "copy_to_directory", srcs = ["copy_to_directory.bzl"], - deps = ["//lib/private/docs:copy_to_directory"], + deps = ["//lib/private:copy_to_directory"], ) bzl_library( name = "copy_to_bin", srcs = ["copy_to_bin.bzl"], - deps = ["//lib/private/docs:copy_to_bin"], + deps = ["//lib/private:copy_to_bin"], +) + +#keep +bzl_library( + name = "diff_test", + srcs = ["diff_test.bzl"], + deps = ["//lib/private:diff_test"], ) bzl_library( @@ -180,49 +177,43 @@ bzl_library( deps = [ ":diff_test", ":utils", - "//lib/private/docs:fail_with_message_test", - "//lib/private/docs:write_source_file", + # "//lib/private:fail_with_message_test", + "//lib/private:write_source_file", ], ) -bzl_library( - name = "diff_test", - srcs = ["diff_test.bzl"], - deps = ["//lib/private/docs:diff_test"], -) - bzl_library( name = "run_binary", srcs = ["run_binary.bzl"], - deps = ["//lib/private/docs:run_binary"], + deps = ["//lib/private:run_binary"], ) bzl_library( name = "repo_utils", srcs = ["repo_utils.bzl"], deps = [ - "//lib/private/docs:patch", - "//lib/private/docs:repo_utils", + "//lib/private:patch", + "//lib/private:repo_utils", ], ) bzl_library( name = "yq", srcs = ["yq.bzl"], - deps = ["//lib/private/docs:yq"], + deps = ["//lib/private:yq"], ) bzl_library( name = "glob_match", srcs = ["glob_match.bzl"], - deps = ["//lib/private/docs:glob_match"], + deps = ["//lib/private:glob_match"], ) bzl_library( name = "host_repo", srcs = ["host_repo.bzl"], deps = [ - "//lib/private/docs:host_repo", + "//lib/private:host_repo", "@bazel_skylib//lib:versions", ], ) @@ -230,7 +221,7 @@ bzl_library( bzl_library( name = "stamping", srcs = ["stamping.bzl"], - deps = ["//lib/private/docs:stamping"], + deps = ["//lib/private:stamping"], ) bzl_library( @@ -257,15 +248,15 @@ bzl_library( srcs = ["repositories.bzl"], deps = [ ":utils", - "//lib/private/docs:copy_directory_toolchain", - "//lib/private/docs:copy_to_directory_toolchain", - "//lib/private/docs:coreutils_toolchain", - "//lib/private/docs:expand_template_toolchain", - "//lib/private/docs:jq_toolchain", - "//lib/private/docs:local_config_platform", - "//lib/private/docs:source_toolchains_repo", - "//lib/private/docs:tar_toolchain", - "//lib/private/docs:yq_toolchain", + "//lib/private:copy_directory_toolchain", + "//lib/private:copy_to_directory_toolchain", + "//lib/private:coreutils_toolchain", + "//lib/private:expand_template_toolchain", + "//lib/private:jq_toolchain", + "//lib/private:local_config_platform", + "//lib/private:source_toolchains_repo", + "//lib/private:tar_toolchain", + "//lib/private:yq_toolchain", ], ) @@ -280,13 +271,13 @@ bzl_library( bzl_library( name = "platform_utils", srcs = ["platform_utils.bzl"], - deps = ["//lib/private/docs:platform_utils"], + deps = ["//lib/private:platform_utils"], ) bzl_library( name = "base64", srcs = ["base64.bzl"], - deps = ["//lib/private/docs:base64"], + deps = ["//lib/private:base64"], ) bzl_library( @@ -298,13 +289,19 @@ bzl_library( bzl_library( name = "strings", srcs = ["strings.bzl"], - deps = ["//lib/private/docs:strings"], + deps = ["//lib/private:strings"], ) bzl_library( name = "lists", srcs = ["lists.bzl"], - deps = ["//lib/private/docs:lists"], + deps = ["//lib/private:lists"], +) + +bzl_library( + name = "docs", + srcs = ["docs.bzl"], + deps = ["//lib/private:docs"], ) bzl_library( diff --git a/lib/private/BUILD.bazel b/lib/private/BUILD.bazel index 9a9278c65..753c10fbd 100644 --- a/lib/private/BUILD.bazel +++ b/lib/private/BUILD.bazel @@ -1,3 +1,6 @@ +load("@bazel_skylib//:bzl_library.bzl", "bzl_library") +load("//lib/private:utils.bzl", "utils") + exports_files( [ "diff_test_tmpl.sh", @@ -12,3 +15,325 @@ exports_files( glob(["*.bzl"]), visibility = ["//lib/private/docs:__pkg__"], ) + +bzl_library( + name = "base64", + srcs = ["base64.bzl"], + visibility = ["//lib:__subpackages__"], + deps = [":strings"], +) + +bzl_library( + name = "copy_directory", + srcs = ["copy_directory.bzl"], + visibility = ["//lib:__subpackages__"], + deps = [ + ":copy_common", + ":platform_utils", + ], +) + +bzl_library( + name = "copy_directory_toolchain", + srcs = ["copy_directory_toolchain.bzl"], + visibility = ["//lib:__subpackages__"], + deps = [ + "//tools:integrity", + "//tools:version", + ], +) + +bzl_library( + name = "copy_file", + srcs = ["copy_file.bzl"], + visibility = ["//lib:__subpackages__"], + deps = [ + ":copy_common", + ":directory_path", + ":platform_utils", + ], +) + +bzl_library( + name = "copy_to_bin", + srcs = ["copy_to_bin.bzl"], + visibility = ["//lib:__subpackages__"], + deps = [ + ":copy_file", + "@bazel_skylib//lib:paths", + ], +) + +bzl_library( + name = "copy_to_directory", + srcs = ["copy_to_directory.bzl"], + visibility = ["//lib:__subpackages__"], + deps = [ + ":copy_common", + ":directory_path", + ":glob_match", + ":paths", + ":platform_utils", + "@bazel_skylib//lib:paths", + ], +) + +bzl_library( + name = "copy_to_directory_toolchain", + srcs = ["copy_to_directory_toolchain.bzl"], + visibility = ["//lib:__subpackages__"], + deps = [ + "//tools:integrity", + "//tools:version", + ], +) + +bzl_library( + name = "directory_path", + srcs = ["directory_path.bzl"], + visibility = ["//lib:__subpackages__"], + deps = ["//lib:utils"], +) + +#keep +bzl_library( + name = "diff_test", + srcs = ["diff_test.bzl"], + visibility = ["//lib:__subpackages__"], + deps = [ + ":directory_path", + "//lib:utils", + ], +) + +bzl_library( + name = "docs", + srcs = ["docs.bzl"], + visibility = ["//lib:__subpackages__"], + deps = [ + "//lib:write_source_files", + "@io_bazel_stardoc//stardoc:stardoc_lib", #keep + ], +) + +bzl_library( + name = "expand_template", + srcs = ["expand_template.bzl"], + visibility = ["//lib:__subpackages__"], + deps = [ + ":expand_locations", + ":expand_variables", + "//lib:stamping", + "@bazel_skylib//lib:dicts", + ], +) + +bzl_library( + name = "expand_template_toolchain", + srcs = ["expand_template_toolchain.bzl"], + visibility = ["//lib:__subpackages__"], + deps = [ + "//tools:integrity", + "//tools:version", + ], +) + +bzl_library( + name = "expand_variables", + srcs = ["expand_variables.bzl"], + visibility = ["//lib:__subpackages__"], + deps = ["@bazel_skylib//lib:paths"], +) + +bzl_library( + name = "host_repo", + srcs = ["host_repo.bzl"], + visibility = ["//lib:__subpackages__"], + deps = [ + ":repo_utils", + "@bazel_skylib//lib:versions", + ], +) + +bzl_library( + name = "jq", + srcs = ["jq.bzl"], + visibility = ["//lib:__subpackages__"], + deps = [ + ":expand_locations", + "//lib:stamping", + ], +) + +bzl_library( + name = "jq_toolchain", + srcs = ["jq_toolchain.bzl"], + visibility = ["//lib:__subpackages__"], + deps = [":repo_utils"], +) + +bzl_library( + name = "output_files", + srcs = ["output_files.bzl"], + visibility = ["//lib:__subpackages__"], + deps = ["//lib:utils"], +) + +bzl_library( + name = "params_file", + srcs = ["params_file.bzl"], + visibility = ["//lib:__subpackages__"], + deps = [":expand_locations"], +) + +bzl_library( + name = "patch", + srcs = ["patch.bzl"], + visibility = ["//lib:__subpackages__"], + deps = [":repo_utils"], +) + +bzl_library( + name = "paths", + srcs = ["paths.bzl"], + visibility = ["//lib:__subpackages__"], + deps = ["@bazel_skylib//lib:paths"], +) + +bzl_library( + name = "run_binary", + srcs = ["run_binary.bzl"], + visibility = ["//lib:__subpackages__"], + deps = [ + ":expand_locations", + ":expand_variables", + "//lib:stamping", + "@bazel_skylib//lib:dicts", + ], +) + +bzl_library( + name = "utils", + srcs = ["utils.bzl"], + visibility = ["//lib:__subpackages__"], + deps = [ + "@bazel_tools//tools/build_defs/repo:http.bzl", + "@bazel_tools//tools/build_defs/repo:utils.bzl", + ] + (["@bazel_tools//tools/build_defs/repo:cache.bzl"] if utils.is_bazel_7_or_greater() else []), +) + +# keep +bzl_library( + name = "fail_with_message_test", + srcs = ["fail_with_message_test.bzl"], +) + +bzl_library( + name = "write_source_file", + srcs = ["write_source_file.bzl"], + visibility = ["//lib:__subpackages__"], + deps = [ + ":diff_test", + ":directory_path", + ":fail_with_message_test", + ":utils", + ], +) + +bzl_library( + name = "yq", + srcs = ["yq.bzl"], + visibility = ["//lib:__subpackages__"], + deps = ["//lib:stamping"], +) + +bzl_library( + name = "yq_toolchain", + srcs = ["yq_toolchain.bzl"], + visibility = ["//lib:__subpackages__"], + deps = [":repo_utils"], +) + +bzl_library( + name = "platform_utils", + srcs = [ + "platform_utils.bzl", + "@local_config_platform//:constraints.bzl", # keep + ], + visibility = ["//lib:__subpackages__"], + deps = [], # keep +) + +bzl_library( + name = "tar_toolchain", + srcs = ["tar_toolchain.bzl"], + visibility = ["//lib:__subpackages__"], + deps = [":repo_utils"], +) + +bzl_library( + name = "copy_common", + srcs = ["copy_common.bzl"], + visibility = ["//lib:__subpackages__"], +) + +bzl_library( + name = "coreutils_toolchain", + srcs = ["coreutils_toolchain.bzl"], + visibility = ["//lib:__subpackages__"], +) + +bzl_library( + name = "expand_locations", + srcs = ["expand_locations.bzl"], + visibility = ["//lib:__subpackages__"], +) + +bzl_library( + name = "extension_utils", + srcs = ["extension_utils.bzl"], + visibility = ["//lib:__subpackages__"], +) + +bzl_library( + name = "glob_match", + srcs = ["glob_match.bzl"], + visibility = ["//lib:__subpackages__"], +) + +bzl_library( + name = "lists", + srcs = ["lists.bzl"], + visibility = ["//lib:__subpackages__"], +) + +bzl_library( + name = "local_config_platform", + srcs = ["local_config_platform.bzl"], + visibility = ["//lib:__subpackages__"], + deps = [":repo_utils"], +) + +bzl_library( + name = "repo_utils", + srcs = ["repo_utils.bzl"], + visibility = ["//lib:__subpackages__"], +) + +bzl_library( + name = "source_toolchains_repo", + srcs = ["source_toolchains_repo.bzl"], + visibility = ["//lib:__subpackages__"], +) + +bzl_library( + name = "stamping", + srcs = ["stamping.bzl"], + visibility = ["//lib:__subpackages__"], +) + +bzl_library( + name = "strings", + srcs = ["strings.bzl"], + visibility = ["//lib:__subpackages__"], +) diff --git a/lib/private/docs/BUILD.bazel b/lib/private/docs/BUILD.bazel deleted file mode 100644 index a8032275c..000000000 --- a/lib/private/docs/BUILD.bazel +++ /dev/null @@ -1,293 +0,0 @@ -load("@bazel_skylib//:bzl_library.bzl", "bzl_library") - -# `bzl_library` targets for `//lib/private:*.bzl` are in this package so that `:platform_utils` dep on -# `@local_config_platform//:constraints` doesn't leak unless downstream consumer is generating docs. -# That dep requires the downstream WORKSPACE to set `override_local_config_platform = True` in -# `aspect_bazel_lib_dependencies`. - -package(default_visibility = ["//lib:__pkg__"]) - -bzl_library( - name = "local_config_platform_constraints", - srcs = ["@local_config_platform//:constraints.bzl"], - visibility = ["//visibility:public"], -) - -bzl_library( - name = "copy_common", - srcs = ["//lib/private:copy_common.bzl"], -) - -bzl_library( - name = "platform_utils", - srcs = ["//lib/private:platform_utils.bzl"], - deps = [":local_config_platform_constraints"], -) - -bzl_library( - name = "copy_file", - srcs = ["//lib/private:copy_file.bzl"], - deps = [ - ":copy_common", - ":directory_path", - ":platform_utils", - ], -) - -bzl_library( - name = "copy_directory", - srcs = ["//lib/private:copy_directory.bzl"], - deps = [ - ":copy_common", - ":paths", - ":platform_utils", - ], -) - -bzl_library( - name = "copy_to_directory", - srcs = ["//lib/private:copy_to_directory.bzl"], - deps = [ - ":copy_common", - ":directory_path", - ":glob_match", - ":output_files", - ":paths", - ":platform_utils", - "@bazel_skylib//lib:paths", - ], -) - -bzl_library( - name = "copy_to_bin", - srcs = ["//lib/private:copy_to_bin.bzl"], - deps = [ - ":copy_file", - "@bazel_skylib//lib:paths", - ], -) - -bzl_library( - name = "params_file", - srcs = ["//lib/private:params_file.bzl"], - deps = [":expand_locations"], -) - -bzl_library( - name = "paths", - srcs = ["//lib/private:paths.bzl"], - deps = ["@bazel_skylib//lib:paths"], -) - -bzl_library( - name = "docs", - srcs = ["//lib/private:docs.bzl"], - deps = [ - "//lib:write_source_files", - "@io_bazel_stardoc//stardoc:stardoc_lib", - ], -) - -bzl_library( - name = "expand_locations", - srcs = ["//lib/private:expand_locations.bzl"], - deps = [ - "@bazel_skylib//lib:paths", - ], -) - -bzl_library( - name = "expand_template", - srcs = ["//lib/private:expand_template.bzl"], - deps = [ - ":expand_locations", - "//lib:stamping", - "@bazel_skylib//lib:dicts", - ], -) - -bzl_library( - name = "expand_variables", - srcs = ["//lib/private:expand_variables.bzl"], - deps = [ - "@bazel_skylib//lib:paths", - ], -) - -bzl_library( - name = "lists", - srcs = [ - "//lib/private:lists.bzl", - ], -) - -bzl_library( - name = "utils", - srcs = [ - "//lib/private:utils.bzl", - "@bazel_tools//tools/build_defs/repo:http.bzl", - "@bazel_tools//tools/build_defs/repo:utils.bzl", - ], -) - -bzl_library( - name = "jq", - srcs = [ - ":expand_locations", - "//lib/private:jq.bzl", - ], - deps = ["//lib:stamping"], -) - -bzl_library( - name = "local_config_platform", - srcs = ["//lib/private:local_config_platform.bzl"], -) - -bzl_library( - name = "write_source_file", - srcs = ["//lib/private:write_source_file.bzl"], - deps = [ - ":directory_path", - ":output_files", - "//lib:utils", - ], -) - -bzl_library( - name = "fail_with_message_test", - srcs = ["//lib/private:fail_with_message_test.bzl"], -) - -bzl_library( - name = "glob_match", - srcs = ["//lib/private:glob_match.bzl"], -) - -bzl_library( - name = "directory_path", - srcs = ["//lib/private:directory_path.bzl"], - deps = ["//lib:utils"], -) - -bzl_library( - name = "output_files", - srcs = ["//lib/private:output_files.bzl"], - deps = ["//lib:utils"], -) - -bzl_library( - name = "diff_test", - srcs = [ - "//lib:utils", - "//lib/private:diff_test.bzl", - "//lib/private:directory_path.bzl", - ], -) - -bzl_library( - name = "run_binary", - srcs = ["//lib/private:run_binary.bzl"], - deps = [ - ":expand_locations", - ":expand_variables", - "//lib:stamping", - "@bazel_skylib//lib:dicts", - ], -) - -bzl_library( - name = "patch", - srcs = ["//lib/private:patch.bzl"], - deps = [":repo_utils"], -) - -bzl_library( - name = "host_repo", - srcs = ["//lib/private:host_repo.bzl"], - deps = [":repo_utils"], -) - -bzl_library( - name = "jq_toolchain", - srcs = ["//lib/private:jq_toolchain.bzl"], - deps = [":repo_utils"], -) - -bzl_library( - name = "tar_toolchain", - srcs = ["//lib/private:tar_toolchain.bzl"], - deps = [":repo_utils"], -) - -bzl_library( - name = "repo_utils", - srcs = ["//lib/private:repo_utils.bzl"], -) - -bzl_library( - name = "stamping", - srcs = ["//lib/private:stamping.bzl"], -) - -bzl_library( - name = "yq", - srcs = ["//lib/private:yq.bzl"], - deps = ["//lib:stamping"], -) - -bzl_library( - name = "yq_toolchain", - srcs = ["//lib/private:yq_toolchain.bzl"], - deps = [":repo_utils"], -) - -bzl_library( - name = "base64", - srcs = ["//lib/private:base64.bzl"], - deps = [ - ":strings", - ], -) - -bzl_library( - name = "copy_directory_toolchain", - srcs = ["//lib/private:copy_directory_toolchain.bzl"], - deps = [ - "//tools:sri", - "//tools:version", - ], -) - -bzl_library( - name = "copy_to_directory_toolchain", - srcs = ["//lib/private:copy_to_directory_toolchain.bzl"], - deps = [ - "//tools:sri", - "//tools:version", - ], -) - -bzl_library( - name = "source_toolchains_repo", - srcs = ["//lib/private:source_toolchains_repo.bzl"], -) - -bzl_library( - name = "coreutils_toolchain", - srcs = ["//lib/private:coreutils_toolchain.bzl"], -) - -bzl_library( - name = "expand_template_toolchain", - srcs = ["//lib/private:expand_template_toolchain.bzl"], - deps = [ - "//lib:stamping", - "//tools:sri", - ], -) - -bzl_library( - name = "strings", - srcs = ["//lib/private:strings.bzl"], -) diff --git a/lib/tests/copy_to_directory_bin_action/BUILD.bazel b/lib/tests/copy_to_directory_bin_action/BUILD.bazel index 9fbc04594..29e2f0f4a 100644 --- a/lib/tests/copy_to_directory_bin_action/BUILD.bazel +++ b/lib/tests/copy_to_directory_bin_action/BUILD.bazel @@ -45,6 +45,8 @@ pkg( ":tree_artifact", ], out = "pkg", + # RBE not happy with the symlinks in this test case + tags = ["no-remote"], target_compatible_with = select({ # D:/a/bazel-lib/bazel-lib/lib/tests/copy_to_directory_bin_action/BUILD.bazel:36:4: # declared output 'lib/tests/copy_to_directory_bin_action/pkg_symlink_0' is not a symlink diff --git a/tools/BUILD.bazel b/tools/BUILD.bazel index bc6f9fbb0..10a2737f4 100644 --- a/tools/BUILD.bazel +++ b/tools/BUILD.bazel @@ -8,9 +8,9 @@ exports_files([ ]) bzl_library( - name = "sri", + name = "integrity", srcs = [":integrity.bzl"], - visibility = ["//lib/private/docs:__pkg__"], + visibility = ["//visibility:public"], ) bzl_library(