Skip to content

linker: allow multi-step link recipe (c.combine) #2954

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

pillo79
Copy link
Contributor

@pillo79 pillo79 commented Jul 16, 2025

This PR introduces the possibility of using multiple commands for the c.combine pattern, and infrastructure that will enable using the same logic on any build step, if so decided.

Two changes in behavior are introduced:

  • When looking for multi-step recipes (e.g. hooks) in RunRecipe(), a key that exactly matches prefix.suffix is explicitly ignored if numbered entries are found, and only used as a fallback when no other entries are present.
    This change is consistent with current docs that require a prefix.NNN.suffix syntax for multi-step recipes. A property named prefix.suffix is undefined behavior, and is currently included among the numbered ones.

  • Reuse the RunRecipe logic for the recipe.c.combine step to allow multi-stage linking. The above change in this context means that numbered steps have priority over the single property, but both can be specified to maintain backwards compatibility (the new numbered properties are ignored by the current IDE).

NO TESTS as I don't know where to add the test case... 😇 BUT I tried with a core that defined these rules and got the exact behavior I described here. If someone can give me pointers I can add the proper test case.

Feel free to cherry-pick and/or edit and/or shoot down at will 😅

pillo79 added 2 commits July 16, 2025 10:26
Recipes must follow the 'prefix.NNN.suffix' pattern, where 'NNN' is a
number. When there is also a single 'prefix.suffix' property defined,
make sure to not include that in the list of recipes to run. However, if
no numbered recipes are found, use the single 'prefix.suffix' form if it
exists.

This allows to have both a single recipe and a set of numbered recipes
in the same build properties, for backwards compatibility.

Signed-off-by: Luca Burelli <[email protected]>
Enable the use of recipes for the `recipe.c.combine.pattern` command.
Allows for more flexibility in the build process.

Signed-off-by: Luca Burelli <[email protected]>
@pillo79 pillo79 changed the title Pr recipe link linker: allow multi-step link recipe (c.combine) Jul 16, 2025
Copy link

codecov bot commented Jul 16, 2025

Codecov Report

Attention: Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 68.04%. Comparing base (ae68728) to head (2baed3c).
Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
internal/arduino/builder/builder.go 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2954      +/-   ##
==========================================
+ Coverage   68.01%   68.04%   +0.03%     
==========================================
  Files         239      239              
  Lines       22589    22592       +3     
==========================================
+ Hits        15363    15372       +9     
+ Misses       6023     6019       -4     
+ Partials     1203     1201       -2     
Flag Coverage Δ
unit 68.04% <91.66%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself topic: build-process Related to the sketch build process labels Jul 16, 2025
@cmaglie cmaglie self-assigned this Jul 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: build-process Related to the sketch build process topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants