8.1.14. Google repo tool setup

8.1.14.1. Background

Your project is using Google’s repo tool to manage Git repositories.

8.1.14.2. What can be configured?

You can setup

  • your project configuration to dynamically create the Git repository configuration for the analysis using the manifest.xml file.

8.1.14.3. What needs to be done?

Instead of manually configuring any VCSIntegration like you normally would, you can include the following Python configuration layer into your project configuration to dynamically create the Git repository instances from the manifest.xml file.

Python configuration layer to dynamically create Git VCS instances.
# Copyright (C) 2025 Axivion GmbH
# Copyright (C) 2025 The Qt Company GmbH, a subsidiary of The Qt Group
# https://www.qt.io
# pyright: basic


import os
import xml.dom.minidom

import xpath

import axivion.config

MANIFEST_XML = os.environ.get('MANIFEST_XML', 'manifest.xml')

project = axivion.config.get_project()


def create_git_instance(name: str, path: str | None = None):
    instance_name = f'Git_{name}'
    project.copy('Git', instance_name)
    if path:
        project[instance_name].rootpath = path
    project.activate(instance_name)


create_git_instance('toplevel')

for repo in xpath.find('/manifest/project', xml.dom.minidom.parse(MANIFEST_XML)):
    if repo.getAttribute('name') and repo.getAttribute('path'):
        create_git_instance(repo.getAttribute('name'), repo.getAttribute('path'))