iOS 静态库自动打包,使用 shellcmd 脚本如何写 # 获取脚本所在目录 filepath=$(cd "$(dirname "$0")"; pwd)"/" cd $filepath cd .. # 工程target,主要配置这个target即可 targetname="SafeToolSDK" # 工程目录(默认工程目录在脚本目录的上一级目录) projectdir=$(pwd)"/" echo $projectdir # 工程名 projectname="SafeToolSDK.xcodeproj" # lib输出目录 buildDir=$filepath echo $buildDir #lib输出名 libname=$targetname iossdknum=$(xcodebuild -showsdks | grep iphoneos | grep -Eo '[0-9.]+' | sed -n '1p') configurationname="Release" mydir=$filepath$libname"/" rm -rf $mydir mkdir $mydir # arm64 archname="arm64" lib64=$libname"64" echo "archname:$archname" xcodebuild -project $projectdir$projectname -configuration $configurationname -target $targetname -sdk "iphoneos$iossdknum" -arch $archname BUILD_DIR=$buildDir clean xcodebuild -project $projectdir$projectname -configuration $configurationname -target $targetname -sdk "iphoneos$iossdknum" -arch $archname BUILD_DIR=$buildDir libpath=$buildDir"/Release-iphoneos/"$libname".framework" lib64path=$mydir$lib64 mv -f $libpath"/"$libname $lib64path # armv7 archname="armv7" libv7=$libname"v7" echo "archname:$archname" xcodebuild -project $projectdir$projectname -configuration $configurationname -target $targetname -sdk "iphoneos$iossdknum" -arch $archname BUILD_DIR=$buildDir clean xcodebuild -project $projectdir$projectname -configuration $configurationname -target $targetname -sdk "iphoneos$iossdknum" -arch $archname BUILD_DIR=$buildDir libpath=$buildDir"/Release-iphoneos/"$libname".framework" libv7path=$mydir$libv7 mv -f $libpath"/"$libname $libv7path # armv7s archname="armv7s" libv7s=$libname"v7s" echo "archname:$archname" xcodebuild -project $projectdir$projectname -configuration $configurationname -target $targetname -sdk "iphoneos$iossdknum" -arch $archname BUILD_DIR=$buildDir clean xcodebuild -project $projectdir$projectname -configuration $configurationname -target $targetname -sdk "iphoneos$iossdknum" -arch $archname BUILD_DIR=$buildDir libpath=$buildDir"/Release-iphoneos/"$libname".framework" lib
2021-05-07 11:29:06 4KB shell静
1