User Header Search Paths Modified When Auto-importing Class/Header

So, I have strange issue. It's also really annoying and shouldn't be happening.

The issue is that I have my header search paths set to how they need to be. They have been set up since the beginning of my project. So, the compiler finds everything it needs. But, now AppCode is modifying my build settings when auto-importing a file.  This seems to be part of the lastest build OC-121.35.  

Here is the scenario:

I am using a framework called RestKit in my project. The project is part of my workspace and the code is also there. For example, my header search path (not USER header search path) is set as:

"$(BUILT_PRODUCTS_DIR)/../../Headers":"$(SOURCE_ROOT)/../passcodelock/PasscodeLock"

That is all good. But, I was editing a class and wanted to use a class called RKRequestSerialization.  So, I typed in the name and the auto-import dialog popped up asking if I wanted to import it. I say "yes".  But, instaed of including the file like this:

#import "RestKit/RKRequestSerialization.h"

It did two things badly. First it wrote this:

#import "RKRequestSerialization.h"

Then it did the horrible thing of adding these lines to my project file, here is a diff so you can see what was modified:

@@ -2499,6 +2485,7 @@

 PROVISIONING_PROFILE = "";

 "PROVISIONING_PROFILE[sdk=iphoneos*]" = "";

 SKIP_INSTALL = NO;

+ USER_HEADER_SEARCH_PATHS = "\"${PROJECT_DIR}/../RestKit\"/**";

 WRAPPER_EXTENSION = app;

 };

 name = Debug;

@@ -2524,6 +2511,7 @@

 PRODUCT_NAME = "$(TARGET_NAME)";

 PROVISIONING_PROFILE = "";

 SKIP_INSTALL = NO;

+ USER_HEADER_SEARCH_PATHS = "\"${PROJECT_DIR}/../RestKit\"/**";

 WRAPPER_EXTENSION = app;

 };


So, the issue is now the compiler failes miserably because there are now duplicate definitions of the headers on the path.  I do not believe AppCode should be modifying the paths like this. This took me an hour to figure out what the heck was happening. Mucking around with a project file is not a fun thing as I had many changes to that file and I couldn't roll it back. Luckily I was just able to open Xcode to find it easily and remove it.

Is this an error?  Do I have my project set up incorrectly in the first place?  I just don't like it (AppCode) modifying this file like this.  The auto-import causes an ugly side-effect too. The application locks up (for a short time) because it modified the project file, then switches to its indexing mode and locks the user form using the app for that time.


1 comment
Comment actions Permalink

Marc,

thanks for detailed description.
Here is that, most likely, caused this problem:
AppCode resolves available headers from the HEADERS_SEARCH_PATH and USER_HEADERS_SEARCH_PATH.
From your description I understand, that the RestKit headers are located in $(BUILT_PRODUCTS_DIR)/../../Headers folder.
If, when you edited the code, in this folder there were no headers, AppCode would check the project root, find available headers for the class and suggest them to import.
When you chose to import it, AppCode added the corresponding search path to the list.

This is only a theory, to understand that happened expactly (and to be able to fix the problem(, we need more information:
* where the RKRequestSerialization.h is located relatively to project's root
* is it included to the project
* where the file you edited is located
* where $(BUILT_PRODUCTS_DIR)/../../Headers points
* whether $(BUILT_PRODUCTS_DIR)/../../Headers contained the RestKit headers or not.

a sample project would be great and we'll be able to quickly fix the issue.

BTW, how does build fails? Normally it resolves headers just fine, even if there are duplicates - it just takes the first one.

I've created a bug report for you: http://youtrack.jetbrains.com/issue/OC-5023
Please continue discussion there.

0

Please sign in to leave a comment.