maxgerhardt / platform-raspberrypi

Raspberry Pi: development platform for PlatformIO
Apache License 2.0
107 stars 54 forks source link

Advertise `upload` target as platform target / Fix Jetbrains Clion upload integration #59

Open episource opened 6 months ago

episource commented 6 months ago

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 using env.AddPlatformTarget). Builtin targets are not included in this list. With one notable exception: For embedded platforms without explicit platform targets, the upload 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 using AddPlatformTarget("upload, ...) instead of Alias("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 the upload target in the metadata. If upload target is missing in pio project metadata, clicking the play button leads to error message PlatformIO: Upload action is not available for this PlatformIO env. Additionally the upload target and dependent actions won't show up in Clions PlatformIO pane.

maxgerhardt commented 5 months ago

That would be extremely concerning if true, because the

AlwaysBuild(env.Alias("upload", upload_source, upload_actions))

construct comes from the standard PlatformIO platforms, like in platform-ststm32. If that's wrong, everything else is wrong too, and I don't yet see this being fixed in all other platforms. Can you push https://github.com/platformio/platformio-core/issues/4477 again?