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

Include library paths used by libraries in the compiler search path (take 2) #1726

Closed
wants to merge 6 commits into from

Conversation

cmaglie
Copy link
Member

@cmaglie cmaglie commented Dec 9, 2013

Originally started by @giseburt on #1250

This pull fixes a case where libraries that a sketch uses indirectly (other libraries is uses require them) need to be included directly in order to compile.
It is necessary to #include a library's file in your sketch in order for the IDE to add that library's path to the compiler command line. This patch searches the files that are included as well, adding dependent libraries to the search path. This removes then need to directly #include indirectly used libraries.

It takes into account also Matthijs suggestion:

  • Reuse include extraction from preprocessor
  • Recursively find dependencies (libA that uses libB that uses libC)

Moreover:

  • I added a "resolvedDependency" field in Library class to store libraries dependencies.
  • I see that we should inspect also .c/.cpp files to search for dependencies, only .h headers sometimes are not sufficient.
  • The "importToLibraryTable" was moved into a LibraryResolver for convenience.
  • I've left a debug message that shows all the "detected" dependencies at startup, it will be removed when merged.
  • The patch is structured to be easily adapted to whatever changes we decide to make to 1.5 lib format.

BTW, I'm still not fully convinced about this patch, more tests welcome.

C

@matthijskooijman
Copy link
Collaborator

Code looks good. I added some inline comments in the last commit. I have some other thoughts on the code structure, but those depend a bit on how the 1.5 library layout will turn out (I have some thoughts about this as well, I'm hoping to write a proposal for an improved layout somewhere this week).

I'll perhaps pull your code later today to do some testing as well.

@matthijskooijman
Copy link
Collaborator

One more thing: These patches don't fix #636 yet, right? I don't hink .cpp and .h files inside a sketch are now inspected by the preprocessor?

matthijskooijman added a commit to Pinoccio/library-pinoccio that referenced this pull request Jan 22, 2014
Since the Arduino IDE doesn't do recursive library dependencies yet
(arduino/Arduino#1726), we'll have to include
all of these explicitely.
@matthijskooijman
Copy link
Collaborator

For the record, this pullrequest fixes #236.

Merge branch 'ide-1.5.x' into lib-import
@cmaglie
Copy link
Member Author

cmaglie commented Aug 29, 2014

Outdated with #2174

@cmaglie cmaglie closed this Aug 29, 2014
@cmaglie cmaglie deleted the lib-import branch August 29, 2014 22:08
@cmaglie cmaglie added 1.5 and removed Core labels Aug 29, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: IDE The Arduino IDE feature request A request to make an enhancement (not a bug fix)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants