-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c048d8f
commit 3b76581
Showing
9 changed files
with
849 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# LSiOSShell | ||
iOS shell相关脚本 | ||
### build_framework.sh 打包framework或.a静态库。并合成真机和模拟器 | ||
sh build_framework.sh xcodeproj所在目录 Debug/Release | ||
``` | ||
//参数二不传默认Release | ||
sh build_framework.sh /Users/liusong/Documents/TestFramework Debug | ||
``` | ||
如果主工程不是静态库/动态库(即主工程是测试demo,其他target是静态库、动态库),可以 sh build_framework.sh xcodeproj目录 Debug/Release 静态库/动态库target名称 | ||
``` | ||
//指定targetName情况 必须指定是Debug或Release 不可省略此参数 | ||
sh build_framework.sh /Users/liusong/Documents/TestFramework Debug FrameworkA | ||
``` | ||
|
||
### dumpcarsh.sh 解析.crash文件 利用系统自带的symbolicatecrash | ||
- sh dumpcarsh.sh crash文件 (解析后生成一个.txt文件在.crash同目录) 会自动从电脑 用户目录下寻找匹配的dSYM文件 | ||
|
||
``` | ||
sh dumpcrash.sh /Users/liusong/Desktop/xxxxx2019-7-1,6-18PM.crash | ||
``` | ||
|
||
- 如果想指定dSYM,则传第二个参数为dSYM | ||
|
||
``` | ||
sh dumpcrash.sh /Users/liusong/Desktop/xxxxx2019-7-1,6-18PM.crash xxx.dSYM | ||
``` | ||
|
||
> 如果电脑上不存在此系统的符号库,系统符号可能解析不出来 | ||
> | ||
> 所以可以在此链接下载对应的系统符号 链接:https://pan.baidu.com/s/1HxS7HXH1vH0hBJ4L52lTow 密码:wbv2 | ||
> | ||
> 解压完,复制到路径 ~/Library/Developer/Xcode/iOS DeviceSupport/ 即可。 | ||
|
||
|
||
- crash有两种格式 下面是另外一种唤醒次数过多crash一个原因描述,此种类型需再次解析Heaviest stack,此脚本会自动解析Heaviest stack | ||
|
||
> Wakeups: 45001 wakeups over the last 48 seconds (934 wakeups per second average), exceeding limit of 150 wakeups per second over 300 seconds | ||
> | ||
> 2.Wakeups: 45002 wakeups over the last 267 seconds (169 wakeups per second average), exceeding limit of 150 wakeups per second over 300 seconds | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
#!/bin/bash | ||
|
||
# sh build_framework.sh xcodeproj所在目录 Debug/Release | ||
|
||
cd $1 | ||
|
||
echo "dir:"$1 | ||
|
||
#要build的target名 | ||
target_Name=`ls | grep .xcodeproj | head -1` | ||
target_Name=${target_Name%.xcodeproj} | ||
if [[ "$3" != "" ]];then | ||
target_Name=$3; | ||
fi | ||
|
||
echo "target_Name:"$target_Name | ||
|
||
result=`xcodebuild -showBuildSettings -target $target_Name | grep WRAPPER_EXTENSION | head -1 | grep framework 2>/dev/null` | ||
isFramework=0; | ||
if [ "$result" != "" ];then | ||
isFramework=1 | ||
fi | ||
echo "isFramework:"$isFramework | ||
|
||
#编译模式 Release、Debug | ||
build_model="Release" | ||
if [[ "$2" != "" ]];then | ||
build_model=$2; | ||
fi | ||
echo "build_model:"$build_model | ||
|
||
#压缩后的文件名 | ||
build_date_string=`date +'%Y%m%d%H%M%S'` | ||
|
||
#导出sdk地址 /Users/liusong/Desktop/allFrameworks/TestFramework/Release_XXXX_2019010101.zip | ||
exportSdkPath=~/Desktop/allFrameworks/${target_Name} | ||
|
||
#log文件 | ||
log_file=${exportSdkPath}/logs/${build_date_string}.log | ||
mkdir -p ${exportSdkPath}/logs | ||
|
||
|
||
#获取工程当前所在路径 | ||
project_path=$(pwd) | ||
|
||
|
||
#编译文件路径 | ||
buildPath=${project_path}/build | ||
|
||
#删除build文件 | ||
if [ -d ${buildPath} ]; then | ||
rm -rf ${buildPath} | ||
fi | ||
|
||
|
||
iphoneos_path="" | ||
simulator_path="" | ||
|
||
if [ "$isFramework" = "1" ];then | ||
#真机产物输出路径 | ||
iphoneos_path=${buildPath}/${build_model}-iphoneos | ||
#模拟器产物输出路径 | ||
simulator_path=${buildPath}/${build_model}-iphonesimulator | ||
else | ||
#真机产物输出路径 | ||
iphoneos_path=${buildPath}/${build_model}-iphoneos | ||
#模拟器产物输出路径 | ||
simulator_path=${buildPath}/${build_model}-iphonesimulator | ||
fi | ||
|
||
|
||
if [ ! -d $exportSdkPath ]; then | ||
mkdir -p $exportSdkPath; | ||
fi | ||
|
||
|
||
#build之前clean一下 | ||
xcodebuild -target ${target_Name} clean 1>$log_file | ||
|
||
#模拟器build | ||
xcodebuild -target ${target_Name} -configuration ${build_model} -sdk iphonesimulator 1>$log_file | ||
|
||
#真机build | ||
xcodebuild -target ${target_Name} -configuration ${build_model} -sdk iphoneos 1>$log_file | ||
|
||
#新建临时目录用于压缩使用 | ||
temp_path="temp_path" | ||
sdk_zip_name=${target_Name}-${build_date_string}-${build_model}.zip | ||
|
||
##合并模拟器和真机Mach-O | ||
if [ "$isFramework" = "1" ];then | ||
lipo -create ${iphoneos_path}/${target_Name}.framework/${target_Name} ${simulator_path}/${target_Name}.framework/${target_Name} -output ${iphoneos_path}/${target_Name}.framework/${target_Name} | ||
mkdir -p ${buildPath}/${temp_path} | ||
cp -rf ${iphoneos_path}/ ${buildPath}/${temp_path}/ | ||
|
||
else | ||
lipo -create ${iphoneos_path}/lib${target_Name}.a ${simulator_path}/lib${target_Name}.a -output ${iphoneos_path}/lib${target_Name}.a | ||
mkdir -p ${buildPath}/${temp_path}/${target_Name} | ||
cp -rf ${iphoneos_path}/ ${buildPath}/${temp_path}/${target_Name}/ | ||
|
||
fi | ||
|
||
#压缩sdk输出路径下的所有文件 | ||
cd ${buildPath}/${temp_path} | ||
zip -rq ${exportSdkPath}/${sdk_zip_name} ./* | ||
echo "完成-------" | ||
echo "${exportSdkPath}/${sdk_zip_name}" | ||
|
||
#删除build文件 | ||
if [ -d ${buildPath} ]; then | ||
rm -rf ${buildPath} | ||
fi | ||
|
||
|
||
|
||
|
Oops, something went wrong.