-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmk_modulemap.sh
executable file
·45 lines (38 loc) · 1.35 KB
/
mk_modulemap.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
# 脚本出处:https://github.com/madordie/Demo-PodspecUseBMK
# 自动生成modulemap脚本
# 接受一个路径list
# 并遍历list所有的framework,然后补全缺失的module.modulemap
# 创建modulemap文件,接收一个后缀为.framework的路经
function mk_map(){
framework=$1
framework_name=`basename $framework .framework`
# 确保该路径为framework
if [[ $framework =~ ".framework\$" ]]; then
return
fi
if [ ! -d $framework/Modules ]; then
mkdir $framework/Modules
fi
# 确保没有已存在的module.modulemap
if [ -f $framework/Modules/module.modulemap ]; then
return
fi
echo "framework module $framework_name {" >> $framework/Modules/module.modulemap
if [ -f $framework/Headers/$framework_name-umbrella.h ]; then
echo " umbrella header \"$framework_name-umbrella.h\"" >> $framework/Modules/module.modulemap
else
filelist=`ls $framework/Headers`
for file in $filelist ; do
echo " header \"$file\"" >> $framework/Modules/module.modulemap
done
fi
echo " export *" >> $framework/Modules/module.modulemap
echo "}" >> $framework/Modules/module.modulemap
}
for path in $* ; do
for framework in `find $path -name "*.framework"`; do
mk_map $framework
done
done
echo "Append modulemap done"