Skip to content

Forward targets to Arduino HybridCompile run#499

Merged
Jason2866 merged 1 commit into
developfrom
fwd_only_targets
May 25, 2026
Merged

Forward targets to Arduino HybridCompile run#499
Jason2866 merged 1 commit into
developfrom
fwd_only_targets

Conversation

@Jason2866

@Jason2866 Jason2866 commented May 25, 2026

Copy link
Copy Markdown

Description:

Related issue (if applicable): fixes #496 (comment)

Checklist:

  • The pull request is done against the latest develop branch
  • Only relevant files were touched
  • Only one feature/fix was added per PR, more changes are allowed when changing boards.json
  • I accept the CLA

Summary by CodeRabbit

  • Bug Fixes

    • Improved build target resolution with enhanced normalization and de-duplication, ensuring consistent and reliable builds across different execution contexts, including automated build scenarios.
  • Chores

    • Enhanced verbose mode output to display complete build command details and forwarded command information for improved troubleshooting and debugging capabilities.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 25, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7857babd-209b-4ade-bb73-2f0d8d32fb00

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fwd_only_targets

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Jason2866

Copy link
Copy Markdown
Author

@coderabbitai Does the PR fix the issue that no target was provided in HybridCompile mode? Are there any side effects?

@coderabbitai

coderabbitai Bot commented May 25, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

@Jason2866 Yes, the PR directly addresses the issue. Here's a breakdown:


Does it fix the problem?

Yes. The referenced comment identified that after the env.Exit fix (from the try_exit branch), running pio run -t upload no longer uploaded on the first hybrid compile pass because the child pio run was spawned without any --target argument. This PR closes that gap by forwarding the requested targets to the child command:

child_targets = [t for t in get_requested_cli_targets() if t != "checkprogsize"]
child_target_args = " ".join(f'-t "{target}"' for target in child_targets)
child_run_cmd = f'"{pio_exe_path}" run -e "{pio_cmd}" {child_target_args}'.strip()

So pio run -t upload now produces pio run -e <env> -t upload for the child, which correctly uploads in a single pass. The sys.argv fallback also covers VS Code / IDE-triggered builds where COMMAND_LINE_TARGETS can be empty during script loading.


Known side effects / limitations

Item Impact Notes
checkprogsize stripped from forwarded targets ✅ Intentional Correct: checkprogsize is an outer-SCons concern and would fail in the child's env
--upload-port / --monitor-port not forwarded ⚠️ Known limitation Deliberate decision to keep complexity down. The pioarduino VS Code extension reads the port from platformio.ini directly, so this doesn't affect its users
sys.argv fallback parsing 🔍 Mildly fragile Parses -t, --target=, and short -tTARGET forms. Works for standard PlatformIO CLI formats, but could theoretically break if PIO changes its internal invocation format
First hybrid compile still won't upload via raw IDE "Upload" button if IDE passes --upload-port ⚠️ Edge case CLI usage and pioarduino VSCode extension are fine; vanilla PlatformIO extension with explicit port may need a second run

Summary

The fix is correct and well-scoped. hmbacher (the reporter of the linked comment) confirmed it works on Windows 11 with VS Code. The remaining limitation around port arguments is intentional and documented in the issue discussion. No unintended regressions are expected from this change.


🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Fetch PR details and diff
gh pr view 499 --repo pioarduino/platform-espressif32 --json title,body,files,additions,deletions

echo "=== PR DIFF ==="
gh pr diff 499 --repo pioarduino/platform-espressif32

echo "=== RELATED ISSUE ==="
gh issue view 496 --repo pioarduino/platform-espressif32 --json title,body,comments

Length of output: 19133


@Jason2866 Jason2866 merged commit c87c661 into develop May 25, 2026
1 check passed
@Jason2866 Jason2866 deleted the fwd_only_targets branch May 25, 2026 20:27
@coderabbitai coderabbitai Bot mentioned this pull request Jun 4, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant