fix: isolate bzl_libary targets for //lib/private:*.bzl i //lib/private/docs package so that platform_utils dep on @local_config_platform//:constraints doesn't leak unless downstream consumer is generating docs (#254)

This commit is contained in:
Greg Magolan 2022-09-27 09:59:19 -07:00 committed by GitHub
parent 091b6adc79
commit 6f37a3808b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 241 additions and 237 deletions

View File

@ -26,78 +26,78 @@ toolchain_type(
bzl_library(
name = "docs",
srcs = ["docs.bzl"],
deps = ["//lib/private:docs"],
deps = ["//lib/private/docs"],
)
bzl_library(
name = "expand_make_vars",
srcs = ["expand_make_vars.bzl"],
deps = [
"//lib/private:expand_locations",
"//lib/private:expand_template",
"//lib/private:expand_variables",
"//lib/private/docs:expand_locations",
"//lib/private/docs:expand_template",
"//lib/private/docs:expand_variables",
],
)
bzl_library(
name = "params_file",
srcs = ["params_file.bzl"],
deps = ["//lib/private:params_file"],
deps = ["//lib/private/docs:params_file"],
)
bzl_library(
name = "paths",
srcs = ["paths.bzl"],
deps = ["//lib/private:paths"],
deps = ["//lib/private/docs:paths"],
)
bzl_library(
name = "utils",
srcs = ["utils.bzl"],
deps = ["//lib/private:utils"],
deps = ["//lib/private/docs:utils"],
)
bzl_library(
name = "jq",
srcs = ["jq.bzl"],
visibility = ["//visibility:public"],
deps = ["//lib/private:jq"],
deps = ["//lib/private/docs:jq"],
)
bzl_library(
name = "directory_path",
srcs = ["directory_path.bzl"],
deps = ["//lib/private:directory_path"],
deps = ["//lib/private/docs:directory_path"],
)
bzl_library(
name = "output_files",
srcs = ["output_files.bzl"],
deps = ["//lib/private:output_files"],
deps = ["//lib/private/docs:output_files"],
)
bzl_library(
name = "copy_file",
srcs = ["copy_file.bzl"],
deps = ["//lib/private:copy_file"],
deps = ["//lib/private/docs:copy_file"],
)
bzl_library(
name = "copy_directory",
srcs = ["copy_directory.bzl"],
deps = ["//lib/private:copy_directory"],
deps = ["//lib/private/docs:copy_directory"],
)
bzl_library(
name = "copy_to_directory",
srcs = ["copy_to_directory.bzl"],
deps = ["//lib/private:copy_to_directory"],
deps = ["//lib/private/docs:copy_to_directory"],
)
bzl_library(
name = "copy_to_bin",
srcs = ["copy_to_bin.bzl"],
deps = ["//lib/private:copy_to_bin"],
deps = ["//lib/private/docs:copy_to_bin"],
)
bzl_library(
@ -106,49 +106,49 @@ bzl_library(
deps = [
":diff_test",
":utils",
"//lib/private:fail_with_message_test",
"//lib/private:write_source_file",
"//lib/private/docs:fail_with_message_test",
"//lib/private/docs:write_source_file",
],
)
bzl_library(
name = "diff_test",
srcs = ["diff_test.bzl"],
deps = ["//lib/private:diff_test"],
deps = ["//lib/private/docs:diff_test"],
)
bzl_library(
name = "run_binary",
srcs = ["run_binary.bzl"],
deps = ["//lib/private:run_binary"],
deps = ["//lib/private/docs:run_binary"],
)
bzl_library(
name = "repo_utils",
srcs = ["repo_utils.bzl"],
deps = [
"//lib/private:patch",
"//lib/private:repo_utils",
"//lib/private/docs:patch",
"//lib/private/docs:repo_utils",
],
)
bzl_library(
name = "yq",
srcs = ["yq.bzl"],
deps = ["//lib/private:yq"],
deps = ["//lib/private/docs:yq"],
)
bzl_library(
name = "glob_match",
srcs = ["glob_match.bzl"],
deps = ["//lib/private:glob_match"],
deps = ["//lib/private/docs:glob_match"],
)
bzl_library(
name = "host_repo",
srcs = ["host_repo.bzl"],
deps = [
"//lib/private:host_repo",
"//lib/private/docs:host_repo",
"@bazel_skylib//lib:versions",
],
)
@ -156,7 +156,7 @@ bzl_library(
bzl_library(
name = "stamping",
srcs = ["stamping.bzl"],
deps = ["//lib/private:stamping"],
deps = ["//lib/private/docs:stamping"],
)
bzl_library(
@ -178,9 +178,9 @@ bzl_library(
name = "repositories",
srcs = ["repositories.bzl"],
deps = [
"//lib/private:jq_toolchain",
"//lib/private:local_config_platform",
"//lib/private:yq_toolchain",
"//lib/private/docs:jq_toolchain",
"//lib/private/docs:local_config_platform",
"//lib/private/docs:yq_toolchain",
"@bazel_tools//tools/build_defs/repo:http.bzl",
"@bazel_tools//tools/build_defs/repo:utils.bzl",
],
@ -199,5 +199,5 @@ bzl_library(
bzl_library(
name = "platform_utils",
srcs = ["platform_utils.bzl"],
deps = ["//lib/private:platform_utils"],
deps = ["//lib/private/docs:platform_utils"],
)

View File

@ -1,12 +1,3 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
package(default_visibility = ["//lib:__subpackages__"])
exports_files(
glob(["*.bzl"]),
visibility = ["//docs:__pkg__"],
)
exports_files(
[
"diff_test_tmpl.sh",
@ -16,204 +7,7 @@ exports_files(
visibility = ["//visibility:public"],
)
bzl_library(
name = "copy_common",
srcs = ["copy_common.bzl"],
)
bzl_library(
name = "platform_utils",
srcs = ["platform_utils.bzl"],
deps = ["@local_config_platform//:constraints"],
)
bzl_library(
name = "copy_file",
srcs = ["copy_file.bzl"],
deps = [
":copy_common",
":directory_path",
":platform_utils",
],
)
bzl_library(
name = "copy_directory",
srcs = ["copy_directory.bzl"],
deps = [
":copy_common",
":platform_utils",
],
)
bzl_library(
name = "copy_to_directory",
srcs = ["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 = ["copy_to_bin.bzl"],
deps = [
":copy_file",
"@bazel_skylib//lib:paths",
],
)
bzl_library(
name = "params_file",
srcs = ["params_file.bzl"],
deps = [":expand_locations"],
)
bzl_library(
name = "paths",
srcs = ["paths.bzl"],
deps = ["@bazel_skylib//lib:paths"],
)
bzl_library(
name = "docs",
srcs = ["docs.bzl"],
deps = [
"//lib:write_source_files",
"@io_bazel_stardoc//stardoc:stardoc_lib",
],
)
bzl_library(
name = "expand_locations",
srcs = ["expand_locations.bzl"],
deps = [
"@bazel_skylib//lib:paths",
],
)
bzl_library(
name = "expand_template",
srcs = ["expand_template.bzl"],
deps = [
":expand_locations",
"@bazel_skylib//lib:dicts",
],
)
bzl_library(
name = "expand_variables",
srcs = ["expand_variables.bzl"],
deps = [
"@bazel_skylib//lib:paths",
],
)
bzl_library(
name = "utils",
srcs = ["utils.bzl"],
)
bzl_library(
name = "jq",
srcs = ["jq.bzl"],
deps = ["//lib:stamping"],
)
bzl_library(
name = "local_config_platform",
srcs = ["local_config_platform.bzl"],
)
bzl_library(
name = "write_source_file",
srcs = ["write_source_file.bzl"],
deps = [
":directory_path",
":output_files",
"//lib:utils",
],
)
bzl_library(
name = "fail_with_message_test",
srcs = ["fail_with_message_test.bzl"],
)
bzl_library(
name = "glob_match",
srcs = ["glob_match.bzl"],
)
bzl_library(
name = "directory_path",
srcs = ["directory_path.bzl"],
deps = ["//lib:utils"],
)
bzl_library(
name = "output_files",
srcs = ["output_files.bzl"],
deps = ["//lib:utils"],
)
bzl_library(
name = "diff_test",
srcs = ["diff_test.bzl"],
)
bzl_library(
name = "run_binary",
srcs = ["run_binary.bzl"],
deps = [
":expand_locations",
":expand_variables",
"//lib:stamping",
"@bazel_skylib//lib:dicts",
],
)
bzl_library(
name = "patch",
srcs = ["patch.bzl"],
deps = [":repo_utils"],
)
bzl_library(
name = "host_repo",
srcs = ["host_repo.bzl"],
deps = [":repo_utils"],
)
bzl_library(
name = "jq_toolchain",
srcs = ["jq_toolchain.bzl"],
deps = [":repo_utils"],
)
bzl_library(
name = "repo_utils",
srcs = ["repo_utils.bzl"],
)
bzl_library(
name = "stamping",
srcs = ["stamping.bzl"],
)
bzl_library(
name = "yq",
srcs = ["yq.bzl"],
)
bzl_library(
name = "yq_toolchain",
srcs = ["yq_toolchain.bzl"],
deps = [":repo_utils"],
exports_files(
glob(["*.bzl"]),
visibility = ["//lib/private/docs:__pkg__"],
)

View File

@ -0,0 +1,210 @@
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 = "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",
":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",
"@bazel_skylib//lib:dicts",
],
)
bzl_library(
name = "expand_variables",
srcs = ["//lib/private:expand_variables.bzl"],
deps = [
"@bazel_skylib//lib:paths",
],
)
bzl_library(
name = "utils",
srcs = ["//lib/private:utils.bzl"],
)
bzl_library(
name = "jq",
srcs = ["//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/private:diff_test.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 = "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"],
)
bzl_library(
name = "yq_toolchain",
srcs = ["//lib/private:yq_toolchain.bzl"],
deps = [":repo_utils"],
)