@@ -50,6 +50,7 @@ Usage: $0 <options>
5050 Optional options:
5151 --be build Backend
5252 --fe build Frontend
53+ --fe-ui build Frontend web ui with npm
5354 --clean clean and build target
5455 --with-mysql enable MySQL support(default)
5556 --without-mysql disable MySQL support
@@ -63,6 +64,7 @@ Usage: $0 <options>
6364 $0 --be --without-mysql --without-lzo build Backend with both MySQL and LZO disable
6465 $0 --fe --clean clean and build Frontend
6566 $0 --fe --be --clean clean and build both Frontend and Backend
67+ $0 --fe --fe-ui build Frontend with web UI
6668 "
6769 exit 1
6870}
@@ -73,6 +75,7 @@ OPTS=$(getopt \
7375 -o ' h' \
7476 -l ' be' \
7577 -l ' fe' \
78+ -l ' fe-ui' \
7679 -l ' clean' \
7780 -l ' with-mysql' \
7881 -l ' without-mysql' \
@@ -98,17 +101,20 @@ if [ $# == 1 ] ; then
98101 # defuat
99102 BUILD_BE=1
100103 BUILD_FE=1
104+ BUILD_FE_UI=1
101105 CLEAN=0
102106 RUN_UT=0
103107else
104108 BUILD_BE=0
105109 BUILD_FE=0
110+ BUILD_FE_UI=0
106111 CLEAN=0
107112 RUN_UT=0
108113 while true ; do
109114 case " $1 " in
110115 --be) BUILD_BE=1 ; shift ;;
111116 --fe) BUILD_FE=1 ; shift ;;
117+ --fe-ui) BUILD_FE_UI=1; shift ;;
112118 --clean) CLEAN=1 ; shift ;;
113119 --ut) RUN_UT=1 ; shift ;;
114120 --with-mysql) WITH_MYSQL=ON; shift ;;
@@ -134,12 +140,13 @@ if [ ${CLEAN} -eq 1 -a ${BUILD_BE} -eq 0 -a ${BUILD_FE} -eq 0 ]; then
134140fi
135141
136142echo " Get params:
137- BUILD_BE -- $BUILD_BE
138- BUILD_FE -- $BUILD_FE
139- CLEAN -- $CLEAN
140- RUN_UT -- $RUN_UT
141- WITH_MYSQL -- $WITH_MYSQL
142- WITH_LZO -- $WITH_LZO
143+ BUILD_BE -- $BUILD_BE
144+ BUILD_FE -- $BUILD_FE
145+ BUILD_FE_UI -- $BUILD_FE_UI
146+ CLEAN -- $CLEAN
147+ RUN_UT -- $RUN_UT
148+ WITH_MYSQL -- $WITH_MYSQL
149+ WITH_LZO -- $WITH_LZO
143150"
144151
145152# Clean and build generated code
@@ -175,15 +182,36 @@ cd ${DORIS_HOME}/docs
175182./build_help_zip.sh
176183cd ${DORIS_HOME}
177184
178- which npm
179- # Clean and build Frontend
180- if [ ${BUILD_FE} -eq 1 ] ; then
185+ function build_ui() {
186+ # check NPM env here, not in env.sh.
187+ # Because UI should be considered a non-essential component at runtime.
188+ # Only when the compilation is required, check the relevant compilation environment.
189+ NPM=npm
190+ if ! ${NPM} --version; then
191+ echo " Error: npm is not found"
192+ exit 1
193+ fi
194+ if [[ ! -z ${CUSTOM_NPM_REGISTRY} ]]; then
195+ ${NPM} config set registry ${CUSTOM_NPM_REGISTRY}
196+ npm_reg=` ${NPM} get registry`
197+ echo " NPM version: npm_reg"
198+ fi
181199 echo " Build Frontend UI"
182200 cd ${DORIS_HOME} /doris-ui
183- npm install
184- npm run build
201+ ${NPM} install
202+ $NPM run build
203+ rm -rf ${DORIS_HOME} /fe/src/main/resources/static/
185204 mkdir -p ${DORIS_HOME} /fe/src/main/resources/static
186205 cp -r ${DORIS_HOME} /doris-ui/dist/* ${DORIS_HOME} /fe/src/main/resources/static
206+ }
207+
208+ # FE ui must be built before building FE
209+ if [ ${BUILD_FE_UI} -eq 1 ] ; then
210+ build_ui
211+ fi
212+
213+ # Clean and build Frontend
214+ if [ ${BUILD_FE} -eq 1 ] ; then
187215 echo " Build Frontend"
188216 cd ${DORIS_HOME} /fe
189217 if [ ${CLEAN} -eq 1 ]; then
0 commit comments