-
-
Notifications
You must be signed in to change notification settings - Fork 398
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
Unexpected behavior with both a packaged platform and an unpackaged platform in user/hardware directory w/ same ID #1685
Comments
Several people contributed to the effort, but @cmaglie is the original author. I agree that it is really helpful to have clear documentation of this complex system. Thanks Cristian!
I don't think it would be very serious. The priorities have never been documented and I think it is not very common to have the same platform installed both places. I mostly see this done by newcomers who accidentally follow both the Boards Manager and manual installation methods because the docs don't make it clear that these are two alternative options (example). That said, there is a previous report of a change in the priorities causing problems for people here: arduino/Arduino#9237
I once wished for this also. I believe the ESP8266 platform developers had to go to some lengths to achieve it for their "git" installation method. The approach of using Boards Manager for the tools installation has served me very well, and is currently in use in the CI systems of all of Arduino's official boards platforms (example). I haven't yet ran into the situation where I needed different tools than those used by a release version of the platform. My plan is to handle this eventuality by creating a development package index with the required tools and a platform specifying them as dependencies, then install that platform via Boards Manager as always.
The approach taken by Arduino's developers is described here: arduino/Arduino#9237 As you are doing already, Boards Manager is typically used as a convenient way to install the tools. As you are doing already, the boards platform under development is located under The one difference is that you should make the vendor folder unique. In the discussion linked above, that is done by adding a The problem with having a boards platform installed both to In a way, this approach is actually better than the development copy overriding the production installation because it means you can easily control which of the two platforms is used by an Arduino CLI command via the FQBN. So you can work with the production platform as needed without having to remember to checkout that tag in the repo every time. |
@per1234 - Thank you for the incredibly detailed response & pointers to prior art. For my use case, I can likely make things work with the -git hack, but it sounds like there really is something that ought to get fixed here. I don't 100% agree that having to resolve a name collision for a FQBN is a 'bad' thing, since it's very similar to how we already treat libraries. (Heck, I can see a world in which it'd be nice to install multiple package-manager-managed versions of one core in parallel.) Silently choosing the packaged core over a locally defined core feels like the wrong thing. Possible changes might include:
|
One more possibility:
|
For those playing along at home: After implementing the -git core naming convention in my build system, it felt pretty ugly and hacky. It was going to mean having to mess with FQBNs all over the place depending on which version of the core happened to be around. I took a step back and implemented @per1234's development package index idea. It took 5 minutes. The most complicated bit was creating an empty zipfile for the platform. And everything...just works. Here's my development package index: https://github.com/keyboardio/boardsmanager/blob/main/devel/package_kaleidoscope_devel_index.json |
I'm trying to set up and document a workflow for active development of a core, while still being able to build sketches with arduino-cli.
With 0.21 (as well as previous versions, I believe), I'm running into trouble figuring out a reasonable development workflow. Reading through the arduino-cli sketch build documentation, I don't see a way to do what I want or an explanation of what the expected behavior should be.
Because there's no way for arduino-cli to install the required tools for a platform from a core checked out into
$(ARDUINO_DIRECTORIES_USER)/hardware
, it's been necessary to "prime" the system by installing a prepackaged version of the core witharduino-cli core install $mycore
. That will download a copy of the core and resolve compiler and tools dependencies.After that, I git clone a copy of the HEAD of the core to
$(ARDUINO_DIRECTORIES_USER)/hardware
At this point, if I try to use
arduino-cli
to build a sketch and supply a fqbn, it will use the prepackaged version of the core downloaded with the package manager.Doc bug: I don't believe there is documentation about what the expected search order is for a core. (Library resolution on the other hand, is now documented incredibly well at https://arduino.github.io/arduino-cli/0.21/sketch-build-process/#dependency-resolution - Whoever wrote those docs has my gratitude. Historically figuring out that dependency resolution was a huge pain. The new docs are just fantastic. Thank you!)
Functionality issue: I believe that if a user has placed a local, unpackaged core in their hardware/ directory, it ought to be used in preference to one downloaded through the boards manager. That said, this would potentially be a breaking change.
I'd be very happy if there were some way to hint to
arduino-cli
that it should prefer a core in thehardware
subdir of the user directory/sketchbook, either in the global config or on the command-line. Alternatively, I'd love it if there were a way to install tools/dependencies for a core checked out intohardware
.Or is there a more 'arduino-ish' way to do this?
Thanks!
The text was updated successfully, but these errors were encountered: