Skip to content

Hooks are recognized even when pattern property name uses string key in place of numeric index #2369

Closed
espressif/arduino-esp32
#9220
@ArminJo

Description

@ArminJo

Describe the problem

Here https://arduino.github.io/arduino-cli/0.34/platform-specification/#pre-and-post-build-hooks-since-arduino-ide-165
the hook recipe.hooks.core.prebuild.set_core_build_flag is not documented.
But it is used By ESP32 platform.txt line 195 ff.

# Set -DARDUINO_CORE_BUILD only on core file compilation
file_opts.path={build.path}/file_opts
recipe.hooks.prebuild.set_core_build_flag.pattern=bash -c ": > {file_opts.path}"
recipe.hooks.core.prebuild.set_core_build_flag.pattern=bash -c "echo -DARDUINO_CORE_BUILD > {file_opts.path}"
recipe.hooks.core.postbuild.set_core_build_flag.pattern=bash -c ": > {file_opts.path}"

recipe.hooks.prebuild.set_core_build_flag.pattern.windows=cmd /c type nul > "{file_opts.path}"
recipe.hooks.core.prebuild.set_core_build_flag.pattern.windows=cmd /c echo "-DARDUINO_CORE_BUILD" > "{file_opts.path}"
recipe.hooks.core.postbuild.set_core_build_flag.pattern.windows=cmd /c type nul > "{file_opts.path}"

see also Sloeber/arduino-eclipse-plugin#1582

To reproduce

Compile any sketch with any ESP32 board:

Creating esp32 image...
Merged 1 ELF section
Successfully created esp32 image.
cmd /c if exist "C:\\Users\\...\\Temp\\.arduinoIDE-unsaved2023915-8796-1rs03z4.hnwd\\SimpleReceiver\\build_opt.h" COPY /y "C:\\Users\\...\\Temp\\.arduinoIDE-unsaved2023915-8796-1rs03z4.hnwd\\SimpleReceiver\\build_opt.h" "C:\\Users\\...\\Temp\\arduino\\sketches\\10BDBB355C916CDD0AC5166109C1A196\\build_opt.h"
cmd /c if not exist "C:\\Users\\...\\Temp\\arduino\\sketches\\10BDBB355C916CDD0AC5166109C1A196\\build_opt.h" type nul > "C:\\Users\\...\\Temp\\arduino\\sketches\\10BDBB355C916CDD0AC5166109C1A196\\build_opt.h"
cmd /c type nul > "C:\\Users\\Armin\\AppData\\Local\\Temp\\arduino\\sketches\\10BDBB355C916CDD0AC5166109C1A196/file_opts"

see last line, where the recipe is executed.

Expected behavior

Please document it, or disable it if it is not officially supported.
Thanks

Arduino CLI version

2.2.0

Operating system

Windows

Operating system version

10

Additional context

Please document it, or disable it, if it is not officially supported.
Thanks

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the nightly build
  • My report contains all necessary details

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions