Is there a way to list all files and their targets

2019-03-20 20:12发布

I am part of a project with multiple developers. The project contains multiple targets. VERY often, files are committed to the Xcode project repository with some targets not-included (careless programmers). So whenever i do a 'svn up', and run the app, my program crashes. I then have to look through all those files and see which one was committed with the missing target, then add the target, and recommit the file to the repository (for that careless programmer)

Is there some way through a script to either automatically add all .m to a particular target? OR list all the files that are missing for a particular target?

I have looked at Add files to an XCode project from a script for reference already.

3条回答
女痞
2楼-- · 2019-03-20 20:29

I did as Paul suggested and wrote a python script that inspects the .pbxproj and lists all the files and the targets they are included in. You could easily modify that script so that it highlights the files that are not included in specific targets. https://github.com/laurent74/XPFAT

查看更多
我想做一个坏孩纸
3楼-- · 2019-03-20 20:36

This question has been asked before, but neither did that question got an answer.

As far as I know, XCode does not have any build in support for comparing targets. However, the project is nothing more than an set of XML files... very detailed XML files though.. but still XML. What you could do (this is not something I recommend though) is read through the XML files of the project and try to understand how they are build.

I know this is not the answer you are looking for, but it might be a workaround.

Update
I read though project.pbxproj of a test project with two targets, and it seems as if the project is build up into references. Which is smart since one wouldn't have a huge file if you have many targets. However, it does mean that its really hard to read.

查看更多
贪生不怕死
4楼-- · 2019-03-20 20:47

My answer on this other thread shows you how to see all files that are not part of a target:

https://stackoverflow.com/a/12867723/591586

查看更多
登录 后发表回答