Internal build method without lock management.
(self, example: str)
| 764 | return futures |
| 765 | |
| 766 | def _build_internal(self, example: str) -> SketchResult: |
| 767 | """Internal build method without lock management.""" |
| 768 | # Print building banner first |
| 769 | print(create_building_banner(example)) |
| 770 | |
| 771 | # Copy example source to build directory |
| 772 | project_root = resolve_project_root() |
| 773 | ok_copy_src = copy_example_source(project_root, self.build_dir, example) |
| 774 | if not ok_copy_src: |
| 775 | error_msg = get_example_error_message(project_root, example) |
| 776 | return SketchResult( |
| 777 | success=False, |
| 778 | output=error_msg, |
| 779 | build_dir=self.build_dir, |
| 780 | example=example, |
| 781 | ) |
| 782 | |
| 783 | # Cache configuration is handled through build flags during initialization |
| 784 | |
| 785 | # Use fbuild for compilation if enabled |
| 786 | if self.use_fbuild: |
| 787 | return self._build_with_fbuild(example) |
| 788 | |
| 789 | # Attempt build with retry on PackageException |
| 790 | max_attempts = 2 |
| 791 | for attempt in range(max_attempts): |
| 792 | if attempt > 0: |
| 793 | print(f"\n{'=' * 60}") |
| 794 | print(f"RETRY ATTEMPT {attempt}/{max_attempts - 1}") |
| 795 | print(f"{'=' * 60}\n") |
| 796 | |
| 797 | # Run PlatformIO build |
| 798 | run_cmd: list[str] = [ |
| 799 | "pio", |
| 800 | "run", |
| 801 | "--project-dir", |
| 802 | str(self.build_dir), |
| 803 | "--disable-auto-clean", |
| 804 | ] |
| 805 | if self.verbose: |
| 806 | run_cmd.append("--verbose") |
| 807 | |
| 808 | print(f"Running command: {subprocess.list2cmdline(run_cmd)}") |
| 809 | |
| 810 | # Create formatter for path substitution and timestamping |
| 811 | formatter = create_sketch_path_formatter(example) |
| 812 | |
| 813 | running_process = RunningProcess( |
| 814 | run_cmd, |
| 815 | cwd=self.build_dir, |
| 816 | auto_run=True, |
| 817 | output_formatter=formatter, |
| 818 | env=get_pio_execution_env(), |
| 819 | ) |
| 820 | try: |
| 821 | # Output is transformed by the formatter, but we need to print it |
| 822 | while line := running_process.get_next_line( |
| 823 | timeout=900 |
no test coverage detected