@@ -14,6 +14,25 @@ ENGINE_SRC_DIR="$(dirname $(dirname $(dirname $(dirname ${FELT_DIR}))))"
1414FLUTTER_DIR=" ${ENGINE_SRC_DIR} /flutter"
1515SDK_PREBUILTS_DIR=" ${FLUTTER_DIR} /prebuilts"
1616
17+ # If set to 0 (the default) will run felt non-incrementally. For example, it will
18+ # run pub get.
19+ # If set to 1 (via the -i option) will run felt incrementally.
20+ INCREMENTAL=0
21+
22+ # All arguments passed to felt, except -i, if any.
23+ ARGS=" "
24+ for arg in " $@ " ; do
25+ case " $arg " in
26+ -i)
27+ INCREMENTAL=1
28+ shift
29+ ;;
30+ * )
31+ ARGS=" ${ARGS} ${arg} "
32+ ;;
33+ esac
34+ done
35+
1736if [ -z " ${DART_SDK_DIR} " ]
1837then
1938 if [[ $KERNEL_NAME == * " Darwin" * ]]
5069
5170else
5271 if [ ! -d " $DART_SDK_DIR " ]
53- then
72+ then
5473 echo " Explicitly specified dart SDK not found at ${DART_SDK_DIR} ."
5574 exit 1
5675 fi
@@ -84,47 +103,10 @@ install_deps() {
84103 (cd " $WEB_UI_DIR " ; silent_on_success $DART_PATH pub get)
85104}
86105
87- if [[ $KERNEL_NAME == * " Darwin" * ]]
106+ cd $WEB_UI_DIR
107+ if [[ " $INCREMENTAL " == " 0" ]]
88108then
89- echo " Running on MacOS. Will check the file and user limits."
90- # Disable exit if the commands fails. We want to give more actionable
91- # error message.
92- set +e
93- ULIMIT_FILES=` ulimit -n`
94- # Increase the file limit if it is low. Note that these limits are changed
95- # only for this script (for this shell). After felt execution is completed
96- # no change is required to reset the original shell.
97- if [[ $ULIMIT_FILES -lt 50000 ]]
98- then
99- echo " File limits too low increasing the file limits"
100- # Get the max file limit.
101- MAX_ULIMIT_FILES=` launchctl limit maxfiles | sed -e ' s/^[[:space:]]*//' | sed ' s/ \{1,\}/ /g' | cut -d' ' -f2`
102- if [[ $MAX_ULIMIT_FILES -lt 50000 ]]
103- then
104- # Increase the maximum file limit.
105- sudo launchctl limit maxfiles 50000 200000
106- fi
107- ERROR=$( ulimit -n 50000 2>&1 > /dev/null)
108- if [[ ! -z $ERROR ]]
109- then
110- echo " Problem changing the file limit. Please try to reboot to use the higher limits. error: \n$ERROR " 1>&2
111- fi
112- fi
113- ULIMIT_USER=` ulimit -u`
114- # Increase the hard user limit if it is lower than 2048.
115- if [[ $ULIMIT_USER -lt 4096 ]]
116- then
117- echo " User limits too low increasing the user limits"
118- ERROR2=$( ulimit -u 4096 2>&1 > /dev/null)
119- if [[ ! -z $ERROR2 ]]
120- then
121- echo " Problem changing the user limit. Please try to reboot to use the higher limits. error: \n$ERROR2 " 1>&2
122- fi
123- fi
124- # Set the value back to exit on non zero results.
125- set -e
109+ install_deps
126110fi
127111
128- cd $WEB_UI_DIR
129- install_deps
130- (cd $WEB_UI_DIR && $DART_SDK_DIR /bin/dart run $FELT_DEBUG_FLAGS dev/felt.dart $@ )
112+ (cd $WEB_UI_DIR && $DART_SDK_DIR /bin/dart run $FELT_DEBUG_FLAGS dev/felt.dart ${ARGS} )
0 commit comments