How It Works#

Run Flow#

Each repo has repo.bat and repo.sh in the root. When user runs one of these (based on their platform), the following happens:

  1. repo.bat (Windows) or repo.sh (Linux) uses packman as bootstrapper to get python and download other tools. It invokes Python to run the bootstrap script. Typically from tools/repoman/repoman.py.

  2. The bootstrap script uses packman API to download project dependencies (usually defined in deps/repo-deps.packman.xml). These dependencies are added to Python’s sys.path.

  3. omni.repo.man.main(path_to_root) is called. repo_man automatically looks for tools in python sys.path. Each path in sys.path is checked for repo_tools.toml file. Each top level entry in that config can declare a tool, if it contains both command and entry_point field.

  4. repo_man loads repo.toml in the root of the repo to determine which settings to override for each tool.

  5. If user passed a tool to run repo [tool_name] repo_man calls in the tool (using function returned by entry_point) providing resolved configuration and command line options.

Example diagrammed flow from invocation to execution#

flowchart TD RepoScript(./repo.sh OR ./repo.bat) --> |./tools/repoman/repoman.py| B B[bootstrap] --> |./tools/packman/packman.cmd| P(packman) P --> |Check deps xmls|./deps/repo-deps.packman.xml --> Req(Requirement List) Req --> |package_name='repo_man' version='1.54.4'| repo_man-1.54.4 --> R Req --> |package_name='repo_format' version='2.11.0'| repo_format-2.11.0 --> F P --> R(pull repo_man-1.54.4) --> D P --> F(pull repo_format-2.11.0) --> D D[Completed Pulling Packman Deps] E[repo_man entrypoint] B --> E D --> E E --> RMC E --> RFC E --> PC subgraph RMC[repo man configs] repo_man_repo_tools_toml[repo_tools.toml] end subgraph RFC[repo format configs] repo_format_repo_tools_toml[repo_tools.toml] end subgraph PC[current project config] project_repo_toml[repo.toml] end RMC --> Merged RFC --> Merged PC --> Merged Merged[Merged Config] --> |Settings| Entry E --> Entry[entrypoints discovery] --> I subgraph I[Import omni.repo.X module] V[Validate repo-tool deps] --> VR subgraph VR[vendored requirements] requirements.txt --> |repo poetry| PD PD[poetry download] end VR --> M M[Importable Module] end Entry --> Args I --> Args Args[repo_man process args] FormatCmd[format --verbose --modified] --> |Incoming shell command arguments| Args RepoScript --> |CLI Args| FormatCmd Execution[repo format execution] Args --> |Hand off options, settings to entrypoint| Execution CF[clang-format] BL[black] Execution --> CF Execution --> BL