Skip to content
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
38 changes: 17 additions & 21 deletions autoware_system_designer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,28 @@ install(
USE_SOURCE_PERMISSIONS
)

# Collect system descriptions
# Scans the workspace source directory
# and generates resource manifests in the build directory.
add_custom_target(collect_system_design_manifests ALL
COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/resource
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/resource
COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/script/collect_system_design_manifests.py
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_BINARY_DIR}/resource
${CMAKE_INSTALL_PREFIX}
COMMENT "Collecting autoware system descriptions"
)
# Collect system descriptions at install time.
# ${CMAKE_CURRENT_SOURCE_DIR} and ${Python3_EXECUTABLE} are expanded at configure time;
install(CODE "
set(_dest_prefix \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}\")
execute_process(
COMMAND \"${CMAKE_COMMAND}\" -E remove_directory
\"\${_dest_prefix}/share/${PROJECT_NAME}/resource\"
)
execute_process(
COMMAND \"${Python3_EXECUTABLE}\"
\"${CMAKE_CURRENT_SOURCE_DIR}/script/collect_system_design_manifests.py\"
\"${CMAKE_CURRENT_SOURCE_DIR}\"
\"\${_dest_prefix}/share/${PROJECT_NAME}/resource\"
\"\${CMAKE_INSTALL_PREFIX}\"
COMMAND_ERROR_IS_FATAL ANY
)
Comment on lines +34 to +35
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

execute_process(COMMAND_ERROR_IS_FATAL ANY) requires a newer CMake than the current cmake_minimum_required(VERSION 3.14). With CMake 3.14 this will error at configure/install time. Either bump the minimum required CMake version to one that supports COMMAND_ERROR_IS_FATAL or replace it with explicit RESULT_VARIABLE checking and a message(FATAL_ERROR ...) on non-zero exit.

Suggested change
COMMAND_ERROR_IS_FATAL ANY
)
RESULT_VARIABLE _collect_system_design_manifests_result
)
if(NOT _collect_system_design_manifests_result EQUAL 0)
message(FATAL_ERROR
\"collect_system_design_manifests.py failed with exit code \${_collect_system_design_manifests_result}\"
)
endif()

Copilot uses AI. Check for mistakes.
")

Comment on lines +20 to 37
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

The install-time manifest generation writes YAML manifests into the installed share/${PROJECT_NAME}/resource, but collect_system_design_manifests.py records absolute source file paths for deploy_config_files (see script: it stores yf_abs). If this package is consumed pre-installed (deb/apt), those paths will point at the packaging/build machine’s source tree and won’t exist for users, breaking deployment generation. Consider generating manifests at consumer build time (so paths match the consumer workspace), or change the manifest format to store install-space paths/relative paths and resolve via package_map.

