code: def build_all_for_one_platform(
      src_root_dir: str,
      built_output_root_dir: str,
      platform_name: str,  # either "{system}-{arch}' of 'darwin-universal2'
      native_built_tools_root_dir: str = None,
      cmake_target_toolchain: str = None,
      conan_host_profile: str = None,
      cmake_extra_args: List[str] = None,
      dry_run: bool = False,
      verbose: bool = False,
  ):
      build_native_root_dir = get_real_build_root_dir(
          src_root_dir, platform_name, built_output_root_dir
      )
  
      sys.path = [os.path.join(src_root_dir, "build")] + sys.path
      import build_native
  
      # exclude python-dependent targets that will be built for concrete python
      # and Java compilation of SWIG-generated sources (performed in build_jvm_artifacts)
      all_targets = [
          target
          for target in build_native.Targets.catboost.keys()
          if target
          not in ["_hnsw", "_catboost", "catboost4j-spark-impl"]
      ]
  
      have_cuda = need_to_build_cuda(platform_name)
  
      default_cmake_extra_args = [f"-DJAVA_HOME={JAVA_HOME}"]
      if cmake_extra_args is not None:
          default_cmake_extra_args += cmake_extra_args
  
      cmake_platform_to_root_path = None
      if platform_name == "darwin-universal2":
          target_platform = None
          macos_universal_binaries = True
          cmake_platform_to_root_path = dict(
              (
                  platform_name,
                  os.path.join(CMAKE_BUILD_ENV_ROOT, platform_name),
              )
              for platform_name in ["darwin-x86_64", "darwin-arm64"]
          )
      else:
          target_platform = platform_name
          macos_universal_binaries = False
          default_cmake_extra_args += [
              f"-DCMAKE_FIND_ROOT_PATH={os.path.join(CMAKE_BUILD_ENV_ROOT, platform_name)}"
          ]
  
      def call_build_native(
          targets,
          cmake_extra_args=[],
          cmake_platform_to_python_dev_paths=None,
      ):
          build_native.build(
              dry_run=dry_run,
              verbose=verbose,
              build_root_dir=build_native_root_dir,
              targets=targets,
              cmake_target_toolchain=cmake_target_toolchain,
              conan_host_profile=conan_host_profile,
              have_cuda=have_cuda,
              cuda_root_dir=CUDA_ROOT if have_cuda else None,
              target_platform=target_platform,
              macos_universal_binaries=macos_universal_binaries,
              native_built_tools_root_dir=native_built_tools_root_dir,
              cmake_extra_args=default_cmake_extra_args
              + cmake_extra_args,
              cmake_platform_to_root_path=cmake_platform_to_root_path,
              cmake_platform_to_python_dev_paths=cmake_platform_to_python_dev_paths,
          )
  
      # build all non python-version specific variants
      call_build_native(targets=all_targets)
  
      if os.environ.get("CMAKE_BUILD_CACHE_DIR"):
          copy_built_artifacts_to_canonical_place(
              platform_name.split("-")[0],
              build_native_root_dir,
              built_output_root_dir,
              dry_run=dry_run,
              verbose=verbose,
          )
  
      build_r_package(
          src_root_dir,
          build_native_root_dir,
          platform_name,
          dry_run,
          verbose,
      )
  
      build_jvm_artifacts(
          src_root_dir,
          build_native_root_dir,
          target_platform,
          macos_universal_binaries,
          have_cuda,
          dry_run,
          verbose,
      )
  
      # build python version-specific wheels.
      # Note: assumes build_widget has already been called
      for py_ver in PYTHON_VERSIONS:
          (
              python_include_path,
              python_library_path,
          ) = get_python_version_include_and_library_paths(py_ver)
          if macos_universal_binaries:
              cmake_extra_args = []
              cmake_platform_to_python_dev_paths = dict(
                  (
                      platform_name,
                      build_native.PythonDevPaths(
                          os.path.join(
                              CMAKE_BUILD_ENV_ROOT,
                              platform_name,
                              python_include_path,
                          ),
                          os.path.join(
                              CMAKE_BUILD_ENV_ROOT,
                              platform_name,
                              python_library_path,
                          ),
                      ),
                  )
                  for platform_name in ["darwin-x86_64", "darwin-arm64"]
              )
          else:
              cmake_extra_args = [
                  f"-DPython3_LIBRARY={os.path.join(CMAKE_BUILD_ENV_ROOT, platform_name, python_library_path)}",
                  f"-DPython3_INCLUDE_DIR={os.path.join(CMAKE_BUILD_ENV_ROOT, platform_name, python_include_path)}",
              ]
              cmake_platform_to_python_dev_paths = None
  
          call_build_native(
              targets=["_hnsw", "_catboost"],
              cmake_extra_args=cmake_extra_args,
              cmake_platform_to_python_dev_paths=cmake_platform_to_python_dev_paths,
          )
  
          # don't pass CUDA_ROOT here because it does not matter when prebuilt extension libraries are used
          bdist_wheel_cmd = [
              "setup.py",
              "bdist_wheel",
              "--plat-name",
              get_python_plat_name(platform_name),
              "--with-hnsw",
              "--prebuilt-widget",
              f"--prebuilt-extensions-build-root-dir={build_native_root_dir}",
          ]
  
          run_with_native_python_with_version_in_python_package_dir(
              src_root_dir, dry_run, verbose, py_ver, [bdist_wheel_cmd]
          )
  
imports: import argparse
  import distutils
  import hashlib
  import logging
  import os
  import subprocess
  import sys
  import tarfile
  from typing import List, Tuple
label_desc: Use image node_id 17 for calling a global function with example usage: build_all_for_one_platform(src_root_dir, built_output_root_dir, platform_name, native_built_tools_root_dir, cmake_target_toolchain, conan_host_profile, cmake_extra_args, dry_run, verbose) without return types