iOS: Absolute project path with xcodebuild

2019-08-05 07:56发布

I use following command to build project using xcodebuild from the directory where .xcodeproj is.

admin$ xcodebuild install DSTROOT=. INSTALL_PATH=/bin

Could someone please tell me how to specify full path of .xcodeproj in xcodebuild command and run it from anywhere?

[EDIT]

...so you cannot specify absolute path of the project with xcodebuild command but you can specify where do you want your .app file placed like following. You need to run this command from the root project directory and you will be able to compile other sub projects without CD to their directories but you need to specify "scheme" that you are building.

admin$ xcodebuild install DSTROOT=/Users/admin/myProjectRoot INSTALL_PATH=/bin -scheme MySubProject1 -configuration Release -sdk iphonesimulator clean build

1条回答
我命由我不由天
2楼-- · 2019-08-05 08:16

According to the manpage for xcodebuild, you must launch "xcodebuild" from within the directory where your project is. I.E. the specific line that clarifies that is:

To build an Xcode project, run xcodebuild from the directory containing your project (i.e. the directory containing the projectname.xcodeproj package).

And if there are multiple projects within that directory, that's when you can use the "-project projectname" command line parameter.

In my own build scripts, I "cd" to the folder where the project lives before calling "xcodebuild".

查看更多
登录 后发表回答