Suggested change
# Collect system descriptions at install time.
# ${CMAKE_CURRENT_SOURCE_DIR} and ${Python3_EXECUTABLE} are expanded at configure time;
install(CODE "
set(_dest_prefix \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}\")
execute_process(
COMMAND \"${CMAKE_COMMAND}\" -E remove_directory
\"\${_dest_prefix}/share/${PROJECT_NAME}/resource\"
)
execute_process(
COMMAND \"${Python3_EXECUTABLE}\"
\"${CMAKE_CURRENT_SOURCE_DIR}/script/collect_system_design_manifests.py\"
\"${CMAKE_CURRENT_SOURCE_DIR}\"
\"\${_dest_prefix}/share/${PROJECT_NAME}/resource\"
\"\${CMAKE_INSTALL_PREFIX}\"
COMMAND_ERROR_IS_FATAL ANY
)
")
# Collect system descriptions at build time so the generated manifests match
# the workspace that is building this package, then install the generated files.
set(_generated_resource_dir "${CMAKE_CURRENT_BINARY_DIR}/resource")
add_custom_target(generate_system_design_manifests ALL
COMMAND "${CMAKE_COMMAND}" -E remove_directory
"${_generated_resource_dir}"
COMMAND "${Python3_EXECUTABLE}"
"${CMAKE_CURRENT_SOURCE_DIR}/script/collect_system_design_manifests.py"
"${CMAKE_CURRENT_SOURCE_DIR}"
"${_generated_resource_dir}"
"${CMAKE_INSTALL_PREFIX}"
BYPRODUCTS "${_generated_resource_dir}"
COMMENT "Generating system design manifests"
VERBATIM
)
install(
DIRECTORY "${_generated_resource_dir}/"
DESTINATION share/${PROJECT_NAME}/resource
)

Copilot uses AI. Check for mistakes.
ament_package(
CONFIG_EXTRAS "autoware_system_designer-extras.cmake"
)

# Copy the script to the build directory
# Reconfigure when scripts change so build/*/script stays up-to-date.
file(GLOB_RECURSE SCRIPT_FILES CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/script/*.py)

foreach(SCRIPT_FILE ${SCRIPT_FILES})
get_filename_component(SCRIPT_FILE_NAME ${SCRIPT_FILE} NAME)
configure_file(${SCRIPT_FILE} ${CMAKE_BINARY_DIR}/script/${SCRIPT_FILE_NAME} COPYONLY)
endforeach()

install(
DIRECTORY cmake
DESTINATION share/${PROJECT_NAME}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ parameters:
{% for node in parameters %}
- node: {{ node.node }}
{% if node.parameter_files %}
parame_files:
param_files:
{% for param_name, param_path in node.parameter_files.items() %}
- {{ param_name }}: {{ param_path }}
{% endfor %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,39 @@ macro(autoware_system_designer_build_deploy project_name)
endforeach()
endif()

set(BUILD_PY_SCRIPT "${CMAKE_BINARY_DIR}/../autoware_system_designer/script/deployment_process.py")
set(SYSTEM_DESIGNER_RUNNER_SCRIPT "${CMAKE_BINARY_DIR}/../autoware_system_designer/script/system_designer_runner.py")
set(SYSTEM_DESIGNER_SOURCE_DIR "${CMAKE_SOURCE_DIR}/../autoware_system_designer")
set(SYSTEM_DESIGNER_RESOURCE_DIR "${CMAKE_BINARY_DIR}/../autoware_system_designer/resource")
# Always call find_package so Python3_VERSION_MAJOR/MINOR are guaranteed set,
# even when the caller already found Python3 before invoking this macro.
find_package(Python3 REQUIRED COMPONENTS Interpreter)

# autoware_system_designer_DIR = <prefix>/share/autoware_system_designer/cmake
get_filename_component(_AWSD_SCRIPT_DIR "${autoware_system_designer_DIR}/../script" ABSOLUTE)
set(BUILD_PY_SCRIPT "${_AWSD_SCRIPT_DIR}/deployment_process.py")
set(SYSTEM_DESIGNER_RUNNER_SCRIPT "${_AWSD_SCRIPT_DIR}/system_designer_runner.py")

# Derive the installed Python package dir from the interpreter version.
# Glob + lexicographic sort mis-orders versions (e.g. python3.10 sorts before python3.9),
# so we use Python3_VERSION_MAJOR/MINOR to construct the exact path instead.
get_filename_component(_AWSD_INSTALL_PREFIX "${autoware_system_designer_DIR}/../../.." ABSOLUTE)
set(_AWSD_PYVER "${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}")
set(_AWSD_PYTHON_PATH "")
foreach(_AWSD_SUBDIR
"local/lib/python${_AWSD_PYVER}/dist-packages"
"local/lib/python${_AWSD_PYVER}/site-packages"
"lib/python${_AWSD_PYVER}/dist-packages"
"lib/python${_AWSD_PYVER}/site-packages"
)
if(EXISTS "${_AWSD_INSTALL_PREFIX}/${_AWSD_SUBDIR}")
set(_AWSD_PYTHON_PATH "${_AWSD_INSTALL_PREFIX}/${_AWSD_SUBDIR}")
break()
endif()
endforeach()
set(_AWSD_PYTHONPATH_ARGS "")
if(_AWSD_PYTHON_PATH)
set(_AWSD_PYTHONPATH_ARGS "PYTHONPATH=${_AWSD_PYTHON_PATH}")
endif()

get_filename_component(SYSTEM_DESIGNER_RESOURCE_DIR "${autoware_system_designer_DIR}/../resource" ABSOLUTE)

set(OUTPUT_ROOT_DIR "${CMAKE_INSTALL_PREFIX}/share/${CMAKE_PROJECT_NAME}/")
get_filename_component(WORKSPACE_ROOT "${CMAKE_BINARY_DIR}/../.." ABSOLUTE)
set(LOG_DIR "${WORKSPACE_ROOT}/log/latest_build/${CMAKE_PROJECT_NAME}")
Expand Down Expand Up @@ -95,9 +124,9 @@ macro(autoware_system_designer_build_deploy project_name)
add_custom_target(run_build_py_${_INPUT_NAME} ALL
COMMAND ${CMAKE_COMMAND} -E make_directory ${LOG_DIR}
COMMAND ${CMAKE_COMMAND} -E env
PYTHONPATH=${SYSTEM_DESIGNER_SOURCE_DIR}:$ENV{PYTHONPATH}
${_AWSD_PYTHONPATH_ARGS}
AUTOWARE_SYSTEM_DESIGNER_BUILD_DEPLOY_STRICT=${AUTOWARE_SYSTEM_DESIGNER_BUILD_DEPLOY_STRICT}
python3 ${SYSTEM_DESIGNER_RUNNER_SCRIPT}
${Python3_EXECUTABLE} ${SYSTEM_DESIGNER_RUNNER_SCRIPT}
Comment on lines 126 to +129
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

The macro currently sets PYTHONPATH to the autoware_system_designer install site-packages directory, but it no longer appends the existing $ENV{PYTHONPATH}. This can break environments that rely on additional PYTHONPATH entries (e.g., overlays/venvs). Consider setting PYTHONPATH=${_AWSD_PYTHON_PATH}:$ENV{PYTHONPATH} (when _AWSD_PYTHON_PATH is found) so the existing environment is preserved.

Copilot uses AI. Check for mistakes.
deploy
--log-file ${LOG_FILE}
--print-level ${_PRINT_LEVEL}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@ macro(autoware_system_designer_generate_launcher)
set(DESIGN_DIR "${CMAKE_CURRENT_SOURCE_DIR}/design")

if(EXISTS ${DESIGN_DIR})
# Set up paths - use absolute path to the script
set(GENERATE_LAUNCHER_PY_SCRIPT "${CMAKE_BINARY_DIR}/../autoware_system_designer/script/generate_node_launcher.py")
set(SYSTEM_DESIGNER_RUNNER_SCRIPT "${CMAKE_BINARY_DIR}/../autoware_system_designer/script/system_designer_runner.py")
if(NOT Python3_EXECUTABLE)
find_package(Python3 REQUIRED COMPONENTS Interpreter)
endif()

# Set up paths - use installed script paths from the found package
get_filename_component(_AWSD_SCRIPT_DIR "${autoware_system_designer_DIR}/../script" ABSOLUTE)
set(GENERATE_LAUNCHER_PY_SCRIPT "${_AWSD_SCRIPT_DIR}/generate_node_launcher.py")
set(SYSTEM_DESIGNER_RUNNER_SCRIPT "${_AWSD_SCRIPT_DIR}/system_designer_runner.py")
set(LAUNCHER_FILE_DIR "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/launcher/")

# Set up logging
Expand Down Expand Up @@ -47,7 +52,7 @@ macro(autoware_system_designer_generate_launcher)
OUTPUT ${LAUNCHER_FILE}
COMMAND ${CMAKE_COMMAND} -E make_directory ${LAUNCHER_FILE_DIR}
COMMAND ${CMAKE_COMMAND} -E make_directory ${LOG_DIR}
COMMAND python3 ${SYSTEM_DESIGNER_RUNNER_SCRIPT} run --log-file ${LOG_FILE} --append -- python3 ${GENERATE_LAUNCHER_PY_SCRIPT} ${NODE_YAML_FILE} ${LAUNCHER_FILE_DIR}
COMMAND ${Python3_EXECUTABLE} ${SYSTEM_DESIGNER_RUNNER_SCRIPT} run --log-file ${LOG_FILE} --append -- ${Python3_EXECUTABLE} ${GENERATE_LAUNCHER_PY_SCRIPT} ${NODE_YAML_FILE} ${LAUNCHER_FILE_DIR}
DEPENDS ${NODE_YAML_FILE} ${GENERATE_LAUNCHER_PY_SCRIPT} ${SYSTEM_DESIGNER_RUNNER_SCRIPT}
COMMENT "Generating launcher file ${NODE_NAME}.launch.xml. Terminal shows warnings/errors; full log: ${LOG_FILE}"
VERBATIM
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@ macro(autoware_system_designer_parameter)
set(SCHEMA_DIR "${CMAKE_CURRENT_SOURCE_DIR}/schema")

if(EXISTS ${SCHEMA_DIR})
# Set up paths - use absolute path to the script
set(PARAMETER_PROCESS_SCRIPT "${CMAKE_BINARY_DIR}/../autoware_system_designer/script/parameter_process.py")
set(SYSTEM_DESIGNER_RUNNER_SCRIPT "${CMAKE_BINARY_DIR}/../autoware_system_designer/script/system_designer_runner.py")
if(NOT Python3_EXECUTABLE)
find_package(Python3 REQUIRED COMPONENTS Interpreter)
endif()

# Set up paths - use installed script paths from the found package
get_filename_component(_AWSD_SCRIPT_DIR "${autoware_system_designer_DIR}/../script" ABSOLUTE)
set(PARAMETER_PROCESS_SCRIPT "${_AWSD_SCRIPT_DIR}/parameter_process.py")
set(SYSTEM_DESIGNER_RUNNER_SCRIPT "${_AWSD_SCRIPT_DIR}/system_designer_runner.py")
set(CONFIG_OUTPUT_DIR "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/config")

# Set up logging
Expand All @@ -45,7 +50,7 @@ macro(autoware_system_designer_parameter)
OUTPUT ${CONFIG_FILES}
COMMAND ${CMAKE_COMMAND} -E make_directory ${CONFIG_OUTPUT_DIR}
COMMAND ${CMAKE_COMMAND} -E make_directory ${LOG_DIR}
COMMAND python3 ${SYSTEM_DESIGNER_RUNNER_SCRIPT} run --log-file ${LOG_FILE} -- python3 ${PARAMETER_PROCESS_SCRIPT} ${SCHEMA_DIR} ${CONFIG_OUTPUT_DIR} --package-name ${PROJECT_NAME}
COMMAND ${Python3_EXECUTABLE} ${SYSTEM_DESIGNER_RUNNER_SCRIPT} run --log-file ${LOG_FILE} -- ${Python3_EXECUTABLE} ${PARAMETER_PROCESS_SCRIPT} ${SCHEMA_DIR} ${CONFIG_OUTPUT_DIR} --package-name ${PROJECT_NAME}
DEPENDS ${SCHEMA_FILES} ${PARAMETER_PROCESS_SCRIPT} ${SYSTEM_DESIGNER_RUNNER_SCRIPT}
COMMENT "Generating parameter files for ${PROJECT_NAME} from schema files. Terminal shows warnings/errors; full log: ${LOG_FILE}"
VERBATIM
Expand Down
4 changes: 3 additions & 1 deletion tools/vscode-autoware-system-designer/server/base_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ def __init__(self):
self.completion_provider = CompletionProvider(self.registry_manager, self.validation_engine.resolution_service)
self.definition_provider = DefinitionProvider(self.registry_manager)
self.hover_provider = HoverProvider(self.registry_manager, self.validation_engine.resolution_service)
self.signature_help_provider = SignatureHelpProvider(self.registry_manager, self.validation_engine.resolution_service)
self.signature_help_provider = SignatureHelpProvider(
self.registry_manager, self.validation_engine.resolution_service
)

# Register handlers
self._register_handlers()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ def get_definition(self, params: lsp.DefinitionParams, server) -> Optional[lsp.L
config = self.registry_manager.entity_registry[word]
# Use source_map to find the exact line of the 'name' field
line_num = 0
if hasattr(config, 'source_map') and config.source_map and 'name' in config.source_map:
if hasattr(config, "source_map") and config.source_map and "name" in config.source_map:
# source_map['name'] is (line, column) tuple; YAML lines are 0-indexed
line_num = config.source_map['name'][0]
line_num = config.source_map["name"][0]
return lsp.Location(
uri=path_to_uri(str(config.file_path)),
range=lsp.Range(
Expand Down Expand Up @@ -75,8 +75,12 @@ def _find_definition_in_connection(self, word: str, config: Config) -> Optional[
entity_config = self.registry_manager.entity_registry[entity_name]
# Use source_map for precise line of 'name' field
line_num = 0
if hasattr(entity_config, 'source_map') and entity_config.source_map and 'name' in entity_config.source_map:
line_num = entity_config.source_map['name'][0]
if (
hasattr(entity_config, "source_map")
and entity_config.source_map
and "name" in entity_config.source_map
):
line_num = entity_config.source_map["name"][0]
return lsp.Location(
uri=path_to_uri(str(entity_config.file_path)),
range=lsp.Range(
Expand All @@ -99,8 +103,12 @@ def _find_definition_in_connection(self, word: str, config: Config) -> Optional[
entity_config = self.registry_manager.entity_registry[component_entity]
# Use source_map for precise line of 'name' field
line_num = 0
if hasattr(entity_config, 'source_map') and entity_config.source_map and 'name' in entity_config.source_map:
line_num = entity_config.source_map['name'][0]
if (
hasattr(entity_config, "source_map")
and entity_config.source_map
and "name" in entity_config.source_map
):
line_num = entity_config.source_map["name"][0]
return lsp.Location(
uri=path_to_uri(str(entity_config.file_path)),
range=lsp.Range(
Expand Down
Loading