-
Notifications
You must be signed in to change notification settings - Fork 8
/
.exportlib.sh
executable file
·75 lines (57 loc) · 1.28 KB
/
.exportlib.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
outlocation="./slib"
libname="PhWidgets"
libfullname="Photon Widgets"
echo "\023331;0m"
echo "\023333;4m"
print $(basename $0)
print " "
print "Export $libfullname library"
print_usage(){
print " "
print "Usage: $(basename $0) <destination project directory>"
}
get_phab_prjct_name(){
if [ -f "$1/$(basename $1).ldb" ]; then
if [ -f "$1/abapp.dfn" ]; then
echo "$(basename $1)";
fi
fi
echo ""
}
get_full_dir(){
echo "$( cd "$( dirname "$1" )" && pwd)/$(basename "$1")"
}
if [ ! $1 ]; then
print_usage;
exit
fi
destination=$(get_full_dir $1)
if [ ! -d "$destination" ]; then
print "$destination is not a valid directory"
print_usage;
exit
fi
if [ ! -d "$outlocation" ]; then
print "Make library first"
exit
fi
if [ $(basename $destination) == "src" ]; then
destination=$(dirname $destination);
fi
prjctname=$(get_phab_prjct_name $destination)
if [ prjctname == "" ]; then
destination=$(get_full_dir $1)
print " "
print "> Copy library to folder $destination"
cp -r "$outlocation/" "$destination"
else
print " "
print "> Copy library to project $prjctname ($destination)"
cp -r "$outlocation/." "$destination/src/"
print "Done <"
print " "
print "> Make links to $libname library"
cd "$destination/src/$libname/" && "./.linklib.sh"
fi
print "Done <"
print " "