Skip to content

Generate code with other lang - #52

Merged
WeiTing1991 merged 8 commits into
mainfrom
generate-code-with-other-lang
Sep 17, 2025
Merged

WeiTing1991 merged 8 commits into
mainfrom
generate-code-with-other-lang

Conversation

@WeiTing1991

@WeiTing1991 WeiTing1991 commented Sep 4, 2025 •

Copy link
Copy Markdown
Member

add feature of #27

  • change the generate_proto_classes enable to generate the proto for different language.
  • add create_class_assets to package the generated file for .zip.
  • add action in build.yml for test and in release to take the .zip to assets.

file path name: compas_pb-generated-{target-language}-31.1.zip\compas_pb\generated\

  • generate file
invoke generate-proto-classes --target-language=cpp
invoke generate-proto-classes --target-language=...
  • generate and create as .zip
invoke create_class_assets

@WeiTing1991
WeiTing1991 marked this pull request as ready for review September 4, 2025 13:56
Copilot AI review requested due to automatic review settings September 4, 2025 13:56
@WeiTing1991 WeiTing1991 self-assigned this Sep 4, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Comment thread src/compas_pb/invocations.py Outdated

@invoke.task()
def create_class_assets(ctx):
base_dir = Path(ctx.base_folder)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't ctx.base_folder already Path?

Comment thread src/compas_pb/invocations.py Outdated
Comment thread src/compas_pb/invocations.py Outdated
proto_out_folder = Path(ctx.proto_out_folder) / "compas_pb" / "generated" / target_language
proto_out_folder.mkdir(parents=True, exist_ok=True)
else:
print(f"Target language '{target_language}' not supported.")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this we can probably check at the very beginning of the task function

Comment thread tasks.py Outdated

@chenkasirer chenkasirer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left some minor comments, otherwise LGTM

Comment thread tasks.py Outdated
"proto_include_paths": [Path("./src") / "compas_pb"/"protobuf_defs"],
"proto_out_folder": Path("./src"),
# typescript,javascript, and go need other compiler plugins
"proto_target_languages": ["cpp", "csharp", "java", "objc", "php", "ruby"],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this belongs here, if the user adds more languages it won't make them supported..
perhaps we move this inside the invocations.py module as a module attribute which we can update in the future if we add support for more languages?

@WeiTing1991
WeiTing1991 merged commit fcd4a71 into main Sep 17, 2025
18 checks passed
@WeiTing1991
WeiTing1991 deleted the generate-code-with-other-lang branch September 17, 2025 11:49
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.

3 participants