diff --git a/system/autoware_version/CMakeLists.txt b/system/autoware_version/CMakeLists.txt new file mode 100644 index 0000000000000..9182a3b8bda20 --- /dev/null +++ b/system/autoware_version/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.5) +project(autoware_version) + +find_package(ament_cmake_auto REQUIRED) +ament_auto_find_build_dependencies() + +install(PROGRAMS + script/print + DESTINATION lib/${PROJECT_NAME} +) + +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + ament_lint_auto_find_test_dependencies() +endif() + +ament_auto_package() diff --git a/system/autoware_version/README.md b/system/autoware_version/README.md new file mode 100644 index 0000000000000..82e6760f64c14 --- /dev/null +++ b/system/autoware_version/README.md @@ -0,0 +1,9 @@ +# autoware_version + +This package provides a command line tool to know the architecture version. This feature is temporary and will be removed when the interface is unified in the future. + +## How to use + +```sh +ros2 run autoware_version print arch {full,type,version} +``` diff --git a/system/autoware_version/package.xml b/system/autoware_version/package.xml new file mode 100644 index 0000000000000..f0ed975d24f56 --- /dev/null +++ b/system/autoware_version/package.xml @@ -0,0 +1,20 @@ + + + + + autoware_version + 0.0.0 + The autoware_version package + Takagi, Isamu + Apache License 2.0 + + ament_cmake_auto + + ament_lint_auto + autoware_lint_common + + + ament_cmake + + + diff --git a/system/autoware_version/script/print b/system/autoware_version/script/print new file mode 100755 index 0000000000000..7b796ab791b9b --- /dev/null +++ b/system/autoware_version/script/print @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 +# TODO(Takagi, Isamu): this is a temporary script and may change in the future +import argparse + +parser = argparse.ArgumentParser() +parser.add_argument("target", choices=["arch"]) +parser.add_argument("format", choices=["full", "type", "version"], default="full", nargs="?") +args = parser.parse_args() +data = {"arch": {"type": "universe", "version": "1.0.0"}} + +if args.format == "full": + print("{type} {version}".format(**data[args.target])) +else: + print(data[args.target][args.format])