Skip to content
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

Fix handling of referenced cores #467

Merged
merged 4 commits into from Nov 4, 2019

Conversation

matthijskooijman
Copy link
Collaborator

A core is referenced by specifying build.core=package:core in board properties. However, the code that handled resolving these, had two problems:

  • It used the second part (core) rather than the first part (package) to look up the package to reference. The most commonly used core reference is arduino:arduino which works because both parts are identical. However, when referencing cores where the core name does not equal the package name (e.g. the Adafruit or STM32 cores), there is no way to actually reference such a core properly.
  • It also failed to handle a missing architecture, resulting in a segfault.

This PR fixes both problems, and additionally adds a testcase for ResolveFQBN that exposes these problems (and tests some other cases as well).

This adds tests for ResolveFQBN (which returns more details than the
FindBoardWithFQBN that was already tested), but also adds an extra
boards.txt with boards that are derived from another platform/core (i.e.
have `build.core=package:core`.

These new tests are currently failing, because of a bug and insufficient
error handling, which will be fixed in subsequent commits.
A core is referenced by specifying `build.core=package:core` in board
properties. However, the code used the second part (core) both for
looking up the the package, as well as for the core to use from that
package. The most commonly used core reference is `arduino:arduino`
which works because both parts are identical, which is probably why this
bug has not shown up before.

This commit fixes the bug by simply using the right part to look up the
package.
This used to say e.g.

	missing platform adafruit:referenced:avr required for build

where two packagenames (adafruit and referenced) were joined together
which makes no sense. Now, it just mentions the missing package, and the
fqbn that references it.
Before, when a platform was referenced through a `build.core` and the
package was present by the platform/architecure was missing, a
nullpointer was passed to GetInstalledPlatformRelease, which would
segfault.

Now, a proper error message is returned.
@CLAassistant
Copy link

CLAassistant commented Nov 1, 2019

CLA assistant check
All committers have signed the CLA.

@cmaglie cmaglie merged commit ef63c62 into arduino:master Nov 4, 2019
@cmaglie cmaglie added this to the 0.7.0 milestone Nov 4, 2019
@cmaglie
Copy link
Member

cmaglie commented Nov 4, 2019

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants