Skip to content

Commit

Permalink
Merge conflict resolution.
Browse files Browse the repository at this point in the history
Signed-off-by: Ulf Bjorkengren <[email protected]>
  • Loading branch information
UlfBj committed Oct 24, 2024
2 parents 4a8c9a3 + 4c64632 commit caf4823
Show file tree
Hide file tree
Showing 25 changed files with 633 additions and 152 deletions.
6 changes: 0 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ var/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ It includes changes that are included in released version, but also changes plan
*This document only contain changes introduced in VSS-Tools 3.0 or later!*


## Planned changes for VSS-Tools 6.0
## Implemented changes for VSS-Tools 6.0

### Change in UUID handling.

Expand All @@ -16,6 +16,8 @@ the legacy uuid functionality.

* The parameters `--uuid`/`--no-uuid` are now removed.

Columns (or similar) for UUID in generated output has also been removed.
An exception is binary output which still contain a byte for UUID, however always 0.

## VSS-Tools 5.0

Expand Down
4 changes: 2 additions & 2 deletions docs/ddsidl.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ Below elements are considered only if the switch `--all-idl-features` is supplie
### Input VSS block with "arraysize" attribute
| VSS | DDS-IDL |
|--------|----------------|
| <pre>Safety.SpeedLimit:<br> datatype : float[]<br> arraysize: 5<br> type: actuator<br> unit: m/s<br> description: Maximum allowed speed of the vehicle</pre> | <pre>struct SpeedLimit{<br>string uuid;<br>sequence&lt;float&gt; value;<br>}<br></pre> |
| <pre>Safety.SpeedLimit:<br> datatype : float[]<br> arraysize: 5<br> type: actuator<br> unit: m/s<br> description: Maximum allowed speed of the vehicle</pre> | <pre>struct SpeedLimit{<br>sequence&lt;float&gt; value;<br>}<br></pre> |
### Input VSS block with "allowed" attribute

| VSS | DDS-IDL |
|--------|----------------|
| <pre>Direction:<br> datatype:string<br> type: actuator<br> allowed: ['FORWARD','BACKWARD']<br> description: Driving direction of the vehicle</pre> | <pre>module Direction_M {<br>enum DirectionValues{FORWARD,BACKWARD};<br>};<br>struct Direction<br>{<br>string uuid;<br>DirectionValues value;<br>};</pre>
| <pre>Direction:<br> datatype:string<br> type: actuator<br> allowed: ['FORWARD','BACKWARD']<br> description: Driving direction of the vehicle</pre> | <pre>module Direction_M {<br>enum DirectionValues{FORWARD,BACKWARD};<br>};<br>struct Direction<br>{<br>DirectionValues value;<br>};</pre>

To comply with DDS-IDL rules and limitations in IDL compilers VSS string literals that start with a digit will get a `d` as prefix.

Expand Down
1 change: 0 additions & 1 deletion docs/id.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ identifiers.
│ [default: no-strict] │
│ --aborts -a [unknown-attribute|name-style] Abort on selected option. The '--strict'
│ option enables all of them. │
│ --uuid/--no-uuid Whether to add UUIDs. [default: no-uuid] │
│ --expand/--no-expand Whether to expand the tree. │
│ [default: expand] │
│ --overlays -l FILE Overlay files to apply on top of the vspec. │
Expand Down
17 changes: 0 additions & 17 deletions docs/vspec.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,6 @@ Terminates parsing, when the name of a signal does not follow [VSS Naming Conven
### --strict/--no-strict
Enables `--aborts unknown-attribute` and `--aborts name-style`

### --uuid/--no-uuid
Request the exporter to output UUIDs. The UUID generated is an RFC 4122 Version 5 UUID created from the qualified name
of the node and the UUID of the namespace `vehicle_signal_specification`.

Note that not all exporters support that arugment

> [!WARNING]
> The UUID feature is deprecated and will be removed in VSS-tools 6.0.
> If you need identifiers consider using [vspec id exporter](id.md)
### --expand/--no-expand

By default all tools expand instance information so that instance information like "Row1" become a branch just like
Expand Down Expand Up @@ -359,7 +349,6 @@ Lets the exporter generate _all_ extended metadata attributes found in the model
| deprecation | x-deprecation |
| aggregate | x-aggregate |
| comment | x-comment |
| uuid | x-uuid |

Not that strict JSON schema validators might not accept jsonschemas with such extra, non-standard entries.

Expand All @@ -382,12 +371,6 @@ If the paramter is set it will pretty-print the JSON output, otherwise you will
### --extended-all-attributes
Lets the exporter generate _all_ extended metadata attributes found in the model. By default the exporter is generating only those given by the `-e`/`--extended-attributes` parameter.

## DDS-IDL exporter notes
The DDS-IDL exporter never generates uuid, i.e. the `--uuid` option has no effect.

## Graphql exporter notes
The Graphql exporter never generates uuid, i.e. the `--uuid` option has no effect.

### --all-idl-features
Will also generate non-payload const attributes such as unit/datatype. Default is not to generate them/comment them out because at least Cyclone DDS and FastDDS do not support const. For more information check the [DDS-IDL exporter docs](ddsidl.md).

Expand Down
2 changes: 0 additions & 2 deletions src/vss_tools/cli_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ def validate_attribute(value):
show_choices=True,
)

uuid_opt = option("--uuid/--no-uuid", help="Whether to add UUIDs.", show_default=True, default=False)

