-
-
Notifications
You must be signed in to change notification settings - Fork 170
feat: add flag controlling the default for use_execroot_entry_point #2837
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
acozzette
wants to merge
5
commits into
aspect-build:main
Choose a base branch
from
acozzette:use-execroot-entry-point
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 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
50ba91b
feat: add flag controlling the default for use_execroot_entry_point
acozzette e6ed128
Added more tests
acozzette 83e5c60
Update snapshots
acozzette 7854297
Add use_execroot_entry_point param on Next.js macros for compatibilit…
acozzette 2b6f2cc
Add todo
acozzette 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,143 @@ | ||
| load("@bazel_lib//lib:diff_test.bzl", "diff_test") | ||
| load("@bazel_lib//lib:testing.bzl", "assert_contains") | ||
| load("@bazel_lib//lib:transitions.bzl", "platform_transition_filegroup") | ||
| load("@bazel_skylib//rules:write_file.bzl", "write_file") | ||
| load("//js:defs.bzl", "js_binary", "js_run_binary") | ||
|
|
||
| # We want to verify that a js_binary's data dependencies are found only in the | ||
| # runfiles when use_execroot_entry_point = False. To do this we use | ||
| # find_cfg_probe.mjs to tell us whether cfg_probe.txt landed in just the | ||
| # runfiles or somewhere else. | ||
| write_file( | ||
| name = "gen_cfg_probe", | ||
| out = "cfg_probe.txt", | ||
| content = ["probe"], | ||
| ) | ||
|
|
||
| js_binary( | ||
| name = "find_cfg_probe", | ||
| data = [ | ||
| ":cfg_probe.txt", | ||
| "//:node_modules/@bazel/runfiles", | ||
| ], | ||
| entry_point = "find_cfg_probe.mjs", | ||
| fixed_args = ["$(rlocationpath :cfg_probe.txt)"], | ||
| ) | ||
|
|
||
| js_run_binary( | ||
| name = "runfiles_location", | ||
| stdout = "runfiles_location.txt", | ||
| tool = ":find_cfg_probe", | ||
| use_execroot_entry_point = False, | ||
| ) | ||
|
|
||
| assert_contains( | ||
| name = "runfiles_test", | ||
| actual = ":runfiles_location.txt", | ||
| expected = "RUNFILES_ONLY", | ||
| ) | ||
|
|
||
| # With use_execroot_entry_point = True, the tool's data dependencies are built | ||
| # in the target configuration and we should find them in the target bin | ||
| # directory, the same place a genrule would put its srcs. | ||
| js_run_binary( | ||
| name = "target_cfg_location", | ||
| stdout = "target_cfg_location.txt", | ||
| tool = ":find_cfg_probe", | ||
| use_execroot_entry_point = True, | ||
| ) | ||
|
|
||
| genrule( | ||
| name = "expected_target_cfg_location", | ||
| srcs = [":cfg_probe.txt"], | ||
| outs = ["expected_target_cfg_location.txt"], | ||
| cmd = "echo $(execpath :cfg_probe.txt) > $@", | ||
| ) | ||
|
|
||
| diff_test( | ||
| name = "target_cfg_test", | ||
| file1 = ":target_cfg_location.txt", | ||
| file2 = ":expected_target_cfg_location.txt", | ||
| ) | ||
|
|
||
| # Verify that dependencies passed via the srcs parameter are always built for | ||
| # the target platform, unlike the tool parameter and its dependencies. | ||
| # We use a select() on the OS to produce a platform-specific file, then | ||
| # transition to three different target platforms and assert the contents match. | ||
| write_file( | ||
| name = "gen_os_name", | ||
| out = "os_name.txt", | ||
| content = select({ | ||
| "@platforms//os:linux": ["linux"], | ||
| "@platforms//os:macos": ["macos"], | ||
| "@platforms//os:windows": ["windows"], | ||
| "//conditions:default": ["other"], | ||
| }), | ||
| tags = ["manual"], | ||
| ) | ||
|
|
||
| platform( | ||
| name = "linux", | ||
| constraint_values = ["@platforms//os:linux"], | ||
| ) | ||
|
|
||
| platform( | ||
| name = "macos", | ||
| constraint_values = ["@platforms//os:macos"], | ||
| ) | ||
|
|
||
| platform( | ||
| name = "windows", | ||
| constraint_values = ["@platforms//os:windows"], | ||
| ) | ||
|
|
||
| js_binary( | ||
| name = "read_file", | ||
| entry_point = "read_file.mjs", | ||
| ) | ||
|
|
||
| js_run_binary( | ||
| name = "gen_target_os", | ||
| srcs = [":os_name.txt"], | ||
| args = ["$(rootpath :os_name.txt)"], | ||
| stdout = "target_os.txt", | ||
| tags = ["manual"], | ||
| tool = ":read_file", | ||
| use_execroot_entry_point = False, | ||
| ) | ||
|
|
||
| platform_transition_filegroup( | ||
| name = "target_os_linux", | ||
| srcs = [":gen_target_os"], | ||
| target_platform = ":linux", | ||
| ) | ||
|
|
||
| platform_transition_filegroup( | ||
| name = "target_os_macos", | ||
| srcs = [":gen_target_os"], | ||
| target_platform = ":macos", | ||
| ) | ||
|
|
||
| platform_transition_filegroup( | ||
| name = "target_os_windows", | ||
| srcs = [":gen_target_os"], | ||
| target_platform = ":windows", | ||
| ) | ||
|
|
||
| assert_contains( | ||
| name = "linux_target_platform_test", | ||
| actual = ":target_os_linux", | ||
| expected = "linux", | ||
| ) | ||
|
|
||
| assert_contains( | ||
| name = "macos_target_platform_test", | ||
| actual = ":target_os_macos", | ||
| expected = "macos", | ||
| ) | ||
|
|
||
| assert_contains( | ||
| name = "windows_target_platform_test", | ||
| actual = ":target_os_windows", | ||
| expected = "windows", | ||
| ) |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.