-
Notifications
You must be signed in to change notification settings - Fork 4
/
generate.assembly.worker.sh
executable file
·117 lines (79 loc) · 1.99 KB
/
generate.assembly.worker.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/usr/bin/env bash
#
# This tool is designed to be called from a separate script for each component assembly
#
#
# Exit when any command fails
#
set -e
#
# Identify target assembly
#
if [ "$1" == "" ]; then
echo "cmd parameter 1 : Assembly name missing"
exit 1
fi
ASSEMBLY=$1
#
# Set assembly root path
#
if [ "$2" == "" ]; then
ASM_PATH="/Library/Frameworks/Mono.framework/Libraries/mono/4.5"
else
ASM_PATH=$2
fi
#
# Welcome
#
echo "XML and bindings will be generated in the current directory."
MY_PATH=`pwd`
echo "Current directory = ${MY_PATH}"
#
# Set Dubrovnik tool exe relative paths
#
REFLECTOR_EXE="../../dotNET/Dubrovnik.Tools/Dubrovnik.Reflector/bin/Debug/Dubrovnik.Reflector.exe"
GENERATOR_EXE="../../dotNET/Dubrovnik.Tools/Dubrovnik.Generator/bin/Debug/Dubrovnik.Generator.exe"
echo ""
echo "Reflector tool : ${REFLECTOR_EXE}"
echo "Generator tool : ${GENERATOR_EXE}"
#
# Generate assembly reflection XML file using the Dubrovnik reflector tool
#
REF_INPUT_FILE=${ASM_PATH}/${ASSEMBLY}.dll
REF_OUTPUT_FILE=${MY_PATH}/${ASSEMBLY}.xml
echo ""
echo "Generating reflection XML file"
echo ""
#
# Delete exiting target XML file
#
if [ -f "${REF_OUTPUT_FILE}" ]; then
echo "Deleting ${REF_OUTPUT_FILE}"
rm "${REF_OUTPUT_FILE}"
fi
#
# Run the reflector to generate assembly XML
#
mono "${REFLECTOR_EXE}" -i "${REF_INPUT_FILE}" -o "${MY_PATH}" -v true
#
# Generate Obj-C code bindings using the Dubrovnik generator tool.
# The input is the file generated by the reflector tool above.
#
GEN_INPUT_FILE=${REF_OUTPUT_FILE}
GEN_OUTPUT_PATH="${MY_PATH}/Generated Bindings"
echo ""
echo "Generating bindings"
echo ""
#
# Delete the output generator directory
#
if [ -d "${GEN_OUTPUT_PATH}/" ]; then
echo "Deleting existing content of ${GEN_OUTPUT_PATH}/"
rm -rf "${GEN_OUTPUT_PATH}/"*
else
mkdir "${GEN_OUTPUT_PATH}"
fi
#
# Run the generator to form Obj-C bindings from assembly XML definition
#
mono "${GENERATOR_EXE}" -i "${GEN_INPUT_FILE}" -o "${GEN_OUTPUT_PATH}" -v true