Skip to content

Allow empty string value for xcschemes.env_value #3165

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ghugues
Copy link

@ghugues ghugues commented Apr 6, 2025

Xcode allows defining environment variables without a value. At runtime, sometimes only the presence of the environment variable is checked, not its value (e.g. CG_NUMERICS_SHOW_BACKTRACE, CGBITMAP_CONTEXT_LOG_ERRORS, etc.).

@ghugues ghugues requested a review from a team as a code owner April 6, 2025 14:37
@adincebic
Copy link
Contributor

@ghugues I think you need to sign off the commit.

Signed-off-by: Guillaume Hugues <guillaume@amo.co>
@ghugues ghugues force-pushed the allow-empty-env-values branch from 0586254 to 7e98584 Compare April 7, 2025 07:35
@@ -1142,7 +1142,7 @@ def _env_value(value, *, enabled = True):
checked in the scheme. An unchecked checkbox means Xcode won't
include that environment variable when running a target.
"""
if not value:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to adjust the tests for this.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was not covered by unit tests so I add added a new suite with a couple tests. Let me know if this is what you had in mind.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brentleyjones quick reminder.

@ghugues ghugues requested a review from brentleyjones April 25, 2025 15:28
Signed-off-by: Guillaume Hugues <guillaume@amo.co>
@ghugues ghugues force-pushed the allow-empty-env-values branch from 371e243 to a8a9bf5 Compare April 25, 2025 15:30
@@ -2,13 +2,16 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load(":info_constructors_tests.bzl", "info_constructors_test_suite")
load(":infos_from_json_tests.bzl", "infos_from_json_test_suite")
load(":write_schemes_tests.bzl", "write_schemes_test_suite")
load(":xcschemes_base_tests.bzl", "xcschemes_base_test_suite")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"base" isn't a good name for this, and xcschemes_ is redundant (we are in the xcschemes package).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants