it doesn't accept any other flags. so, if we have a PklProject file that has read("env:MY_VAR") within.
Our only option is to export MY_VAR as OS env var.
This limits our options and add more complexity at our side if we cannot export MY_VAR as OS env var.
Context
In this line in
pkl_project.bzl
https://github.com/apple/rules_pkl/blob/6317523342e42ef608aa390444b1ea01fb4a5176/pkl/private/pkl_project.bzl#L68it doesn't accept any other flags. so, if we have a
PklProject
file that hasread("env:MY_VAR")
within. Our only option is to exportMY_VAR
as OS env var.This limits our options and add more complexity at our side if we cannot export
MY_VAR
as OS env var.Given that
pkl_package
solves this issue by acceptingextra_flags
attribute https://github.com/apple/rules_pkl/blob/6317523342e42ef608aa390444b1ea01fb4a5176/pkl/private/pkl_package.bzl#L85 I think we can use the same approach and addextra_flags
attribute topkl_project
as well which will simplify Bazel code at user-side by a marginExample
consider this example
PklProject
filewith this example
BUILD.bazel
file:if I tried to do
bazel build //my_target:my_pkl_project
it will fail withCannot find resource env: MY_VERSION
Current State:
To allow the build command to succeed, it should be changed to
MY_VERSION=1.0.0 bazel build //my_target:pkl-package --action_env=MY_VERSION
Desired State:
We need to add support for passing the version from other Bazel variable, like: