Skip to content

Relax library matching rules when detecting libraries #210

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

Merged
merged 6 commits into from
Feb 1, 2017

Conversation

cmaglie
Copy link
Member

@cmaglie cmaglie commented Jan 31, 2017

This allows to set the correct library priority, for example, if the library is named "My Library" but the include file is "my_library.h".

/cc @matteosuppo @facchinm

Signed-off-by: Cristian Maglie <c.maglie@arduino.cc>
markImportedLibrary is lost after function returns so it's useless
to update it just before returning.

Signed-off-by: Cristian Maglie <c.maglie@arduino.cc>
Even when there is only one candidate library for a particular header
we should always check if the library is already included.

Signed-off-by: Cristian Maglie <c.maglie@arduino.cc>
It may have had its purposes in the past, but now it's basically useless
since it's only used to cycle in `for... range` loops.

Signed-off-by: Cristian Maglie <c.maglie@arduino.cc>
Signed-off-by: Cristian Maglie <c.maglie@arduino.cc>
This allows to set the correct library priority, for example, if
the library is named "My Library" but the include file is "my_library.h".

Signed-off-by: Cristian Maglie <c.maglie@arduino.cc>
@cmaglie cmaglie force-pushed the improve-lib-matching branch from 49fc46b to aea468e Compare January 31, 2017 16:15
Copy link
Collaborator

@matthijskooijman matthijskooijman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

if len(libraries) == 1 {
return libraries[0]
}

if markImportedLibraryContainsOneOfCandidates(markImportedLibrary, libraries) {
return nil
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this should actually never occur at all, if the header is available, it is never returned as missing by the preprocessor (this was different when include scanning was still regex-based instead of preprocessor-based). Keeping this if in might be a good idea, though, but perhaps it should be marked as "just in case" with a comment.

@cmaglie cmaglie merged commit f742438 into arduino:master Feb 1, 2017
@cmaglie cmaglie deleted the improve-lib-matching branch February 1, 2017 14:43
@cmaglie cmaglie modified the milestone: 1.3.24 Feb 1, 2017
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.

3 participants