-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add example with go proto codegen #15
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
base: main
Are you sure you want to change the base?
Changes from 4 commits
ac531ae
3002f60
48412e4
10d3551
8cf4cb6
75e9a29
3d47766
51d6bf8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,12 +66,11 @@ def _diff_rule_impl(ctx): | |
|
|
||
| # If both inputs are generated, there's no writable file to patch. | ||
| is_copy_to_source = ctx.file.file1.is_source or ctx.file.file2.is_source | ||
| outputs = [ctx.outputs.patch, ctx.outputs.exit_code] | ||
| ctx.actions.run_shell( | ||
| inputs = [ctx.file.file1, ctx.file.file2] + diffinfo.tool_files, | ||
| outputs = outputs, | ||
| outputs = [ctx.outputs.patch, ctx.outputs.exit_code], | ||
| command = command, | ||
| mnemonic = "DiffutilsDiff", | ||
| mnemonic = "Diff", | ||
|
alexeagle marked this conversation as resolved.
Outdated
|
||
| progress_message = "Diffing %{input} to %{output}", | ||
| ) | ||
|
|
||
|
|
@@ -82,11 +81,11 @@ def _diff_rule_impl(ctx): | |
| ERROR: diff command exited with non-zero status. | ||
|
|
||
| To accept the diff, run: | ||
| patch -d \\$(bazel info workspace) -p0 < {patch} | ||
| """.format(patch = ctx.outputs.patch.path))) | ||
| patch -d \\$(bazel info workspace) -p0 < \\$(bazel info bazel-bin)/{patch} | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (for my understanding) what case does this fix?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe it's when your current working directory is not the repository root. |
||
| """.format(patch = ctx.outputs.patch.short_path))) | ||
|
|
||
| return [ | ||
| DefaultInfo(files = depset(outputs)), | ||
| DefaultInfo(files = depset([ctx.file.file1])), | ||
|
alexeagle marked this conversation as resolved.
|
||
| OutputGroupInfo( | ||
| _validation = depset(validation_outputs), | ||
| # By reading the Build Events, a Bazel wrapper can identify this diff output group and apply the patch. | ||
|
|
||
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 hope this can't push to main⚠️ . Is it necessary in addition to
pull-requests: write?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 so, because it needs to create a branch to hold the commits
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'm really hesitant about including this. There are going to be lots of test cases in this repo that produce patches but we don't necessarily want the build to fail and a patch to be auto applied.
I'm also concerned about the security implications of
contents: writeand I don't fully understand what capabilities it would give to someone submitting a PR from their fork. Do you know?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 might be best kept as a documented example of how you can use the diff output groups for automatic patching and not part of ci.