-
Notifications
You must be signed in to change notification settings - Fork 457
Closed
Description
Description:
Buildifier looks for .buildifier.json starting from the current directory and traversing up to the workspace root. However, the paths specified in .buildifier.json for Tables and AddTables are used "as-is," which can lead to issues when running buildifier from a subdirectory.
Example project structure:
root/
├── .buildifier.json
├── .buildifier-tables.json
├── foo/
│ └── BUILD.bazel
├── BUILD.bazel
└── WORKSPACE
.buildifier.json content:
{
"AddTables": ".buildifier-tables.json"
}Steps to reproduce:
- If
buildifieris run from therootdirectory (buildifier -r .), there is no issue. - If
buildifieris run from thefoosubdirectory (cd foo && buildifier), the following error occurs:In this case,buildifier: failed to parse .buildifier-tables.json for -add_tables: open .buildifier-tables.json: The system cannot find the file specified.buildifiersuccessfully finds.buildifier.json, but cannot locate the.buildifier-tables.jsonfile, even though it is in the same directory as.buildifier.json.
Examples:
I have created an example project to demonstrate the problem and validate a solution. You can find it here:
Expected behavior:
Buildifier should be able to find .buildifier-tables.json regardless of the directory from which it is run, or it should provide a way to resolve this issue without requiring a full path to the file.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels