简体   繁体   English

如何在命令行上从Xcode项目获取应用程序路径名?

[英]How to get the app path name from an Xcode project on the command line?

I'm writing a build script to compile and package my app, and I'd like a nice way to get the full path name of the .app created. 我正在编写一个构建脚本来编译和打包我的应用程序,并且我想要一个很好的方法来获取创建的.app的完整路径名。 I can't find any command line tools other than xcodebuild , which doesn't appear to have much in the way of inspecting an Xcode project. 除了xcodebuild ,我找不到任何其他命令行工具,该工具似乎没有太多检查Xcode项目的方式。 My full compile command is 我完整的编译命令是

xcodebuild -sdk iphoneos2.2.1

so it'll build with the default configuration, and I don't want to hard-code the .app filename in (although it'll be something like build/<config>iphoneos/<name>.app ). 因此它将以默认配置进行构建,并且我不想将.app文件名硬编码(尽管它类似于build/<config>iphoneos/<name>.app )。 Currently, I'm parsing the output from the xcodebuild command and grabbing the line 当前,我正在解析xcodebuild命令的输出并抓取一行

CodeSign (.*)

which works correctly, but seems like an awfully roundabout way of doing it. 可以正常工作,但似乎是一种round回的方式。 Is there another command line tool to do this, or at least an easier way than my solution? 是否有其他命令行工具可以执行此操作,或者至少比我的解决方案更简单?

Tough to say since the build location can be project/target specific or a global preference that's never explicitly set anywhere in the project file. 很难说,因为构建位置可以是特定于项目/目标的,也可以是从未在项目文件中的任何位置显式设置的全局首选项。

Never tried it, but maybe add a Run Script build phase to your project that simply prints the environment to stdout and parse that? 从来没有尝试过,但是也许在您的项目中添加了一个“运行脚本”构建阶段,该阶段仅打印环境以进行标准输出并进行解析?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM