-
Notifications
You must be signed in to change notification settings - Fork 1
/
generate_h.sh
executable file
·59 lines (53 loc) · 1.11 KB
/
generate_h.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env bash
h_file=".h"
debug_path="/build/intermediates/classes/debug"
this_dir=`pwd`
function inform {
echo "Usage: ./generate_h.sh -m moduleName -c className -p outPath"
}
function generate_h_file {
module=$1
class_name=$2
out_path=$3
cd ${module}${debug_path}
javah -classpath . -jni ${class_name}
cd ${this_dir}
mkdir -p ${out_path}
mv ${module}${debug_path}/${class_name//\./_}${h_file} ${out_path}
}
mn="null"
cn="null"
op="null"
while getopts "m:c:p:" optname
do
case "$optname" in
"m")
echo "module: $OPTARG"
mn=$OPTARG
;;
"c")
echo "class name: $OPTARG"
cn=$OPTARG
;;
"p")
echo "out path: $OPTARG"
op=$OPTARG
;;
*)
echo "Unknown error while processing options $optname $OPTARG"
;;
esac
done
if [ ${mn} = "null" ]; then
inform
exit
fi
if [ ${cn} = "null" ]; then
inform
exit
fi
if [ ${op} = "null" ]; then
inform
exit
fi
generate_h_file ${mn} ${cn} ${op}