Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

82 rindas
1.8KB

  1. import argparse
  2. import sys
  3. from pathlib import Path
  4. from typing import Sequence, NamedTuple
  5. import subprocess
  6. HERE = Path(__file__).parent.absolute()
  7. TOOLS_DIR = HERE
  8. PROJECT_ROOT = HERE.parent
  9. PREBUILT_DDS = PROJECT_ROOT / '_prebuilt/dds'
  10. class CIOptions(NamedTuple):
  11. skip_bootstrap: bool
  12. cxx: Path
  13. toolchain: str
  14. def _do_bootstrap(opts: CIOptions) -> None:
  15. print('Running bootstrap')
  16. subprocess.check_call([
  17. sys.executable,
  18. '-u',
  19. str(TOOLS_DIR / 'bootstrap.py'),
  20. f'--cxx={opts.cxx}',
  21. ])
  22. def main(argv: Sequence[str]) -> int:
  23. parser = argparse.ArgumentParser()
  24. parser.add_argument(
  25. '--skip-bootstrap',
  26. action='store_true',
  27. help=
  28. 'Skip the prebuild-bootstrap step. This requires a _prebuilt/dds to exist!',
  29. )
  30. parser.add_argument(
  31. '--cxx',
  32. help='The name/path of the C++ compiler to use.',
  33. required=True)
  34. parser.add_argument(
  35. '--toolchain',
  36. '-T',
  37. help='The toolchain to use for the CI process',
  38. required=True)
  39. args = parser.parse_args(argv)
  40. opts = CIOptions(
  41. skip_bootstrap=args.skip_bootstrap,
  42. cxx=Path(args.cxx),
  43. toolchain=args.toolchain)
  44. if not opts.skip_bootstrap:
  45. _do_bootstrap(opts)
  46. subprocess.check_call([
  47. str(PREBUILT_DDS),
  48. 'deps',
  49. 'build',
  50. f'-T{opts.toolchain}',
  51. f'--repo-dir={PROJECT_ROOT / "external/repo"}',
  52. ])
  53. subprocess.check_call([
  54. str(PREBUILT_DDS),
  55. 'build',
  56. '--full',
  57. f'-T{opts.toolchain}',
  58. ])
  59. subprocess.check_call([
  60. sys.executable,
  61. '-u',
  62. str(TOOLS_DIR / 'test.py'),
  63. f'--exe={PROJECT_ROOT / "_build/dds"}',
  64. f'-T{opts.toolchain}',
  65. ])
  66. return 0
  67. if __name__ == "__main__":
  68. sys.exit(main(sys.argv[1:]))