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

support relative paths for bazel.buildifierExecutable #329

Closed
bradzacher opened this issue Jan 9, 2024 · 0 comments · Fixed by #350
Closed

support relative paths for bazel.buildifierExecutable #329

bradzacher opened this issue Jan 9, 2024 · 0 comments · Fixed by #350

Comments

@bradzacher
Copy link

Currently buildifier is executed from the disk root, which means that if you configure a path like "bazel.buildifierExecutable": "./path/to/buildifier" then the extension will execute /path/to/buildifier - which likely doesn't exist.

It would be good if the CWD for the execution could be set to the workspace root to enable relative path config. This is similar to #132 but doesn't require any variable resolution.

vogelsgesang added a commit to vogelsgesang/vscode-bazel that referenced this issue Feb 29, 2024
Buildifier is frequently installed through Bazel as described on
https://github.com/bazelbuild/buildtools/blob/master/buildifier/README.md#setup-and-usage-via-bazel
such that it can be run through `bazel run`.

This commit allows the `bazel.buildifierExecutable` setting to refer
to a Bazel target. All paths starting with `@` are interpreted as Bazel
target names and are executed through `bazel run`. Bazel targets could
also start with `//` but we interpret those as normal file system paths.
If someone wants to run a target in the own workspace, they can simply
use, e.g., `@//:buildifier` instead of `//:buildifier`.

As a drive-by fix, I also bazel-contrib#329 since it was a single-line fix.

Fixes bazel-contrib#185, bazel-contrib#329
vogelsgesang added a commit to vogelsgesang/vscode-bazel that referenced this issue Feb 29, 2024
Buildifier is frequently installed through Bazel as described on
https://github.com/bazelbuild/buildtools/blob/master/buildifier/README.md#setup-and-usage-via-bazel
such that it can be run through `bazel run`.

This commit allows the `bazel.buildifierExecutable` setting to refer
to a Bazel target. All paths starting with `@` are interpreted as Bazel
target names and are executed through `bazel run`. Bazel targets could
also start with `//` but we interpret those as normal file system paths.
If someone wants to run a target in the own workspace, they can simply
use, e.g., `@//:buildifier` instead of `//:buildifier`.

As a drive-by fix, I also fixed bazel-contrib#329 since it was a one-line fix.

Fixes bazel-contrib#185, bazel-contrib#329
vogelsgesang added a commit to vogelsgesang/vscode-bazel that referenced this issue Feb 29, 2024
Buildifier is frequently installed through Bazel as described on
https://github.com/bazelbuild/buildtools/blob/master/buildifier/README.md#setup-and-usage-via-bazel
such that it can be run through `bazel run`.

This commit allows the `bazel.buildifierExecutable` setting to refer
to a Bazel target. All paths starting with `@` are interpreted as Bazel
target names and are executed through `bazel run`. Bazel targets could
also start with `//` but we interpret those as normal file system paths.
If someone wants to run a target in the own workspace, they can simply
use, e.g., `@//:buildifier` instead of `//:buildifier`.

As a drive-by fix, I also fixed bazel-contrib#329 since it was a one-line fix.

Fixes bazel-contrib#185, bazel-contrib#329
vogelsgesang added a commit to vogelsgesang/vscode-bazel that referenced this issue Feb 29, 2024
Buildifier is frequently installed through Bazel as described on
https://github.com/bazelbuild/buildtools/blob/master/buildifier/README.md#setup-and-usage-via-bazel
such that it can be run through `bazel run`.

This commit allows the `bazel.buildifierExecutable` setting to refer
to a Bazel target. All paths starting with `@` are interpreted as Bazel
target names and are executed through `bazel run`. Bazel targets could
also start with `//` but we interpret those as normal file system paths.
If someone wants to run a target in the own workspace, they can simply
use, e.g., `@//:buildifier` instead of `//:buildifier`.

As a drive-by fix, I also fixed bazel-contrib#329 since it was a one-line fix.

Fixes bazel-contrib#185, bazel-contrib#329
jfirebaugh added a commit that referenced this issue Mar 1, 2024
Buildifier is frequently installed through Bazel as described on
https://github.com/bazelbuild/buildtools/blob/master/buildifier/README.md#setup-and-usage-via-bazel
such that it can be run through `bazel run`.

This commit allows the `bazel.buildifierExecutable` setting to refer
to a Bazel target. All paths starting with `@` are interpreted as Bazel
target names and are executed through `bazel run`. Bazel targets could
also start with `//` but we interpret those as normal file system paths.
If someone wants to run a target in the own workspace, they can simply
use, e.g., `@//:buildifier` instead of `//:buildifier`.

As a drive-by fix, I also fixed #329 since it was a one-line fix.

Fixes #185, #329

Co-authored-by: John Firebaugh <jfirebaugh@figma.com>
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 a pull request may close this issue.

1 participant