-
-
Save wangzz/7260ba2ffaa2b201a950 to your computer and use it in GitHub Desktop.
记录有用的脚本
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
记录有用的脚本 |
合并真机和模拟器都兼容的静态库:
#静态库
# Sets the target folders and the final framework product.
FMK_NAME=${PROJECT_NAME}
# Install dir will be the final output to the framework.
# The following line create it in the root folder of the current project.
INSTALL_DIR=${SRCROOT}/Products
# Working dir will be deleted after the framework creation.
WRK_DIR=build
DEVICE_DIR=${WRK_DIR}/Release-iphoneos
SIMULATOR_DIR=${WRK_DIR}/Release-iphonesimulator
# Building both architectures.
xcodebuild -configuration "Release" -target "${FMK_NAME}" -sdk iphoneos
xcodebuild -configuration "Release" -target "${FMK_NAME}" -sdk iphonesimulator
# Cleaning the oldest.
if [ -d "${INSTALL_DIR}" ]
then
rm -rf "${INSTALL_DIR}"
fi
mkdir -p "${INSTALL_DIR}"
# Uses the Lipo Tool to merge both binary files (i386 + armv6/armv7) into one Universal final product.
lipo -create "${DEVICE_DIR}/lib${FMK_NAME}.a" "${SIMULATOR_DIR}/lib${FMK_NAME}.a" -output "${INSTALL_DIR}/lib${FMK_NAME}.a"
rm -r "${WRK_DIR}"
编译并生成ipa文件到指定目录:
# target name.
TARGET_NAME="AMapiPhone"
# product dir will be the final output to the ipa.
PRODUCT_DIR=~/Desktop/Products
# final ipa name,for example:"AMapiPhone_20140717_11:58:12.ipa"
IPA_NAME=${TARGET_NAME}_$(date +%Y%m%d_%H:%M:%S).ipa
# go to svn root dir
cd /Users/wangzz/studio/iosapp
# update code
svn up
if [ $? != 0 ]
then
echo "**************SVN UPDATE FAILED**************"
exit 1
fi
# go to .xcodeproj file dir
cd /Users/wangzz/studio/iosapp/apps/AMapiPhone
# clean and building
xcodebuild -configuration "Release" -target "${TARGET_NAME}" -sdk iphoneos CODE_SIGN_IDENTITY="iPhone Developer: weizheng li (P7QJ74LFSA)" PROVISIONING_PROFILE="91F9FF0C-ACFD-4DE5-8A0B-934C77F4437B" clean build
if [ $? != 0 ]
then
echo "**************BUILD FAILED**************"
exit 1
fi
# cleaning the oldest.
if [ -d "${PRODUCT_DIR}" ]
then
rm -rf "${PRODUCT_DIR}"
fi
# create result dir
mkdir -p "${PRODUCT_DIR}"
# build dir will be deleted after the ipa creation.
BUILD_DIR=~+/build/Release-iphoneos
# build result .app file
APP_DIR=${BUILD_DIR}/${TARGET_NAME}.app
echo "**************IPA CREATE BEGIN**************"
# create .ipa file
xcrun -sdk iphoneos PackageApplication -v "$APP_DIR" -o "${PRODUCT_DIR}/${IPA_NAME}"
if [ $? != 0 ]
then
echo "**************IPA CREATE FAILED**************"
exit 1
fi
echo "**************IPA CREATE SUCCESS**************"
# clear build file
rm -r "${BUILD_DIR}"
cd -
提交博客
cd /Users/wangzz/octopress
bundle exec rake generate
if [ $? != 0 ]
then
echo "**************RAKE GENERATE FAILED**************"
exit 1
fi
git add --all .
git commit -m $1
git push origin source
bundle exec rake deploy
if [ $? != 0 ]
then
echo "**************RAKE DEPLOY FAILED**************"
exit 1
fi
echo "**************BLOG DEPLOY SUCCESS**************"
#添加 gitcafe 源
cd /Users/wangzz/octopress/_deploy
git remote add gitcafe git@gitcafe.com:wangzz/wangzz.git >> /dev/null 2>&1
#提交博客内容
echo "### Pushing to GitCafe..."
git push -u gitcafe master:gitcafe-pages
echo "### Done"
cd -
- 示例
$ ./deploy "MOD:完善iOS屏幕旋转学习笔记"
同样可以使用xctool编译、生成ipa包
- 安装xctool
$ brew install xctool
- 执行脚本
切换到工程根目录下
# build.sh
# SOSOMap
#
# Created by wangzz on 14-8-15.
# Copyright (c) 2014年 wangzz. All rights reserved.
BUILD_DIR=/Users/wangzz/Desktop/tmp/build
PRODUCT_DIR=/Users/wangzz/Desktop/tmp/product
SCHEME_NAME=SOSOMap
APP_DIR=${BUILD_DIR}/${SCHEME_NAME}.app
rm -rf BUILD_DIR
rm -rf PRODUCT_DIR
xctool -scheme $SCHEME_NAME -arch armv7 TARGET_BUILD_DIR="$BUILD_DIR" -sdk iphoneos CODE_SIGN_IDENTITY="iPhone Developer: weizheng li (P7QJ74LFSA)" PROVISIONING_PROFILE="91F9FF0C-ACFD-4DE5-8A0B-934C77F4437B" clean build
# create .ipa file
xcrun -sdk iphoneos PackageApplication -v "$APP_DIR" -o "${PRODUCT_DIR}/${SCHEME_NAME}.ipa"
if [ $? != 0 ]
then
echo "**************IPA CREATE FAILED**************"
exit 1
fi
echo "**************IPA CREATE SUCCESS**************"
#xcodebuild -target SOSOMap
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
合并真机和模拟器都兼容的framework: