-
Notifications
You must be signed in to change notification settings - Fork 183
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
Add env
and env_inherit
to native_binary
and native_test
(using @bazel_features
)
#484
Open
redsun82
wants to merge
27
commits into
bazelbuild:main
Choose a base branch
from
redsun82:env-native-binary-using-features
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
5e06f39
Add `env` and `env_inherit` to `native_binary` and `native_test`
redsun82 f59ff4a
Add test for `env` and `env_inherit`
redsun82 4dc1f9a
Make env and env_inherit parameters of native_binary depend on bazel …
redsun82 10ea0af
Update docs
redsun82 70e6b77
Update patch indexes
redsun82 6e83bfe
Fix windows compilation of `assertenv.cc`
redsun82 d53f286
Autoformat
redsun82 336176f
Autoformat correctly
redsun82 b2b6677
Tweak `env_test` for Windows
redsun82 df44fa9
Lint
redsun82 5a73fbe
Mention bazel version in native_binary docs
redsun82 2453f16
Fix formatting
redsun82 20acd19
Generalize again test to windows
redsun82 9ce0e55
Use `bazel_features`
redsun82 f1bd4e0
Add missing directory and fix docs
redsun82 165e7ef
Fix formatting
redsun82 c23d409
Merge branch 'main' into env-native-binary-using-features
redsun82 f05da82
Update `bazel_features`
redsun82 02c2708
Update `MODULE.bazle-remove-override.patch`
redsun82 f86cde0
Add location expansion to `env`
redsun82 798c1a7
Update docs
redsun82 a7c1415
Fix `--noenable_bzlmod` checks
redsun82 b9cc025
Remove unneeded backward compatibility code
redsun82 b8adf7f
Fix formatting
redsun82 1ca13a4
Remove unneeded code
redsun82 bcbc4fd
Merge branch 'main' into env-native-binary-using-features
8f76bb6
Clean up test code
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
|
||
bool check(const char *var, const char *expected = nullptr); | ||
|
||
int main() { | ||
bool ok = true; | ||
ok = ok && check("TEST_ENV_VAR", "test_env_var_value"); | ||
#ifdef _WIN32 | ||
ok = ok && check("APPDATA"); | ||
#else | ||
ok = ok && check("HOME"); | ||
#endif | ||
ok = | ||
ok && check("TEST_ENV_VAR_WITH_EXPANSION", "|tests/native_binary/BUILD|"); | ||
return ok ? 0 : 1; | ||
} | ||
|
||
bool check(const char *var, const char *expected) { | ||
const char *actual = getenv(var); | ||
if (actual == nullptr) { | ||
fprintf(stderr, "expected %s\n", var); | ||
return false; | ||
} | ||
if (expected && strcmp(actual, expected) != 0) { | ||
fprintf(stderr, "expected %s=%s, got %s\n", var, expected, actual); | ||
return false; | ||
} | ||
return true; | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there was a warning about a dependency pulling this version in