在利用shell编译xcode之前先熟悉一些常用的linux命令行
(1)当前目录命令
CURRENTPATH=`pwd`
(2)判断某一路径是否是文件夹
if [ ! -d "$DEVELOPER" ]; then
exit 1
fi
curl -O https://www.openssl.org/source/文件名
(4)创建某个路径下的某个文件夹
mkdir -p "${CURRENTPATH}/src"
(5)切换到某个路径下
cd "${CURRENTPATH}/src}"
(6)遍历数组中的内容
ARCHS="i386 x86_64 armv7 armv7s arm64"
for ARCH in ${ARCHS}
done
(7)拷贝某个路径下的文件到另一个路径
cp -R 文件A 路径B
(8)打印某个目录下 带有某个文件后缀的文件名
dir=$(ls -l $CURRENTPATH |awk '/^d/ {print $NF}')
for i in $dir
do
if [[ $i =~ \.xcodeproj$ ]]; then
ISVAILDPATH="ISTRUE"
TARGETNAME="${i%.*}"
echo "$TARGETNAME"
echo $i
fi
done
(9)xcode静态库打包
xcodebuild -target $TARGETNAME -configuration Release -sdk iphonesimulator -arch i386 -arch x86_64
xcodebuild -target $TARGETNAME -configuration Release -sdk iphoneos -arch armv7 -arch armv7s -arch arm64
(10)创建动态库并宝贝h文件
libtool -no_warning_for_no_symbols $LIBTOOL_FLAGS -o $FWNAME.framework/$FWNAME $RELEASEIPHONEA/$STATICLIBNAME $RELEASESIMULATORA/$STATICLIBNAME
cp -r $RELEASEIPHONEA/"include/$TARGETNAME"/* $FWNAME.framework/Headers/
(11)编译xcodexcodebuild -target targetName clean
xcodebuild -target targetName
xcrun -sdk iphoneos PackageApplication -v path/To/xxx.app -o xxx.ipa
第二部生成APP第三步生成可以发布的ipa