-
-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Issue #3635 Added the sketch folder to the path #3717
Conversation
Issue #3635 Added the sketch folder to the include path. ``` includeFolders.add(prefs.getFile("build.core.path")); includeFolders.add(sketch.getFolder()); if (prefs.getFile("build.variant.path") != null) ```
Just to understand this correct: If yes I'd definitely agree with the PR, havent tested it though. Can anyone trigger the bot to build this? Is there also a way to ignore the include if the config file is not inside the sketch folder? Like a default config? Or at least a proper error message when the file is not included? |
Thanks! You can use an #if defined() to detect the external header from the On Sat, Aug 22, 2015, 11:56 PM Nico [email protected] wrote:
|
But how can you detect a header? You need to include it before to detect it. But before the compiler will complain about a missing header. So this wont work here, the header needs to be there. What we need would be an order of priority here. so it first looks in the sketch and then inside the library. And also that a doubled name wont cause weird problems. |
@ArduinoBot build this please |
It doesn't fail silently. So it can be figured out. I have had it in MPIDE --Rick On Mon, Aug 24, 2015, 12:12 PM Matthijs Kooijman [email protected]
|
Meaning if you use the external settings option it is required to have it there. |
I want to note that this only works if the sketch is saved. Normally you can compile the sketch without saving. From the .ino sketch the .test file is always seen the most up to date (without saving) and the library will only recognize changes if the sketch is saved. Since this is bad for testing purposes (i normally dont save any debug stage) there needs to be further testing for this PR. Otherwise the function works as expected. But as said, if the file does not exists an inclusion error will pop up:
(this error/behavior has nothing to do with my alinkage PR since this build here has not included this fix. So the error is related to this PR only) |
I actually think that means that the temporary directory where all sketch files are preprocessed or copied to needs to be in the include path instead (the copying of extra files is a recent addition, I believe). |
includeFolders.add(sketchBuildFolder); Works for me without saving. Blathijs tip seemed correct. |
Good find. Should I update the pull request? On Tue, Aug 25, 2015, 11:57 AM Nico [email protected] wrote:
|
yes please. Use git add and then git commit --amend to edit the commit. git push --force to upload it again (in case you dont know how to do this ;) ) @matthijskooijman can you build this again then? :D |
I've tested this in three configurations on Mac OS X: I had a library that included the following file: I tested each configuration:
Renaming seams to work properly. --Rick On Tue, Aug 25, 2015 at 9:01 AM, Nico [email protected] wrote:
Co-founder |
I wrote a really quick test for the include library. I can modify it as --Rick On Tue, Aug 25, 2015 at 2:38 PM, Rick Anderson [email protected]
Co-founder |
I've now tried your example. The weird thing is, that my patch (2nd version) first worked and now seems to always throw a compiler error about the missing header file. I dont know why, its the same example I am using (yours). It worked 5min ago... However the problem still is that version 1 is not working correct unless you save the sketch. So this is not of any use for me. The best thing would be that it includes the user sketch preferred (if exists) and then tries to use the default config. Another option would be to globally try to include a file named "UserConfig.h" if it exists so any library can use this if desired, and if not the Arduino IDE somehow adds a wrapper for this (an empty file). This way you have a single file for all library settings which can be used for many libraries and always works the same. What about that? I havent tried version 3 as I dont think this is correct. I am not happy with any of these 3 solutions, sadly. I really like to see this feature (as I also need it right now for my libraries). |
So the issue is when creating a new sketch depending on the library then I'm sure I can find something for it. On Tue, Sep 1, 2015 at 11:04 AM, Nico [email protected] wrote:
Co-founder |
add
to your sketch. comment out th definition in the .h file. It wont be updated. That what I commented days ago already. Now my patch (2nd version) doesnt seem to work at all. It must be something trivial I think? --> yep somehow my change wasnt in the git anymore, there was no patch applied. no wonder that it didnt work. So well version2 still works better. If both path (lib and sketch) have the same header file, the libraries header is preferred. This way we cannot create a default setting. Otherwise that'd be perfect. |
Have a look at this: So it seems that version2 is correct and the file deletion is a general IDE bug. |
Good find. I can amend the pull request with option 2. Then start on On Tue, Sep 1, 2015, 12:55 PM Nico [email protected] wrote:
|
Oh. Hang on you took care of it. How about we can with your updated On Tue, Sep 1, 2015, 1:00 PM Rick Anderson [email protected]
|
Sure we can discuss it there any further. the bot is started to build so you can simply download the PR soon. Fixing the deletion issue would be a different issue which we could open. I just wanted some feedback from someone who knows the building system better than me, I might be wrong. |
Can go. On Tue, Sep 1, 2015, 1:01 PM Rick Anderson [email protected]
|
What do you mean? |
The new issue. You posted. Does it supersede mine? On Wed, Sep 2, 2015, 2:26 AM Nico [email protected] wrote:
|
Yeah it basically fixes the saving bug and adds a new Library.Setting.h option. I just opened a new PR to test this feature and build the IDE with that patch also, so we can compare. |
Superseded by arduino/arduino-builder#15 |
Issue #3635 Added the sketch folder to the include path.