1

I have a nested group of dozens of files (as described in this question), and I'd like to apply some custom build settings to all and only those files.

This was trivial in Xcode 3.

In Xcode 4, although I couldn't find anything in the documentation, I found a workaround: if you can select all of the files you want to change in the Compile Sources list (which happens to work for me because all of the files in my group have the same namespace prefix, and only one other file in the project shares it, so I can search for the prefix, select all, then deselect the one extra file), then hit Return, it will pop up the compile settings dialog for all selected files. (Double-clicking, context menu, etc. doesn't work, only Return.) (From a quick search, I found the same workaround discussed in this question.)

In Xcode 5 and 6, that workaround no longer works; selecting the files and hitting Return (or Fn+Enter, or double-clicking, or right-clicking or anything else I can think of) has no effect.

I've tried using AppleScripting to do this, but, as with my previous problem, I can't get past the fact that any attempt to access the build files of a build phase object returns a generic -10000 error… So, unless there's actually a solution, it looks like I'll be writing a script to parse the pbxproj as a plist again, which I'd really like to avoid.

Community
  • 1
  • 1
abarnert
  • 354,177
  • 51
  • 601
  • 671

1 Answers1

0

As of Xcode 6.1, Yes

I just tested this in Compile Sources in Xcode 6.1, and I can

  1. custom select on a search
  2. edit the compile settings for the selected files

But if not...

Your last line was about writing a parser for pbxproj, I thought I would recommend Ruby-based tool for that, Xcodeproj. In their own words,

Create and modify Xcode projects from Ruby.

It is an integral part of CocoaPods, and therefore very actively used and maintained.

Clay Bridges
  • 11,602
  • 10
  • 68
  • 118
  • Can you please provide more detail on what you mean? I'm in Xcode 6.1, I've selected my project in the nav panel, selected my target in the sidebar, selected Build Phases, opened Compile Sources, and… where do I "custom select on a search" exactly? I've tried right-clicking Compile Sources itself and in the file list, and looked through the menus, and can't find anything. I've also tried selecting the group or its contents in the nav panel, but that has nothing to do with what ends up selected in the Compile Sources list. – abarnert Nov 04 '14 at 19:44
  • I can see how, as of 6.1, if I manage to get the right files selected in Compile Sources, I will be able to add custom compiler flags by using Return or double-clicking, similar to the custom settings dialog in 4.x (although not as user-friendly—you only get to add a flag, not change any setting—at least usable). And ultimately, that's enough to get what I need. But if there's a way to not have to manually select the 78 sources from the group manually, which your answer seems to imply, that would be a whole lot nicer. – abarnert Nov 04 '14 at 19:45