expand_opt = option(
"--expand/--no-expand",
default=True,
Expand Down
3 changes: 0 additions & 3 deletions src/vss_tools/exporters/apigear.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,6 @@ def export_apigear(
@clo.extended_attributes_opt
@clo.strict_opt
@clo.aborts_opt
@clo.uuid_opt
@clo.overlays_opt
@clo.quantities_opt
@clo.units_opt
Expand Down Expand Up @@ -482,7 +481,6 @@ def cli(
extended_attributes: tuple[str],
strict: bool,
aborts: tuple[str],
uuid: bool,
overlays: tuple[Path],
quantities: tuple[Path],
units: tuple[Path],
Expand All @@ -502,7 +500,6 @@ def cli(
aborts=aborts,
strict=strict,
extended_attributes=extended_attributes,
uuid=uuid,
quantities=quantities,
units=units,
types=types,
Expand Down
21 changes: 7 additions & 14 deletions src/vss_tools/exporters/csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from vss_tools.utils.misc import getattr_nn


def get_header(with_uuid: bool, entry_type: str, with_instance_column: bool) -> list[str]:
def get_header(entry_type: str, with_instance_column: bool) -> list[str]:
row = [
entry_type,
"Type",
Expand All @@ -36,14 +36,12 @@ def get_header(with_uuid: bool, entry_type: str, with_instance_column: bool) ->
"Allowed",
"Default",
]
if with_uuid:
row.append("Id")
if with_instance_column:
row.append("Instances")
return row


def add_rows(rows: list[list[Any]], root: VSSNode, with_uuid: bool, with_instance_column: bool) -> None:
def add_rows(rows: list[list[Any]], root: VSSNode, with_instance_column: bool) -> None:
node: VSSNode
for node in PreOrderIter(root):
data = node.get_vss_data()
Expand All @@ -60,8 +58,6 @@ def add_rows(rows: list[list[Any]], root: VSSNode, with_uuid: bool, with_instanc
getattr_nn(data, "allowed", ""),
getattr_nn(data, "default", ""),
]
if with_uuid:
row.append(getattr_nn(node, "uuid", ""))
if with_instance_column:
row.append(getattr_nn(data, "instances", ""))
rows.append(row)
Expand All @@ -80,7 +76,6 @@ def write_csv(rows: list[list[Any]], output: Path):
@clo.extended_attributes_opt
@clo.strict_opt
@clo.aborts_opt
@clo.uuid_opt
@clo.expand_opt
@clo.overlays_opt
@clo.quantities_opt
Expand All @@ -94,7 +89,6 @@ def cli(
extended_attributes: tuple[str],
strict: bool,
aborts: tuple[str],
uuid: bool,
expand: bool,
overlays: tuple[Path],
quantities: tuple[Path],
Expand All @@ -111,7 +105,6 @@ def cli(
aborts=aborts,
strict=strict,
extended_attributes=extended_attributes,
uuid=uuid,
quantities=quantities,
units=units,
types=types,
Expand All @@ -124,13 +117,13 @@ def cli(
with_instance_column = not expand

entry_type = "Node" if generic_entry else "Signal"
rows = [get_header(uuid, entry_type, with_instance_column)]
add_rows(rows, tree, uuid, with_instance_column)
rows = [get_header(entry_type, with_instance_column)]
add_rows(rows, tree, with_instance_column)
if generic_entry and datatype_tree:
add_rows(rows, datatype_tree, uuid, with_instance_column)
add_rows(rows, datatype_tree, with_instance_column)
write_csv(rows, output)

if not generic_entry and datatype_tree:
rows = [get_header(uuid, "Node", with_instance_column)]
add_rows(rows, datatype_tree, uuid, with_instance_column)
rows = [get_header("Node", with_instance_column)]
add_rows(rows, datatype_tree, with_instance_column)
write_csv(rows, types_output)
14 changes: 4 additions & 10 deletions src/vss_tools/exporters/ddsidl.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def get_allowed_enum_literal(name: str):
}


def export_node(node: VSSNode, generate_uuid: bool, generate_all_idl_features: bool) -> None:
def export_node(node: VSSNode, generate_all_idl_features: bool) -> None:
"""
This method is used to traverse VSS node and to create corresponding DDS IDL buffer string
"""
Expand All @@ -199,7 +199,7 @@ def export_node(node: VSSNode, generate_uuid: bool, generate_all_idl_features: b
idl_file_buffer.append("module " + getAllowedName(node.name))
idl_file_buffer.append("{")
for child in node.children:
export_node(child, generate_uuid, generate_all_idl_features)
export_node(child, generate_all_idl_features)
idl_file_buffer.append("};")
idl_file_buffer.append("")
else:
Expand Down Expand Up @@ -233,8 +233,6 @@ def export_node(node: VSSNode, generate_uuid: bool, generate_all_idl_features: b

idl_file_buffer.append("struct " + getAllowedName(node.name))
idl_file_buffer.append("{")
if generate_uuid:
idl_file_buffer.append("string uuid;")
# fetching value of datatype and obtaining the equivalent DDS type
try:
if datatype:
Expand Down Expand Up @@ -372,11 +370,11 @@ def export_data_type_node(self, node: VSSNode):
self.str_buf += suffix


def export_idl(file, root, generate_uuids=True, generate_all_idl_features=False):
def export_idl(file, root, generate_all_idl_features=False):
"""This method is used to traverse through the root VSS node to build
-> DDS IDL equivalent string buffer and to serialize it acccordingly into a file
"""
export_node(root, generate_uuids, generate_all_idl_features)
export_node(root, generate_all_idl_features)
file.write("\n".join(idl_file_buffer))
log.info("IDL file generated at location : " + file.name)

Expand All @@ -388,7 +386,6 @@ def export_idl(file, root, generate_uuids=True, generate_all_idl_features=False)
@clo.extended_attributes_opt
@clo.strict_opt
@clo.aborts_opt
@clo.uuid_opt
@clo.overlays_opt
@clo.quantities_opt
@clo.units_opt
Expand All @@ -405,7 +402,6 @@ def cli(
extended_attributes: tuple[str],
strict: bool,
aborts: tuple[str],
uuid: bool,
overlays: tuple[Path],
quantities: tuple[Path],
units: tuple[Path],
Expand All @@ -421,7 +417,6 @@ def cli(
aborts=aborts,
strict=strict,
extended_attributes=extended_attributes,
uuid=uuid,
quantities=quantities,
units=units,
types=types,
Expand All @@ -438,6 +433,5 @@ def cli(
export_idl(
idl_out,
tree,
uuid,
all_idl_features,
)
9 changes: 2 additions & 7 deletions src/vss_tools/exporters/franca.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def print_franca_header(file, version="unknown"):


# Write the data lines
def print_franca_content(file: TextIOWrapper, root: VSSNode, with_uuid: bool) -> None:
def print_franca_content(file: TextIOWrapper, root: VSSNode) -> None:
output = ""
node: VSSNode
for node in PreOrderIter(root):
Expand All @@ -64,8 +64,6 @@ def print_franca_content(file: TextIOWrapper, root: VSSNode, with_uuid: bool) ->
datatype = getattr(data, "datatype", None)
if datatype:
output += f',\n\tdatatype: "{datatype}"'
if with_uuid:
output += f',\n\tuuid: "{node.uuid}"'
unit = getattr(data, "unit", None)
if unit:
output += f',\n\tunit: "{unit}"'
Expand All @@ -89,7 +87,6 @@ def print_franca_content(file: TextIOWrapper, root: VSSNode, with_uuid: bool) ->
@clo.extended_attributes_opt
@clo.strict_opt
@clo.aborts_opt
@clo.uuid_opt
@clo.overlays_opt
@clo.quantities_opt
@clo.units_opt
Expand All @@ -101,7 +98,6 @@ def cli(
extended_attributes: tuple[str],
strict: bool,
aborts: tuple[str],
uuid: bool,
overlays: tuple[Path],
quantities: tuple[Path],
units: tuple[Path],
Expand All @@ -117,12 +113,11 @@ def cli(
aborts=aborts,
strict=strict,
extended_attributes=extended_attributes,
uuid=uuid,
quantities=quantities,
units=units,
overlays=overlays,
)
with open(output, "w") as f:
print_franca_header(f, franca_vss_version)
print_franca_content(f, tree, uuid)
print_franca_content(f, tree)
f.write("\n]")
4 changes: 0 additions & 4 deletions src/vss_tools/exporters/id.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ def export_node(data: dict[str, Any], node: VSSNode, id_counter, strict_mode: bo
@clo.extended_attributes_opt
@clo.strict_opt
@clo.aborts_opt
@clo.uuid_opt
@clo.expand_opt
@clo.overlays_opt
@clo.quantities_opt
Expand All @@ -164,7 +163,6 @@ def cli(
extended_attributes: tuple[str],
strict: bool,
aborts: tuple[str],
uuid: bool,
expand: bool,
overlays: tuple[Path],
quantities: tuple[Path],
Expand All @@ -183,7 +181,6 @@ def cli(
aborts=aborts,
strict=strict,
extended_attributes=extended_attributes,
uuid=uuid,
quantities=quantities,
units=units,
types=types,
Expand All @@ -207,7 +204,6 @@ def cli(
aborts=aborts,
strict=strict,
extended_attributes=extended_attributes,
uuid=uuid,
quantities=quantities,
units=units,
types=types,
Expand Down
5 changes: 0 additions & 5 deletions src/vss_tools/exporters/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@

def get_data(node: VSSNode, with_extra_attributes: bool = True, extended_attributes: tuple[str, ...] = ()):
data = node.data.as_dict(with_extra_attributes, extended_attributes=extended_attributes)
if node.uuid:
data["uuid"] = node.uuid
if len(node.children) > 0:
data["children"] = {}
for child in node.children:
Expand All @@ -38,7 +36,6 @@ def get_data(node: VSSNode, with_extra_attributes: bool = True, extended_attribu
@clo.extended_attributes_opt
@clo.strict_opt
@clo.aborts_opt
@clo.uuid_opt
@clo.expand_opt
@clo.overlays_opt
@clo.quantities_opt
Expand All @@ -54,7 +51,6 @@ def cli(
extended_attributes: tuple[str],
strict: bool,
aborts: tuple[str],
uuid: bool,
expand: bool,
overlays: tuple[Path],
quantities: tuple[Path],
Expand All @@ -73,7 +69,6 @@ def cli(
aborts=aborts,
strict=strict,
extended_attributes=extended_attributes,
uuid=uuid,
quantities=quantities,
units=units,
types=types,
Expand Down
Loading

0 comments on commit caf4823

Please sign in to comment.