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 (#16698)

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

Co-authored-by: Greg Magolan <gmagolan@gmail.com>
  • Loading branch information
ShreeM01 and gregmagolan committed Nov 8, 2022
1 parent 7cc786a commit e9a931f
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 e9a931f

Please sign in to comment.