[SERVER-43187] standardize C++ codegen tools to YAML and Cheetah Created: 05/Sep/19  Updated: 07/Apr/23

Status: Backlog
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Billy Donahue Assignee: Backlog - Service Architecture
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Service Arch
Participants:

 Description   

Would be nice if most or all of our C++ code generators used the same tool. That tool, rather than arbitrary python generating arbitrary Cxx, could have a very fixed form similar to the generate_error_codes.py generator.

Proposal: all inputs (if any) are yaml, which generates python objects.
These objects are passed to Cheetah, which fills in a template file that looks a lot like a PHP template that produces Cxx. So there's not much arbitrary execution. The yaml is declarative, and the cheetah is usually very simple. There isn't a big layer of python to understand, and devs can edit these templates easily as Cxx-like files.

Something like idlc might not need to be very big. What it's doing might very well be doable as a yaml file + Cheetah template.

There may be some yaml->yaml transformation stages if the source yaml needs to be massaged or verified, but that's an easier program to analyze than a program that emits Cxx statements in Python code.



 Comments   
Comment by Billy Donahue [ 08/Apr/21 ]

sure

Comment by Githook User [ 14/May/20 ]

Author:

{'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}

Message: SERVER-43187 ActionType enum class (remove generator script)
Branch: master
https://github.com/mongodb/mongo/commit/fc82d79da085d2ef03f84f9d0de08181fe41ec9f

Comment by Githook User [ 14/May/20 ]

Author:

{'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}

Message: SERVER-43187 adapt to how ActionType is stringified now
Branch: master
https://github.com/10gen/mongo-enterprise-modules/commit/48b47f0fd3ce82028902a4f90a11c86852a3289c

Comment by Billy Donahue [ 24/Apr/20 ]

Convert db/auth/generate_action_types.py to YAML+Cheetah3.
CR: https://mongodbcr.appspot.com/563650001

Comment by Andrew Morrow (Inactive) [ 09/Sep/19 ]

I feel like this ticket is a little mis-titled. There is nothing wrong with env.Comamnd itself and there will doubtless be places we continue to use it even if we address the concerns of this ticket. This is more to do with unifying our tools for code generation.

Generated at Thu Feb 08 05:02:30 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.