The Arduino team has launched a new version of its command-line interface (CLI) tool, Arduino CLI, bringing with it a new build profile feature — aimed at avoiding version-rot by tying projects to precise library and platform versions.
"Sometimes Arduino users end up not being able to build and upload a Sketch after the project is completed, and this might be due to libraries changing an API, or cores having deprecated some parts in favor of a more modern approach," explains Arduino's Ubi de Feo of the problem. "Legacy is the enemy of progress, and sometimes developers need to rip the band-aid off and break things. We see this all the time."
The solution: Build profiles, a new feature of the Arduino CLI which allows developers to write a configuration file specifying the exact version of any platforms and libraries the sketch was written to use — meaning, in theory at least, an end to the problem of progress killing off otherwise-working applications.
There's a catch, however. "This relies on the libraries being part of the Arduino Library Registry and the platforms to be source-able by the Arduino CLI," de Feo admits. "All platforms developed by Arduino are available by default, but users can add additional URLs to their configuration and make sure the required platform can always be found and installed."
The configuration files themselves are simple YAML files defining the platform and version in use along with each library and its version. When provided at compile time using the new --profile flag, any missing versions are automatically retrieved and used for compilation — and it's possible to have multiple profiles per project, choosing each one as required at compile time.
More information on the build profiles feature is available in the Arduino CLI documentation; the latest version of Arduino CLI is available on the project's GitHub page as pre-compiled binaries for Linux, Windows, and macOS, with source code published to GitHub under the reciprocal GNU General Public License 3.