blob: e4f820df1e6b4ea79bff3eb53277500a62819ec1 (
plain)
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
#! /usr/bin/env bash
# Change VC10 project file for another example.
#
# -n <new name>
# -f <old-file>=<new-file> matched with trailing . (must have ext); multiple
# -x <new xsd command and options>
#
trap 'exit 1' ERR
function error ()
{
echo "$*" 1>&2
}
function uuid ()
{
uuidgen | sed -e 's#\(.*\)#\U\1#'
}
new=
xsd=
fop=
while [ $# -gt 0 ]; do
case $1 in
-n)
shift
new=$1
shift
;;
-f)
shift
o=`echo $1 | sed -e 's#\(.*\)=\(.*\)#\1#'`
n=`echo $1 | sed -e 's#\(.*\)=\(.*\)#\2#'`
echo "file change: $o.* -> $n.*"
fop="$fop -e s/$o\./$n./g"
shift
;;
-x)
shift
xsd=$1
shift
;;
-*)
error "unknown option: $1"
exit 1
;;
*)
break
;;
esac
done
if [ "$new" = "" ]; then
error '-n <new name> expected'
exit 1
fi
if [ "$xsd" = "" ]; then
error '-x <new xsd command and options> expected'
exit 1
fi
if [ "$1" = "" ]; then
error 'input file expected'
exit 1
fi
old=`echo "$1" | sed -e 's/\(.*\)-10.0.vcxproj/\1/'`
ext=`echo "$1" | sed -e 's/.*-\(10.0.vcxproj\)/\1/'`
echo "old name : $old"
echo "new name : $new"
echo "new xsd cmd: $xsd"
sed \
-e "s#<ProjectName>$old#<ProjectName>$new#" \
-e "s#<ProjectGuid>{.*}#<ProjectGuid>{`uuid`}#" \
-e "s#<RootNamespace>$old#<RootNamespace>$new#" \
-e "s#xsd.exe .* \([^ ][^ ]*\)</Command>#xsd.exe $xsd \1</Command>#" \
$fop \
$1 >$new-$ext
todos $new-$ext
sed \
-e "s#<UniqueIdentifier>.*#uuidgen | sed -e 's%\\\\(.*\\\\)% <UniqueIdentifier>{\\\\U\\\\1\\\\E}</UniqueIdentifier>%'#e" \
$fop \
$1.filters >$new-$ext.filters
todos $new-$ext.filters
|