@@ -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,60 @@ 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_MODE=" "
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-mode)
180
+ BUILD_MODE=" ${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
+ BUILD_MODE=" ${BUILD_MODE:- Release} "
204
+ if [[ " $BUILD_MODE " =~ ^(Debug| Release)$ ]]; then
205
+ echo " Running tests in build mode ${BUILD_MODE} ..."
206
+ else
207
+ echo " Unsupported build mode ${BUILD_MODE} , options are Debug or Release."
208
+ exit 1
209
+ fi
210
+ EDITABLE=" ${EDITABLE:- false} "
211
+ if [[ $EDITABLE =~ ^(true| false)$ ]]; then
212
+ echo " Editable mode is ${EDITABLE} ..."
213
+ else
214
+ echo " Require true or false for --editable, got ${EDITABLE} , exiting..."
215
+ exit 1
216
+ fi
217
+
218
+ echo " BUILD_TOOL=$BUILD_TOOL "
219
+ echo " BUILD_MODE=$BUILD_MODE "
220
+ echo " EDITABLE=$EDITABLE "
221
+ }
0 commit comments