为了做些自动化打包的东西,思路想歪了整了份这样的脚本
执行文件名字,一般跟创建工程文件夹名字相同
EXECUTABLE_NAME="${EXECUTABLE_NAME}"
echo $EXECUTABLE_NAME > /Users/derkin/Desktop/test3/HelloWorld/test.txt
echo "testtte" > /Users/derkin/Desktop/test3/testtte.txt
工程目录路径
PROJECT_DIR="${PROJECT_DIR}"
EXECUTABLE_NAME="${EXECUTABLE_NAME}"
工程plist路径
project_infoplist_path="${PROJECT_DIR}/${EXECUTABLE_NAME}/Info.plist"
echo $project_infoplist_path > ${PROJECT_DIR}/${EXECUTABLE_NAME}/project_infoplist_path.txt
echo $project_infoplist_path > /Users/derkin/Desktop/test3/infoplist.txt
编译时间
buildTime=date +%Y-%m-%d'+'%H:%M
echo $buildTime > ${PROJECT_DIR}/${EXECUTABLE_NAME}/buildTime.txt
echo $buildTime > ${PROJECT_DIR}/buildTime.txt
修改的命令行
modifyCmdString="'""Set :buildTime"" "${buildTime}"'"
echo $modifyCmdString
destinationCmd="/usr/libexec/PlistBuddy -c "${modifyCmdString}" ${project_infoplist_path}"
echo "cmd :\n "${destinationCmd}
执行plistbuddy处理方法
a="/usr/libexec/PlistBuddy"
a2="-c"
b="'Set :buildTime ${buildTime}'"
c="${project_infoplist_path}"
eval ${a}" "${a2}" "${b}" "${c}
网友评论