-
Notifications
You must be signed in to change notification settings - Fork 81
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
Add buildifier_test target #1597
Conversation
@@ -18,9 +18,6 @@ import Test.Hspec (context, hspec, it, describe, runIO, shouldSatisfy, expectati | |||
|
|||
main :: IO () | |||
main = hspec $ do | |||
it "bazel lint" $ do | |||
assertSuccess (bazel ["run", "//:buildifier"]) |
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.
I think this also checked files under examples and tutorial which are not covered by the new buidifier_test
with //:all_files
. Any way to keep those checked as well?
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.
I would suggest to add them as a local_repositories
providing same all_files
targets and use them as srcs of buildifier_test
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.
👍 Sounds like a good approach.
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.
Done
I see that CI is failing on Windows with
This happens when a Bazel rule emits a script like a bash script as its executable. This works on Unix, but not on Windows where such files are not valid executables. I suspect this may be the issue here. One way to fix this is to split the rule into two parts, one that fills in the script template and a separate That said, I don't think we need to block this PR on that. Only checking formatting on Unix is sufficient and we can skip this test on Windows. |
I've missed buildtools readme mentions explicitly Bazel target is not supported on Windows. This is actually true for run target used in RunTests.hs as well :) |
Ah, good to know. Thanks for clarifying! |
I've tagged this test as "dont_test_on_windows" so it should not be failing now. |
🎉 All dependencies have been resolved ! |
@aherrmann Is there anything else should be done here? |
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.
Sorry for the delay.
One small comment. Otherwise, this looks great, thank you!
This may need a manual rebase. It looks like some changes from the prerequisite PR are still in here. I think dpulls only rebases if the PR's target branch is the dependency's branch.
"@examples//:all_files", | ||
"@tutorial//:all_files", | ||
], | ||
tags = ["dont_test_on_windows"], |
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.
tags = ["dont_test_on_windows"], | |
mode = ["diff"], | |
tags = ["dont_test_on_windows"], |
I've tested this locally on a file with broken formatting and without this mode
attribute I'm getting the error
buildifier: open ./external/examples-arm/BUILD.bazel: read-only file system
It looks like the default mode is fix
and in test-mode these files are read-only.
The fix mode seems to only work with bazel run
instead of bazel test
.
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.
You're right, I was deceived by buildtools source code which is probably ahead :) https://github.com/bazelbuild/buildtools/blob/f575192a9d0644850302a9ac33e0129979f37e4a/buildifier/internal/factory.bzl#L49.
Rebase on master should fix the CI error. #1606 is merged. |
4da5c1c
to
47075fa
Compare
workspaces * add local_repository dependency in rules_haskell on these workspaces * enumerate filegroups to check explicitly in buildifier_test target
47075fa
to
f434ca4
Compare
#951: Create
buildifier_test
target target instead of runningbuild run //:buildifer
from RunTests.hsDepends on #1596