使用命令行编译xcode项目并加入版本信息
xcodebuild -workspace ${SOLUTION_NANE} -scheme ${SCHEME_NAME} -configuration ${BUILD_CONFIRUATION}
example:
xcodebuild -workspace Test -scheme translate -configuration Release
那么如何查看你的工作空间有哪些scheme呢
先cd到工作空间目录下
xcodebuild -list
显示内容
Information about project "MakeFileTest":
Targets:
MakeFileTest
Build Configurations:
Debug
Release
If no build configuration is specified and -scheme is not passed then "Release" is used.
Schemes:
MakeFileTest
如果想要添加版本信息
echo 获取git版本号
svnInfoResult=`git rev-list HEAD --count`
svnVersion=${svnInfoResult##* }
DYLIB_CURRENT_VERSION="1.1.${svnVersion}"
DYLIB_COMPATIBILITY_VERSION="1.0.1"
GCC_PREPROCESSOR_DEFINITIONS="LIB_VERSION=\\\"${DYLIB_CURRENT_VERSION}\\\""
echo 编译代码
BUILD_SETTING=" -configuration $CONFIG DYLIB_CURRENT_VERSION=${DYLIB_CURRENT_VERSION} DYLIB_COMPATIBILITY_VERSION=${DYLIB_COMPATIBILITY_VERSION} GCC_PREPROCESSOR_DEFINITIONS=${GCC_PREPROCESSOR_DEFINITIONS} build"
xcodebuild -workspace ${SOLUTION_NANE} -scheme ${SCHEME_NAME} ${BUILD_SETTING}
DYLIB_CURRENT_VERSION表示当前版本
DYLIB_COMPATIBILITY_VERSION 表示最低兼容版本
example:
xcodebuild -workspace Test -scheme translate ${BUILD_SETTING}
还可以单独编译项目
xcodebuild -project translate.xcodeproj -target translate ${BUILD_SETTING}
本文作者:乘舟凉
本文链接:https://www.cnblogs.com/czlnb/p/15796051.html
版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步