-
-
Notifications
You must be signed in to change notification settings - Fork 82
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 running buildifier through Bazel #350
Merged
jfirebaugh
merged 2 commits into
bazel-contrib:master
from
vogelsgesang:avogelsgesang-buildifier-bazel-target
Mar 1, 2024
Merged
Support running buildifier through Bazel #350
jfirebaugh
merged 2 commits into
bazel-contrib:master
from
vogelsgesang:avogelsgesang-buildifier-bazel-target
Mar 1, 2024
Conversation
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
vogelsgesang
requested review from
coeuvre,
jfirebaugh and
cameron-martin
as code owners
February 29, 2024 03:59
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
force-pushed
the
avogelsgesang-buildifier-bazel-target
branch
from
February 29, 2024 21:56
5437d95
to
d48ff7d
Compare
jfirebaugh
approved these changes
Mar 1, 2024
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.
Thank you!
Thank you for this! |
Zemnmez
added a commit
to zemn-me/monorepo
that referenced
this pull request
Mar 12, 2024
…uildifier. Merge when bazel-contrib/vscode-bazel#350 lands.
CauhxMilloy
added a commit
to CauhxMilloy/vscode-bazel
that referenced
this pull request
Mar 17, 2024
This PR adds the `buildifierConfigJsonPath` setting, which allows a custom path to be set to pull the json configuration file for `buildifier` (this is often `.buildifier.json`). If the `buildifierConfigJsonPath` path is set, when `buildifier` is run within this extension, the `--config <path>` CLI arguments will be passed to `buildifier`. While it could be said that this PR is now adding support for the `.buildifier.json` file -- it's only adding support for the customization of that file path. bazel-contrib#350 actually pulled out yet another drive-by fix (of bazel-contrib#208) by adding the working directory. In that PR, `cwd: vscode.workspace.workspaceFolders?.[0]?.uri?.fsPath` is setting the working directory for the `buildifier` execution local into the workspace. This means any local `.buildifier.json` file will automatically get pulled in and used. This PR is allowing further customization on top of that. The logic of this PR was tested by manually editing the js of my local extension installation with the equivalent changes (that's how I found that `cwd: ...` ended up working with a local `.buildifier.json`).
CauhxMilloy
added a commit
to CauhxMilloy/vscode-bazel
that referenced
this pull request
Mar 17, 2024
This PR adds the `buildifierConfigJsonPath` setting, which allows a custom path to be set to pull the json configuration file for `buildifier` (this is often `.buildifier.json`). If the `buildifierConfigJsonPath` path is set, when `buildifier` is run within this extension, the `--config <path>` CLI arguments will be passed to `buildifier`. While it could be said that this PR is now adding support for the `.buildifier.json` file -- it's only adding support for the customization of that file path. bazel-contrib#350 actually pulled out yet another drive-by fix (of bazel-contrib#208) by adding the working directory. In that PR, `cwd: vscode.workspace.workspaceFolders?.[0]?.uri?.fsPath` is setting the working directory for the `buildifier` execution local to be the workspace. This means any local `.buildifier.json` file will automatically get pulled in and used. This PR is allowing further customization on top of that. The logic of this PR was tested by manually editing the js of my local extension installation with the equivalent changes (that's how I found that `cwd: ...` ended up working with a local `.buildifier.json`).
CauhxMilloy
added a commit
to CauhxMilloy/vscode-bazel
that referenced
this pull request
Mar 17, 2024
This PR adds the `buildifierConfigJsonPath` setting, which allows a custom path to be set to pull the json configuration file for `buildifier` (this is often `.buildifier.json`). If the `buildifierConfigJsonPath` path is set, when `buildifier` is run within this extension, the `--config <path>` CLI arguments will be passed to `buildifier`. While it could be said that this PR is now adding support for the `.buildifier.json` file -- it's only adding support for the customization of that file path. bazel-contrib#350 actually pulled out yet another drive-by fix (of bazel-contrib#208) by adding the working directory. In that PR, `cwd: vscode.workspace.workspaceFolders?.[0]?.uri?.fsPath` is setting the working directory for the `buildifier` execution to be the local workspace. This means any local `.buildifier.json` file will automatically get pulled in and used. This PR is allowing further customization on top of that. The logic of this PR was tested by manually editing the js of my local extension installation with the equivalent changes (that's how I found that `cwd: ...` ended up working with a local `.buildifier.json`).
cameron-martin
added a commit
that referenced
this pull request
Mar 26, 2024
This PR adds the `buildifierConfigJsonPath` setting, which allows a custom path to be set to pull the json configuration file for `buildifier` (this is often `.buildifier.json`). If the `buildifierConfigJsonPath` path is set, when `buildifier` is run within this extension, the `--config <path>` CLI arguments will be passed to `buildifier`. While it could be said that this PR is now adding support for the `.buildifier.json` file -- it's only adding support for the customization of that file path. #350 actually pulled out yet another drive-by fix (of #208) by adding the working directory. In that PR, `cwd: vscode.workspace.workspaceFolders?.[0]?.uri?.fsPath` is setting the working directory for the `buildifier` execution to be the local workspace. This means any local `.buildifier.json` file will automatically get pulled in and used. This PR is allowing further customization on top of that. The logic of this PR was tested by manually editing the js of my local extension installation with the equivalent changes (that's how I found that `cwd: ...` ended up working with a local `.buildifier.json`). --------- Co-authored-by: Cameron Martin <cameronmartin123@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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 throughbazel 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
BEGIN_COMMIT_OVERRIDE
feat: Support running buildifier through Bazel (#350)
feat: Support relative paths for bazel.buildifierExecutable (#350)
feat: Pick up
.buildifier.json
configuration from the Bazel workspace root (#350)END_COMMIT_OVERRIDE