Automatic catalog updates and LSP integration

The Software Defined Vehicle (SDV) platform contains numerous VSIDL catalogs across the codebase. The CATALOG_UPDATE file provides a centralized configuration for each catalog, enabling both automated updates and IDE integration.

Role of the CATALOG_UPDATE file

The CATALOG_UPDATE file serves two primary purposes:

  1. Automated updates: The file allows the regenerator tool to find and recompile all catalogs in the system when the compiler or dependencies change.
  2. Language Server Protocol (LSP) Support: The VSIDL Language Server uses this file to discover the catalog root and resolve dependencies. This enables features like "Go to Definition," autocompletion, and real-time validation for types defined in other catalogs.

Configure a catalog

To enable automatic updates and LSP support for a VSIDL catalog, create a CATALOG_UPDATE file in the root directory of the catalog. This file is a text protobuf file.

Catalog configuration fields

  • output_path (string, optional): The relative path from the catalog root to the directory where the generated middleware code should be placed.
  • dependency_catalog_paths (repeated string): A list of relative paths to other catalog directories. The LSP server uses these paths to resolve external types.
  • vsidlc_gen_args (string, optional): Arguments passed to vsidlc. The LSP server inspects these to apply the correct validation rules (for example, "--apex").
  • prebuilts_output_path (string, optional): Path for generated runtime configuration prebuilts.
  • prebuilts_filegroup (string, optional): The Soong filegroup name for prebuilts.

Example configuration

# proto-file: //system/software_defined_vehicle/tools/regenerator/proto/catalog.proto
# proto-message: Catalog

output_path: ".."
dependency_catalog_paths: "../../../../../automotive_services/diagnostics/vsidl/v1"
vsidlc_gen_args: "--apex"

Why automatic updates are needed

Manually maintaining generated code for every catalog is problematic for several reasons:

  1. Compiler updates: When the compiler is updated with bug fixes or new features, all generated code and files that aren't covered by a genrule in an Android.bp file should be refreshed to maintain consistency.
  2. Dependency management: Changes in a base catalog often require downstream catalogs to be regenerated.
  3. Accuracy: Automated updates reduce the risk of human error when specifying paths and dependencies.

Run the regenerator tool

The regenerator tool walks the directory tree starting from the SDV root and looks for files named exactly CATALOG_UPDATE.

To update all configured catalogs:

  1. Build the tool:

    m regenerator
    
  2. Run the tool:

    regenerator
    

    Optionally, run it recursively for a specific directory: console regenerator --root /path/to/directory

The tool updates the generated files and performs a full build (m droid) to verify that the changes are compatible with the rest of the system.