Skip to content

Support manually installed platforms in build profiles #2927

Open
@per1234

Description

@per1234

Describe the request

Add support for specifying manually installed platform dependencies in "build profiles".

Describe the current behavior

Build profiles allow controlling the boards platform and library dependencies of a sketch project.

Although it is most common to obtain platform dependencies via the Boards Manager system (core install), the projects of advanced users may have a dependency on a development version of a platform, which is not available for installation via core install. They will manually install these platform dependencies:

https://arduino.github.io/arduino-cli/dev/platform-specification/#:~:text=a%20platform%20may%20be%20manually%20installed%20by%20the%20user%20inside%20the%20Sketchbook/user%20directory

🙁 Build profiles can not be used for projects that have a dependency on a platform that is not available for installation via the Boards Manager system.

Setup

$ export ARDUINO_DIRECTORIES_USER="/tmp/arduino-cli-directories/user"  # Use a throwaway user folder for the demo.

$ mkdir -p "${ARDUINO_DIRECTORIES_USER}/hardware/arduino-dev"

$ git clone https://github.com/arduino/ArduinoCore-avr "${ARDUINO_DIRECTORIES_USER}/hardware/arduino-dev/avr"  # Manual installation of the `arduino-dev:avr` platform.

[...]

$ arduino-cli core install arduino:avr  # Install production release of `arduino:avr` platform to get the tool dependencies.

[...]

$ arduino-cli sketch new "${ARDUINO_DIRECTORIES_USER}/FooSketch"

Demonstration

$ arduino-cli compile --dump-profile --fqbn arduino-dev:avr:uno "${ARDUINO_DIRECTORIES_USER}/FooSketch"  # Do a compile without build profile to prove everything is working, and to generate a base for the profile.

profiles:
  uno:
    fqbn: arduino-dev:avr:uno
    platforms:
      - platform: arduino-dev:avr (1.8.6)

$ printf '
profiles:
  uno:
    fqbn: arduino-dev:avr:uno
    platforms:
      - platform: arduino-dev:avr (1.8.6)
      - platform: arduino:avr (1.8.6)
' > "${ARDUINO_DIRECTORIES_USER}/FooSketch/sketch.yaml"  # Create a sketch project file containing a build profile with the platform providing tool dependencies in addition to the manually installed platform dependency.

$ arduino-cli compile --profile uno "${ARDUINO_DIRECTORIES_USER}/FooSketch"

Downloading platform arduino-dev:avr@1.8.6...
Downloading index: package_index.tar.bz2 downloaded
Error downloading platform arduino-dev:avr@1.8.6...
Downloading platform arduino:avr@1.8.6...
Downloading index: package_index.tar.bz2 downloaded
arduino:avr@1.8.6 arduino:avr@1.8.6 already downloaded
Installing platform arduino:avr@1.8.6...
Downloading tool arduino:arduinoOTA@1.3.0...
arduino:arduinoOTA@1.3.0 arduino:arduinoOTA@1.3.0 already downloaded
Installing tool arduino:arduinoOTA@1.3.0...
Downloading tool arduino:avr-gcc@7.3.0-atmel3.6.1-arduino7...
arduino:avr-gcc@7.3.0-atmel3.6.1-arduino7 arduino:avr-gcc@7.3.0-atmel3.6.1-arduino7 already downloaded
Installing tool arduino:avr-gcc@7.3.0-atmel3.6.1-arduino7...
Downloading tool arduino:avrdude@6.3.0-arduino17...
arduino:avrdude@6.3.0-arduino17 arduino:avrdude@6.3.0-arduino17 already downloaded
Installing tool arduino:avrdude@6.3.0-arduino17...
Error initializing instance: Error loading hardware platform: loading required platform arduino-dev:avr@1.8.6: Error downloading platform arduino-dev:avr@1.8.6: Platform 'arduino-dev:avr@1.8.6' not found
Error during build: Platform 'arduino-dev:avr' not found: platform not installed

Arduino CLI version

55f86b5

Operating system

N/A

Operating system version

Any

Additional context

Related

Issue checklist

  • I searched for previous requests in the issue tracker
  • I verified the feature was still missing when using the nightly build
  • My request contains all necessary details

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: build-processRelated to the sketch build processtopic: codeRelated to content of the project itselftopic: package-managementRelated to the packaging and managing of the platform/librariestype: enhancementProposed improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions