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

Fixed generator history/deprecated documentation #1766

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions generator/templates/description.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@
{%- if description and ( since or history ) %}
*
{%- endif %}
{%- if deprecated %}
* @deprecated
{%- if deprecated is sameas true %}
* @deprecated in SmartDeviceLink {{ since }}
{%- elif history %}
* @added in SmartDeviceLink {{ history }}
{%- elif since is defined %}
{%- if since %}
* @added in SmartDeviceLink {{ since }}
{%- endif %}
{%- if history %}
* @history SDL {{ history }}
{%- endif %}
{%- if since %}
* @since SDL {{ since }}
{%- if deprecated is sameas true and history %}
* @added in SmartDeviceLink {{ history }}
{%- endif %}
*/
{%- endif -%}
Expand Down
15 changes: 9 additions & 6 deletions generator/templates/description_param.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@
{%- if param.description and ( param.since or param.history ) %}
*
{%- endif %}
{%- if param.deprecated %}
* @deprecated
{%- if param.deprecated is sameas true %}
* @deprecated in SmartDeviceLink {{ param.since }}
{%- elif param.history %}
* @added in SmartDeviceLink {{ param.history[0].since }}
{%- elif param.since is defined %}
{%- if param.since %}
* @added in SmartDeviceLink {{ param.since }}
{%- endif %}
{%- if param.history %}
* @history SDL {{ param.history }}
{%- endif %}
{%- if param.since %}
* @since SDL {{ param.since }}
{%- if param.deprecated is sameas true and param.history %}
* @added in SmartDeviceLink {{ param.history[0].since }}
{%- endif %}
*/
{%- endif %}
5 changes: 3 additions & 2 deletions generator/transformers/common_producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __init__(self, enum_names=(), struct_names=(), key_words=()):
self.key_words = key_words
self.param_named = namedtuple('param_named',
'origin constructor_argument constructor_prefix deprecated mandatory since '
'method_suffix of_class type_native type_sdl modifier for_name description '
'method_suffix of_class type_native type_sdl modifier for_name description history '
'constructor_argument_override')
self.constructor_named = namedtuple('constructor', 'init self arguments all')
self.argument_named = namedtuple('argument', 'origin constructor_argument variable deprecated')
Expand Down Expand Up @@ -336,7 +336,8 @@ def extract_param(self, param: Param, item_name: str):
'since': param.since,
'mandatory': param.is_mandatory,
'deprecated': json.loads(param.deprecated.lower()) if param.deprecated else False,
'modifier': 'strong'}
'modifier': 'strong',
'history' : param.history }
if isinstance(param.param_type, (Integer, Float, String, Array)):
data['description'].append(self.create_param_descriptor(param.param_type, OrderedDict()))

Expand Down
4 changes: 3 additions & 1 deletion generator/transformers/enums_producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(self, enum_class, key_words):
self._container_name = 'elements'
self.enum_class = enum_class
self.logger = logging.getLogger(self.__class__.__name__)
self.param_named = namedtuple('param_named', 'origin description name since deprecated')
self.param_named = namedtuple('param_named', 'origin description name since deprecated history')
self._item_name = None

@property
Expand All @@ -45,6 +45,7 @@ def transform(self, item: Enum, render: dict = None) -> dict:
render['origin'] = item.name
render['name'] = name
render['imports'] = imports
render['history'] = item.history
super(EnumsProducer, self).transform(item, render)
return render

Expand All @@ -58,6 +59,7 @@ def extract_param(self, param: EnumElement, item_name: str):
data = {'origin': param.name,
'description': self.extract_description(param.description),
'since': param.since,
'history': param.history,
'deprecated': json.loads(param.deprecated.lower()) if param.deprecated else False}
name = None
if re.match(r'^[A-Z]{1,2}\d|\d[A-Z]{1,2}$', param.name):
Expand Down
1 change: 1 addition & 0 deletions generator/transformers/functions_producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def transform(self, item: Function, render: dict = None) -> dict:
render['name'] = name
render['extends_class'] = extends_class
render['imports'] = imports
render['history'] = item.history

super(FunctionsProducer, self).transform(item, render)

Expand Down
1 change: 1 addition & 0 deletions generator/transformers/structs_producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def transform(self, item: Struct, render: dict = None) -> dict:
render['name'] = name
render['extends_class'] = self.struct_class
render['imports'] = imports
render['history'] = item.history

super(StructsProducer, self).transform(item, render)

Expand Down