@@ -24,11 +24,7 @@ install_executorch() {
24
24
which pip
25
25
# Install executorch, this assumes that Executorch is checked out in the
26
26
# current directory.
27
- if [[ " ${1:- } " == " use-pt-pinned-commit" ]]; then
28
- ./install_executorch.sh --pybind xnnpack --use-pt-pinned-commit
29
- else
30
- ./install_executorch.sh --pybind xnnpack
31
- fi
27
+ ./install_executorch.sh --pybind xnnpack " $@ "
32
28
# Just print out the list of packages for debugging
33
29
pip list
34
30
}
@@ -166,3 +162,64 @@ do_not_use_nightly_on_ci() {
166
162
exit 1
167
163
fi
168
164
}
165
+
166
+
167
+ parse_args () {
168
+ local args=(" $@ " )
169
+ local i
170
+ local BUILD_TOOL=" "
171
+ local BUILD_TYPE=" "
172
+ local EDITABLE=" "
173
+ for (( i= 0 ; i< ${# args[@]} ; i++ )) ; do
174
+ case " ${args[$i]} " in
175
+ --build-tool)
176
+ BUILD_TOOL=" ${args[$((i+1))]} "
177
+ i=$(( i+ 1 ))
178
+ ;;
179
+ --build-type)
180
+ BUILD_TYPE=" ${args[$((i+1))]} "
181
+ i=$(( i+ 1 ))
182
+ ;;
183
+ --editable)
184
+ EDITABLE=" ${args[$((i+1))]} "
185
+ i=$(( i+ 1 ))
186
+ ;;
187
+ * )
188
+ echo " Invalid argument: ${args[$i]} "
189
+ exit 1
190
+ ;;
191
+ esac
192
+ done
193
+
194
+ if [[ $BUILD_TOOL =~ ^(cmake| buck2)$ ]]; then
195
+ echo " Build tool is ${BUILD_TOOL} ..."
196
+ elif [ -z " $BUILD_TOOL " ]; then
197
+ echo " Missing build tool (require buck2 or cmake), exiting..."
198
+ exit 1
199
+ else
200
+ echo " Require buck2 or cmake for --build-tool, got ${BUILD_TOOL} , exiting..."
201
+ exit 1
202
+ fi
203
+
204
+ if [[ " ${BUILD_MODE:- } " =~ ^(Debug| Release)$ ]]; then
205
+ echo " Running tests in build mode ${BUILD_MODE} ..."
206
+ elif [ -z " $BUILD_MODE " ]; then
207
+ BUILD_MODE=" Release"
208
+ else
209
+ echo " Unsupported build mode ${BUILD_MODE} , options are Debug or Release."
210
+ exit 1
211
+ fi
212
+
213
+ if [[ $EDITABLE =~ ^(true| false)$ ]]; then
214
+ echo " Editable mode is ${EDITABLE} ..."
215
+ elif [ -z " $EDITABLE " ]; then
216
+ EDITABLE=" false"
217
+ else
218
+ echo " Require true or false for --editable, got ${EDITABLE} , exiting..."
219
+ exit 1
220
+ fi
221
+
222
+ echo " BUILD_TOOL=$BUILD_TOOL "
223
+ echo " BUILD_TYPE=${BUILD_TYPE:- Release} "
224
+ echo " EDITABLE=${EDITABLE:- false} "
225
+ }
0 commit comments