Skip to content

Allow selection of build.core and build.variant with variables substitution #2176

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
May 10, 2023

Conversation

cmaglie
Copy link
Member

@cmaglie cmaglie commented May 9, 2023

Please check if the PR fulfills these requirements

See how to contribute

  • The PR has no duplicates (please search among the Pull Requests
    before creating one)
  • The PR follows
    our contributing guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • UPGRADING.md has been updated with a migration guide (for breaking changes)
  • configuration.schema.json updated if new parameters are added.

What kind of change does this PR introduce?

Allows the properties build.core and build.variant to have variable substitution placeholders like {variable}.

What is the current behavior?

The build.core and build.variant must be constants, otherwise, the build will fail, see #762.
This behavior is different from Arduino IDE 1.8.x which instead allows it.

What is the new behavior?

The variable substitution is performed as expected.

Does this PR introduce a breaking change, and is titled accordingly?

No

Other information

Fix #762

@cmaglie cmaglie added type: enhancement Proposed improvement topic: code Related to content of the project itself labels May 9, 2023
@cmaglie cmaglie added this to the Arduino CLI 0.33.0 milestone May 9, 2023
@cmaglie cmaglie self-assigned this May 9, 2023
@cmaglie cmaglie force-pushed the fix_variant_and_core_selection branch from d316186 to 9ba7599 Compare May 9, 2023 17:21
@codecov
Copy link

codecov bot commented May 9, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.06 🎉

Comparison is base (855c238) 62.53% compared to head (9ba7599) 62.60%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2176      +/-   ##
==========================================
+ Coverage   62.53%   62.60%   +0.06%     
==========================================
  Files         223      223              
  Lines       19488    19490       +2     
==========================================
+ Hits        12187    12201      +14     
+ Misses       6210     6202       -8     
+ Partials     1091     1087       -4     
Flag Coverage Δ
unit 62.60% <100.00%> (+0.06%) ⬆️

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

Impacted Files Coverage Δ
arduino/cores/packagemanager/package_manager.go 76.48% <100.00%> (-0.58%) ⬇️
arduino/libraries/loader.go 92.76% <100.00%> (+10.09%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@alessio-perugini alessio-perugini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@fpistm
Copy link
Contributor

fpistm commented May 10, 2023

Hi @cmaglie, @matthijskooijman

I've tested this PR and it works same result before and after boards.txt changes.

arduino-cli Version:

git-snapshot Commit: 9ba7599c Date: 2023-05-10T06:57:20Z

command line:

./arduino-cli compile -b STMicroelectronics:stm32:Nucleo_64:pnum=NUCLEO_F411RE --build-path build_blink C:\\IDE\\arduino-1.8.19\\examples\\01.Basics\\Blink\\Blink.ino

boards.txt patch
@@ -281,10 +281,11 @@ Nucleo_64.build.board=Nucleo_64
 Nucleo_64.build.variant_h=variant_{build.board}.h
 Nucleo_64.build.st_extra_flags=-D{build.product_line} {build.enable_usb} {build.xSerial}
 Nucleo_64.build.flash_offset=0x0
 Nucleo_64.upload.maximum_size=0
 Nucleo_64.upload.maximum_data_size=0
+Nucleo_64.build.variant={build.series}/{build.subvariant}
 
 # NUCLEO_C031C6 board
 Nucleo_64.menu.pnum.NUCLEO_C031C6=Nucleo C031C6
 Nucleo_64.menu.pnum.NUCLEO_C031C6.node="NOD_C031C6"
 Nucleo_64.menu.pnum.NUCLEO_C031C6.upload.maximum_size=32768
@@ -408,11 +409,11 @@ Nucleo_64.menu.pnum.NUCLEO_F411RE.build.mcu=cortex-m4
 Nucleo_64.menu.pnum.NUCLEO_F411RE.build.fpu=-mfpu=fpv4-sp-d16
 Nucleo_64.menu.pnum.NUCLEO_F411RE.build.float-abi=-mfloat-abi=hard
 Nucleo_64.menu.pnum.NUCLEO_F411RE.build.board=NUCLEO_F411RE
 Nucleo_64.menu.pnum.NUCLEO_F411RE.build.series=STM32F4xx
 Nucleo_64.menu.pnum.NUCLEO_F411RE.build.product_line=STM32F411xE
-Nucleo_64.menu.pnum.NUCLEO_F411RE.build.variant=STM32F4xx/F411R(C-E)T
+Nucleo_64.menu.pnum.NUCLEO_F411RE.build.subvariant=F411R(C-E)T
 Nucleo_64.menu.pnum.NUCLEO_F411RE.build.cmsis_lib_gcc=arm_cortexM4lf_math
 
 # NUCLEO_F446RE board
 Nucleo_64.menu.pnum.NUCLEO_F446RE=Nucleo F446RE
 Nucleo_64.menu.pnum.NUCLEO_F446RE.node=NODE_F446RE

Thanks @cmaglie for this PR.

@cmaglie cmaglie merged commit d563755 into arduino:master May 10, 2023
@cmaglie cmaglie deleted the fix_variant_and_core_selection branch May 10, 2023 13:35
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
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.

Properties expansions inside build.variant break core build
4 participants