Skip to content
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 skip_type_generation argument to generate_function to suppress type generation #360

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gareth-cross
Copy link
Contributor

This change adds an optional argument to generate_function to allow skipping generation of any code-generation types (c++/python/lcm).

When true, only the function code is generated and no other files are written. The logic proceeds normally otherwise, and the typenames_dict and namespaces_dict are filled out as expected.

This configuration is useful if you intend to define types manually elsewhere, and want to suppress any extra emitted files.

This is a more minimal version of the proposal raised here: #183

CC @anuragmakineni

Co-authored-by: Anurag Makineni <anuragmanikeni@users.noreply.github.com>
@@ -530,7 +532,8 @@ def generate_function(
shared_types=shared_types,
output_dir=os.fspath(output_dir),
lcm_bindings_output_dir=os.fspath(lcm_bindings_output_dir),
templates=templates,
# If not generating types, pass empty TemplateList to emission of files:
templates=templates if not skip_type_generation else template_util.TemplateList(),
Copy link
Contributor

Choose a reason for hiding this comment

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

From line 507 it seems like templates is already an empty TemplateList()?
Not sure if I'm missing something here.

@aaron-skydio
Copy link
Member

I think you could also accomplish this by passing shared_types as all the types the function takes, although it's maybe annoying to have to build that - I do think we maybe want to merge the flags, e.g. have a singleton ALL as something you can pass for shared_types to indicate that all types are shared, instead of adding an additional argument?

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.

None yet

4 participants