Advertise upload
target as platform target / Fix Jetbrains Clion upload integration
#59
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
1. General Improvement
Currently only platform targets are included in
pio project metadata
output. This output is backed by__PIO_TARGETS
environment variable, which currently only includes explicit targets (e.g. added usingenv.AddPlatformTarget
). Builtin targets are not included in this list. With one notable exception: For embedded platforms without explicit platform targets, theupload
target is added to the list.There is already an platformio/platformio-core#4477 issue related to the
pio run --list-targets
output, which is backed by the metadata. The tickets requests a more complete output.Nevertheless, the
upload
target is highly platform specific. So makes sense to not include this target if platform defines its own targets.Therefore I'd like to request the raspberrypi platform to explicitly advertise its
upload
target by usingAddPlatformTarget("upload, ...)
instead ofAlias("upload", ...)
.2. Side effect: Fixes Jetbrains Clion integration
This also fixes broken Jetbrains Clion integration for the
upload
target of projects based on this raspberrypi platform:Clion uses
pio project metadata
to figure out available targets. The play button of platformio run configurations is bound to the existance of theupload
target in the metadata. Ifupload
target is missing inpio project metadata
, clicking the play button leads to error messagePlatformIO: Upload action is not available for this PlatformIO env
. Additionally theupload
target and dependent actions won't show up in Clions PlatformIO pane.