Skip to content

Commit

Permalink
refactor: move bzl_library target out of @local_config_platform and j…
Browse files Browse the repository at this point in the history
…ust use exports_files in there instead
  • Loading branch information
gregmagolan committed Nov 4, 2022
1 parent 1f76b0b commit ad7f630
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
8 changes: 7 additions & 1 deletion lib/private/docs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library")

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"],
Expand All @@ -15,7 +21,7 @@ bzl_library(
bzl_library(
name = "platform_utils",
srcs = ["//lib/private:platform_utils.bzl"],
deps = ["@local_config_platform//:constraints"],
deps = [":local_config_platform_constraints"],
)

bzl_library(
Expand Down
10 changes: 4 additions & 6 deletions lib/private/local_config_platform.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ load(":repo_utils.bzl", "repo_utils")

def _impl(rctx):
rctx.file("BUILD.bazel", """load(':constraints.bzl', 'HOST_CONSTRAINTS')
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
package(default_visibility = ['//visibility:public'])
Expand All @@ -14,11 +13,10 @@ platform(name = 'host',
constraint_values = HOST_CONSTRAINTS,
)
bzl_library(
name = "constraints",
srcs = ["constraints.bzl"],
visibility = ["//visibility:public"],
)
exports_files([
# Export constraints.bzl for use in downstream bzl_library targets.
'constraints.bzl',
])
""")

[os, cpu] = repo_utils.platform(rctx).split("_")
Expand Down

0 comments on commit ad7f630

Please sign in to comment.