Skip to content

The sketch_path platform property is not generated #2340

Closed
@per1234

Description

@per1234

Describe the problem

From the Arduino Platform Specification:

https://arduino.github.io/arduino-cli/dev/platform-specification/#recipes-to-export-compiled-binary

The recipe.hooks.savehex.presavehex.NUMBER.pattern and recipe.hooks.savehex.postsavehex.NUMBER.pattern hooks
(but not recipe.output.tmp_file and recipe.output.save_file) can be built concatenating the following
automatically generated properties:

  • {sketch_path}: the absolute path of the sketch folder

🐛 Arduino CLI does not generate the sketch_path property as promised by the specification.

To reproduce

$ arduino-cli version

arduino-cli.exe  Version: git-snapshot Commit: 422aa87f Date: 2023-09-26T05:56:57Z

$ export ARDUINO_DIRECTORIES_DATA="/tmp/sketch_path-property-demo"  # Use a throwaway directories.data for the demo

$ arduino-cli core install arduino:[email protected]  # Install an arbitrary platform to use for the demo

[...]

$ printf 'recipe.hooks.savehex.presavehex.1.pattern=echo "sketch_path in savehex.presavehex hook: {sketch_path}"\nrecipe.hooks.savehex.postsavehex.1.pattern=echo "sketch_path in savehex.postsavehex hook: {sketch_path}"' > "${ARDUINO_DIRECTORIES_DATA}/packages/arduino/hardware/avr/1.8.6/platform.local.txt"  # Add the hooks to the platform

$ ./arduino-cli sketch new /tmp/FooSketch  # Create an arbitrary sketch to compile

[...]

$ ./arduino-cli compile --export-binaries --fqbn arduino:avr:uno --verbose /tmp/FooSketch

[...]

sketch_path in savehex.presavehex hook: {sketch_path}
echo "sketch_path in savehex.presavehex hook: {sketch_path}"
sketch_path in savehex.postsavehex hook: {sketch_path}
echo "sketch_path in savehex.postsavehex hook: {sketch_path}"

🐛 The sketch_path property references were not expanded because Arduino CLI never generated the property.

Expected behavior

Arduino CLI generates the sketch_path property as promised by the specification.

Arduino CLI version

422aa87

Operating system

Windows

Operating system version

11

Additional context

The bug was present from the introduction of support for the savehex hooks in 5f73378 / #2091


Known affected platforms:


Originally reported by @Dancofra at MCUdude/MegaCore#206

Additional reports

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

Labels

topic: build-processRelated to the sketch build processtopic: codeRelated to content of the project itselftype: imperfectionPerceived defect in any part of project

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions