omni.repo.build.main#

omni.repo.build.main.build(
repo_folders,
platform_host,
platform_target,
configs: List[str],
settings: Settings,
verbose: bool = False,
jobs: int | str = -1,
extra_args: List = [],
build_target=None,
keep_going: bool = False,
)

Cross platform build command wrapper.

omni.repo.build.main.clean(repo_folders: Dict)
omni.repo.build.main.compute_job_count(
desired_job_count: int | str = -1,
mem_per_core: int | None = None,
)

repo_build supports passing in a job_count value that is either a hard host core count or a percentage of host cores.

If a percentage is provided then we pull the host’s core count and return the calculated value. If a concrete core count is provided we do a little sanity check to avoid over-provisioning compilation jobs by exceeding a 1:1 desired_job_count:actual_job_count ratio.

Parameters:
  • desired_job_count – An int or string. An int is a concrete core count/job count. A string should include a % symbol.

  • mem_per_core_gb (int, optional) – An int indicating the memory limit per core to limit core usage in memory constrained environments

Returns:

An int representing the number of discrete parallel jobs we will execute. A boolean indicating if the desired_job_count was a percentage; this drives whether or not msbuild will use multitooltasking.

omni.repo.build.main.convert_str_jobs_to_int_jobs(
desired_job_count: str | None = None,
available_core_count: int | None = None,
)

Converts a string representation of desired job count into an integer based on the available CPU cores.

This function interprets the desired job count when specified as a percentage of the available CPU cores. It handles three main scenarios: 1. A single percentage value (e.g., “50%”): Calculates the number of cores corresponding to the percentage. 2. Multiple percentage symbols: Indicates a formatting error or misconfiguration. 3. Any other format: Logs an unsupported value message.

Parameters:
  • desired_job_count (str, optional) – The desired number of jobs as a string, which can include a percentage. For example, “50%” means 50 percent of the available CPU cores.

  • available_core_count (int, optional) – The total number of CPU cores available for assignment.

Returns:

  • int: The number of CPU cores calculated from the percentage, or 0 if there’s an error or unsupported format.

  • bool: True if the conversion was successful (i.e., a valid single percentage was provided),

    False if there was an error or the format is unsupported.

Return type:

tuple

Raises:

ValueError – If the percentage conversion results in a non-integer or if the input format is incorrect.

omni.repo.build.main.enforce_config_on_ci() None
omni.repo.build.main.finish_str(stage, configs) str
omni.repo.build.main.generate(
repo_folders,
platform_host,
platform_target,
settings: Settings,
verbose: bool,
dependencies: dict = {},
)

Cross platform generate command wrapper.

omni.repo.build.main.get_default_argument_parser() ArgumentParser

Default argument parser for Build Tool

omni.repo.build.main.get_source_linked_extension_paths(docker_d)
omni.repo.build.main.load_settings_from_config(
repo_config: Dict,
options: Namespace,
) Settings
omni.repo.build.main.main(
root: str,
settings: ~omni.repo.build.settings.Settings = <omni.repo.build.settings.Settings object>,
pull_dependencies_fn=<function pull_dependencies>,
stage_files_fn=<function stage_files>,
setup_vscode_env_fn=<function setup_vscode_env>,
relaunch_in_docker_fn=<function relaunch_in_docker>,
generate_fn=<function generate>,
build_fn=<function build>,
)

Main function for Build Tool.

Use settings for fine tunning build process for your repo.

Set any of optional step functions to None to disable particular step.

Parameters:
  • root (str) – Repo root folder.

  • settings (Settings, optional) – Build Tool settings.

  • pull_dependencies_fn (Callable, optional) – Optional overwrite for one of Build Tool steps.

  • stage_files_fn (Callable, optional) – Optional overwrite for one of Build Tool steps.

  • setup_vscode_env_fn (Callable, optional) – Optional overwrite for one of Build Tool steps.

  • relaunch_in_docker_fn (Callable, optional) – Optional overwrite for one of Build Tool steps.

  • generate_fn (Callable, optional) – Optional overwrite for one of Build Tool steps.

  • build_fn (Callable, optional) – Optional overwrite for one of Build Tool steps.

omni.repo.build.main.partial_clean(
repo_folders: Dict,
platform_target: str,
configs: List[str],
settings: Settings,
**kwargs,
)
omni.repo.build.main.post_build(
repo_folders: Dict,
platform_target: str,
configs: List[str],
settings: Settings,
**kwargs,
)

Post build step.

omni.repo.build.main.pre_build(
repo_folders: Dict,
platform_target: str,
configs: List[str],
settings: Settings,
**kwargs,
)

Custom pre build steps.

omni.repo.build.main.process_pip_dependencies(
repo_folders: Dict,
platform_host: str,
platform_target: str,
configs: List[str],
settings: Settings,
)
omni.repo.build.main.process_prebuild_dict(
prebuild_dict: Dict,
repo_folders: Dict,
platform_target: str,
configs: List[str],
settings: Settings,
**kwargs,
)

Run copy and link using prebuild dict with every configuration

omni.repo.build.main.relaunch_in_docker(
settings: Settings,
linbuild_debug: bool = False,
**kwargs,
)

Relaunch this build script in linbuild (a docker buildroot jail) on linux if not yet in such an environment.

omni.repo.build.main.run_build(
options,
repo_folders: ~typing.Dict,
settings: ~omni.repo.build.settings.Settings = None,
config: ~typing.Dict = {},
pull_dependencies_fn=<function pull_dependencies>,
stage_files_fn=<function stage_files>,
setup_vscode_env_fn=<function setup_vscode_env>,
relaunch_in_docker_fn=<function relaunch_in_docker>,
generate_fn=<function generate>,
build_fn=<function build>,
process_pip_dependencies_fn=<function process_pip_dependencies>,
clean_fn=<function clean>,
partial_clean_fn=<function partial_clean>,
gather_licenses_fn=<function gather_licenses>,
post_build_fn=<function post_build>,
)

Run build tool.

Use settings for fine tunning build process for your repo.

Set any of optional step functions to None to disable particular step.

Parameters:
  • options – Parsed arg parse options.

  • repo_folders (Dict) – Repo folders dict.

  • settings (Settings, optional) – Build Tool settings. Can be None, will be loaded from config in that case.

  • config (Dict) – Config from repoman.

  • pull_dependencies_fn (Callable, optional) – Optional overwrite for one of Build Tool steps.

  • stage_files_fn (Callable, optional) – Optional overwrite for one of Build Tool steps.

  • setup_vscode_env_fn (Callable, optional) – Optional overwrite for one of Build Tool steps.

  • relaunch_in_docker_fn (Callable, optional) – Optional overwrite for one of Build Tool steps.

  • generate_fn (Callable, optional) – Optional overwrite for one of Build Tool steps.

  • build_fn (Callable, optional) – Optional overwrite for one of Build Tool steps.

  • clean_fn (Callable, optional) – Optional overwrite for one of Build Tool steps.

  • partial_clean_fn (Callable, optional) – Optional overwrite for one of Build Tool steps.

  • gather_licenses_fn (Callable, optional) – Optional overwrite for one of Build Tool steps.

  • post_build_fn (Callable, optional) – Optional overwrite for one of the Build Tool steps.

omni.repo.build.main.setup_argument_parser(parser: ArgumentParser)
omni.repo.build.main.setup_repo_tool(parser, config)
omni.repo.build.main.stage_files(
repo_folders: Dict,
platform_target: str,
configs: List[str],
settings: Settings,
**kwargs,
)

Stage files step.