Skip to content

Commit

Permalink
fix: export constraints.bzl file from @local_config_platform so it ca…
Browse files Browse the repository at this point in the history
…n be used in downstream bzl_library targets

Downstream rule sets may depend on `@local_config_platform//:constraints.bzl` but when they do there is no way easy way to make that load statement compatible with `bzl_library`. This change makes it possible to use `bzl_library` on starlark code that loads from `@local_config_platform//:constraints.bzl`.

For example,

```
bzl_library(
    name = "local_config_platform_constraints",
    srcs = ["@local_config_platform//:constraints.bzl"],
)

bzl_library(
    name = "platform_utils",
    srcs = ["//lib/private:platform_utils.bzl"],
    deps = [":local_config_platform_constraints"],
)
```

Closes #16665.

PiperOrigin-RevId: 486957479
Change-Id: I328b7a3722aea95b3151ed88f23c277ed4154202
  • Loading branch information
gregmagolan authored and copybara-github committed Nov 8, 2022
1 parent 5903c31 commit 4959d34
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,11 @@ private static String buildFileContent(String repositoryName) {
"platform(name = 'host',",
" # Auto-detected host platform constraints.",
" constraint_values = HOST_CONSTRAINTS,",
")"),
")",
"exports_files([",
" # Export constraints.bzl for use in downstream bzl_library targets.",
" 'constraints.bzl',",
"])"),
repositoryName);
}

Expand Down

0 comments on commit 4959d34

Please sign in to comment.