Skip to content
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

The sketch_path platform property is not generated #2340

Closed
3 tasks done
per1234 opened this issue Sep 26, 2023 · 0 comments · Fixed by #2372
Closed
3 tasks done

The sketch_path platform property is not generated #2340

per1234 opened this issue Sep 26, 2023 · 0 comments · Fixed by #2372
Assignees
Labels
topic: build-process Related to the sketch build process topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@per1234
Copy link
Contributor

per1234 commented Sep 26, 2023

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
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: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants