Skip to content

Conversation

@alexeagle
Copy link
Contributor

The logic for taking the basename assumes that outputs are in the same folder with the package.

This fix allows a protoc invocation like

proto_compile(
    name = "view_display_proto_compile",
    output_mappings = ["payload/view_display_pb2.py=internal/payload/view_display_pb2.py"],
    outputs = ["payload/view_display_pb2.py"],
    plugins = ["@build_stack_rules_proto//plugin/builtin:python"],
    proto = "view_display_proto",
)

Note: I only tested this with manually generated rules, I imagine changes to the gazelle plugin would also be needed.

The logic for taking the basename assumes that outputs are in the same folder with the package.

This fix allows a protoc invocation like

```
proto_compile(
    name = "view_display_proto_compile",
    output_mappings = ["payload/view_display_pb2.py=internal/payload/view_display_pb2.py"],
    outputs = ["payload/view_display_pb2.py"],
    plugins = ["@build_stack_rules_proto//plugin/builtin:python"],
    proto = "view_display_proto",
)
```
@pcj
Copy link
Member

pcj commented Feb 2, 2022

Thanks @alexeagle I'll take a look at this. Outputs in subfolders would indeed be a new usage.

@alexeagle
Copy link
Contributor Author

ping! :)

mpatou added a commit to rockset/stacky that referenced this pull request Jan 5, 2024
Summary
If there is more than one PRs open_prs is a list of dict and trying to
stringify it is not working too well:

Traceback (most recent call last):
  File "/data/home/mpatou/Rockset/rs/../rs2/scripts/stacky", line 1542, in <module>
    main()
  File "/data/home/mpatou/Rockset/rs/../rs2/scripts/stacky", line 1529, in main
    args.func(stack, args)
  File "/data/home/mpatou/Rockset/rs/../rs2/scripts/stacky", line 1042, in cmd_update
    load_pr_info_for_forest(forest)
  File "/data/home/mpatou/Rockset/rs/../rs2/scripts/stacky", line 531, in load_pr_info_for_forest
    b.load_pr_info()
  File "/data/home/mpatou/Rockset/rs/../rs2/scripts/stacky", line 303, in load_pr_info
    self.pr_info, self.open_pr_info = get_pr_info(self.name)
  File "/data/home/mpatou/Rockset/rs/../rs2/scripts/stacky", line 251, in get_pr_info
    die("Branch {} has more than one open PR: {}", branch, ", ".join(open_prs))
TypeError: sequence item 0: expected str instance, dict found

Test plan
Reran with the fix and got this instead:
```
2023-12-16 18:48:39,690 stacky ERROR: Branch master has more than one open PR: {'baseRefName': 'master', 'headRefName': 'master', 'id': 'PR_kwDOCQXGIM5CfHq6', 'mergeable': 'MERGEABLE', 'number': 303, 'state': 'OPEN', 'title': 'cc_library support resolve directive', 'url': 'stackb/rules_proto#303'}, {'baseRefName': 'master', 'headRefName': 'master', 'id': 'PR_kwDOCQXGIM4x4YnZ', 'mergeable': 'CONFLICTING', 'number': 213, 'state': 'OPEN', 'title': 'fix: allow generated files to be in a subfolder', 'url': 'stackb/rules_proto#213'}
```

Reviewers: tudor
mpatou added a commit to rockset/stacky that referenced this pull request Jan 8, 2024
Summary
If there is more than one PRs open_prs is a list of dict and trying to
stringify it is not working too well:

Traceback (most recent call last):
  File "/data/home/mpatou/Rockset/rs/../rs2/scripts/stacky", line 1542, in <module>
    main()
  File "/data/home/mpatou/Rockset/rs/../rs2/scripts/stacky", line 1529, in main
    args.func(stack, args)
  File "/data/home/mpatou/Rockset/rs/../rs2/scripts/stacky", line 1042, in cmd_update
    load_pr_info_for_forest(forest)
  File "/data/home/mpatou/Rockset/rs/../rs2/scripts/stacky", line 531, in load_pr_info_for_forest
    b.load_pr_info()
  File "/data/home/mpatou/Rockset/rs/../rs2/scripts/stacky", line 303, in load_pr_info
    self.pr_info, self.open_pr_info = get_pr_info(self.name)
  File "/data/home/mpatou/Rockset/rs/../rs2/scripts/stacky", line 251, in get_pr_info
    die("Branch {} has more than one open PR: {}", branch, ", ".join(open_prs))
TypeError: sequence item 0: expected str instance, dict found

Test plan
Reran with the fix and got this instead:
```
2023-12-16 18:48:39,690 stacky ERROR: Branch master has more than one open PR: {'baseRefName': 'master', 'headRefName': 'master', 'id': 'PR_kwDOCQXGIM5CfHq6', 'mergeable': 'MERGEABLE', 'number': 303, 'state': 'OPEN', 'title': 'cc_library support resolve directive', 'url': 'stackb/rules_proto#303'}, {'baseRefName': 'master', 'headRefName': 'master', 'id': 'PR_kwDOCQXGIM4x4YnZ', 'mergeable': 'CONFLICTING', 'number': 213, 'state': 'OPEN', 'title': 'fix: allow generated files to be in a subfolder', 'url': 'stackb/rules_proto#213'}
```

Reviewers: tudor
@pcj
Copy link
Member

pcj commented Feb 17, 2024

Sadly this is quite old. Will close due to age, but we can pick this up again if still needed.

@pcj pcj closed this Feb 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants