-
Notifications
You must be signed in to change notification settings - Fork 122
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
Output Runner will only run each unique command+args once #422
Conversation
This seems entirely reasonable to me! Could I have you add an e2e test to validate the behavior? Here is a preexisting output runner test that you can duplicate and extend to validate your new functionality. Thanks so much for your contribution! This is a really good usability improvement |
+1, not the most straightforward, but crafted a test to write words to the sentinel file based on requested commands. So we can test that each word was unique. |
Thanks for doing that. Out of curiosity, do these pass on your box locally? |
Shoot, it's still failing on buildkite. But yeah, they pass fine when I run |
Ok, maybe it'll work now. I'd actually been using While I'm sure some form of ensuring the hermeticity would be preferred, I for now just made |
I believe splitting the test data into two sets of targets would provide you this flexibility and make the tests more hermetic. WDYT about that as a solution? |
Friendly ping on this |
Hah, sorry, crazy week (moving houses + work makes me forgetful) I'll try and wrap this up this upcoming week! |
No rush at all, just wanted to make sure I didn't scare you off 😁 |
Ok, so looking at the way So did you mean for me to fully create a separate suite? |
If you don't think this is possible, then please don't do it. I'd rather have the feature in. My expectation was that you could do something like this:
Then you could target |
facepalm Yes! That works fine! Honestly for a minute when you said add targets I was thinking of the actual bazel e2e test call, not the inner generated rules. And duh, just creating a second internal package should work I think. |
Ok, updated :D |
@@ -93,6 +93,8 @@ func TestMatchRegex(t *testing.T) { | |||
buf.WriteString("buildozer 'add deps test_dep2' //target2:target2\n") | |||
buf.WriteString("buildifier 'cmd_nvm' //target_nvm:target_nvm\n") | |||
buf.WriteString("not_a_match 'nvm' //target_nvm:target_nvm\n") | |||
// Duplicate match, to be deduplicated. | |||
buf.WriteString("buildifier 'cmd_ignore' //target_ignore:target_ignore\n") |
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 to bring something like this up do late in the review process but I didn't realize till just now. Does this imply that a program who emits:
buildifier 'add deps test_dep1' //target
buildifier 'add deps test_dep2' //target
Would only have the first buildifier run? Wouldn't we want to dedupe based on both the command and arguments so that we don't have to do 2 builds in order to add 2 deps to a binary?
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.
This already dedupes based on command and arguments. This just looks unclear (in fact, when you raised this, I had to read back over it a few times to convince myself it's correct).
This is a buildifier
call not buildozer
, and the matcher for it does not use string parts in its call to buildifier
below.
I've updated this with an extra string and some comments to make it clearer the diff between this line and the additional buildozer
line I've added 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.
Ah! I think I see it now. buildifier
!= buildozer
. I think this invocation of buildifier
is a bit strange. Wouldn't buildifer
be applied to a single file to format it? Why is it taking a cmd_ignore
and a target?
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.
lol, copy-pasta? I was copying line 94 (as another bazel output to match on) but changing it slightly, so that it'd match the regex but not fully match the line.
I can do something else with it.
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 mostly look at the test cases to see examples of how it would actually be used. My tiny monkey brain would be a little less taxed if the examples were a little more straight forward. Sorry!
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.
lol, np, I just updated this to match the buildozer
and gazelle
suggestions from documentation.
Prospective feature that would really help us, just putting it out there as a proposal.
Goes along with #421