Skip to content
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

Path map executable paths #22844

Closed
wants to merge 2 commits into from
Closed

Conversation

fmeum
Copy link
Collaborator

@fmeum fmeum commented Jun 21, 2024

In CommandLines, the very first argument of the first command line is always a path to an executable. As such, it should be path mapped, even when it is a string. This wasn't the case for SpawnAction's created via ctx.actions.run(executable = <some string>).

Work towards #6526
Work towards #22366

@fmeum fmeum requested a review from a team as a code owner June 21, 2024 11:08
@fmeum fmeum requested review from gregestren and justinhorvitz and removed request for a team and gregestren June 21, 2024 11:08
@github-actions github-actions bot added team-Performance Issues for Performance teams team-Configurability platforms, toolchains, cquery, select(), config transitions awaiting-review PR is awaiting review from an assigned reviewer labels Jun 21, 2024
In `CommandLines`, the very first argument of the first command line is always a path to an executable. As such, it should both be path mapped and turned into a "callable" path (e.g. `./tool.sh` instead of `tool.sh`). This wasn't the case for `SpawnAction`'s created via `ctx.actions.run(executable = <some string>)`.

This is fixed by moving the handling of the first argument into `CommandLines`.
@fmeum fmeum marked this pull request as draft June 21, 2024 12:02
@fmeum fmeum removed the request for review from justinhorvitz June 21, 2024 12:03
@fmeum
Copy link
Collaborator Author

fmeum commented Jun 21, 2024

Marking this as draft as the idea is flawed: It's possible that the user wants the executable to be looked up in path.

@fmeum fmeum changed the title Consolidate special handling of executable path Path map executable paths Jun 25, 2024
@fmeum fmeum marked this pull request as ready for review June 25, 2024 15:26
@fmeum fmeum requested a review from justinhorvitz June 25, 2024 15:26
@fmeum
Copy link
Collaborator Author

fmeum commented Jul 18, 2024

@justinhorvitz Friendly ping

@justinhorvitz
Copy link
Contributor

Is this change only necessary due to the optimization detailed at https://cs.opensource.google/bazel/bazel/+/master:src/main/java/com/google/devtools/build/lib/analysis/actions/SpawnAction.java;l=979-982;drc=d32202b20f82c17f75ee204d505b08f2160640f5? That comes from d18702c, for which the internal description mentions a trivial memory savings. Maybe it's not worth it? @comius

@fmeum
Copy link
Collaborator Author

fmeum commented Jul 18, 2024

Not just because of that: There is plenty of starlark API that doesn't provide access to an Artifact, but just the path of an executable. For example, C++ tool paths and the java binary can only be obtained as strings but may still need to be mapped.

@justinhorvitz
Copy link
Contributor

Thanks, it's much easier to justify this change then.

@fmeum
Copy link
Collaborator Author

fmeum commented Jul 18, 2024

@bazel-io fork 7.3.0

@Wyverald Wyverald added awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally and removed awaiting-review PR is awaiting review from an assigned reviewer labels Jul 23, 2024
@iancha1992
Copy link
Member

@justinhorvitz @fmeum Just a friendly reminder, the 7.3.0RC1 is scheduled for next Monday, July 29th. Thanks!

@github-actions github-actions bot removed the awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally label Jul 26, 2024
@fmeum fmeum deleted the executable-path-mapping branch July 26, 2024 06:12
fmeum added a commit to fmeum/bazel that referenced this pull request Jul 26, 2024
In `CommandLines`, the very first argument of the first command line is always a path to an executable. As such, it should be path mapped, even when it is a string. This wasn't the case for `SpawnAction`'s created via `ctx.actions.run(executable = <some string>)`.

Work towards bazelbuild#6526
Work towards bazelbuild#22366

Closes bazelbuild#22844.

PiperOrigin-RevId: 656258007
Change-Id: Ia046a7cc66aae51aec764e2f1c49e1d4f69e4b37

Closes bazelbuild#23040
fmeum added a commit to fmeum/bazel that referenced this pull request Jul 26, 2024
In `CommandLines`, the very first argument of the first command line is always a path to an executable. As such, it should be path mapped, even when it is a string. This wasn't the case for `SpawnAction`'s created via `ctx.actions.run(executable = <some string>)`.

Work towards bazelbuild#6526
Work towards bazelbuild#22366

Closes bazelbuild#22844.

PiperOrigin-RevId: 656258007
Change-Id: Ia046a7cc66aae51aec764e2f1c49e1d4f69e4b37

Closes bazelbuild#23040
github-merge-queue bot pushed a commit that referenced this pull request Jul 29, 2024
In `CommandLines`, the very first argument of the first command line is
always a path to an executable. As such, it should be path mapped, even
when it is a string. This wasn't the case for `SpawnAction`'s created
via `ctx.actions.run(executable = <some string>)`.

Work towards #6526
Work towards #22366

Closes #22844.

PiperOrigin-RevId: 656258007
Change-Id: Ia046a7cc66aae51aec764e2f1c49e1d4f69e4b37

Closes #23040
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-Configurability platforms, toolchains, cquery, select(), config transitions team-Performance Issues for Performance teams
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants