@@ -179,7 +179,7 @@ upload_file_gofile() {
179179fetch_progress () {
180180 local progress
181181 progress=$( \
182- sed -n ' / ninja/,$p ' " $ROOT_DIRECTORY /build.log" | \
182+ tail -n 30 " $ROOT_DIRECTORY /build.log" | \
183183 grep -Po ' \d+% \d+/\d+' | \
184184 tail -n1 | \
185185 sed -e ' s/ / (/; s/$/)/' \
@@ -303,23 +303,30 @@ if [ $? -ne 0 ]; then
303303 exit 1
304304fi
305305
306- echo -e " $BOLD_GREEN \nStarting build...$RESET "
306+ echo -e " $BOLD_GREEN \nStarting build... (Logs at build.log) $RESET "
307307m installclean -j" $CONFIG_COMPILE_JOBS "
308308m " $CONFIG_TARGET " -j" $CONFIG_COMPILE_JOBS " > " $ROOT_DIRECTORY /build.log" 2>&1 &
309309
310310# Monitor build progress
311311previous_progress=" "
312312while jobs -r & > /dev/null; do
313313 current_progress=$( fetch_progress)
314- if [[ " $current_progress " != " $previous_progress " ]]; then
314+
315+ # Show live progress in the terminal
316+ echo -ne " ${YELLOW} Build progress: ${current_progress}${RESET} \r"
317+
318+ if [[ " $current_progress " != " $previous_progress " && " $current_progress " != " Initializing..." ]]; then
315319 details=" <b>• ROM:</b> <code>$ROM_NAME </code>\n<b>• DEVICE:</b> <code>$DEVICE </code>\n<b>• ANDROID VERSION:</b> <code>$ANDROID_VERSION </code>\n<b>• TYPE:</b> <code>$BUILD_TYPE </code>\n<b>• PROGRESS:</b> <code>$current_progress </code>"
316320 progress_message=$( generate_telegram_message " 🟡" " Compiling ROM..." " $details " )
317321 edit_message " $progress_message " " $CONFIG_CHATID " " $build_message_id "
318322 previous_progress=" $current_progress "
319323 fi
320- sleep 10
324+ sleep 15 # Sleep a bit longer to reduce API calls and script load
321325done
322326
327+ # Print a newline to move off the progress line
328+ echo -e " \n"
329+
323330wait # Wait for the background build process to finish
324331
325332build_end_time=$( date -u +%s)
@@ -330,8 +337,22 @@ if ! grep -q "#### build completed successfully" "$ROOT_DIRECTORY/build.log"; th
330337 echo -e " $RED \nBuild failed. Check build.log for details.$RESET "
331338 build_failed_message=$( generate_telegram_message " 🔴" " ROM compilation failed" " " " Build failed after $build_duration . Check out the log for more details." )
332339 edit_message " $build_failed_message " " $CONFIG_CHATID " " $build_message_id "
333- send_file " $ROOT_DIRECTORY /build.log" " $CONFIG_ERROR_CHATID "
340+
341+ # Send the concise error log instead of the full build log
342+ if [ -f " out/error.log" ]; then
343+ send_file " out/error.log" " $CONFIG_ERROR_CHATID "
344+ else
345+ echo " out/error.log not found, sending full build.log instead."
346+ send_file " $ROOT_DIRECTORY /build.log" " $CONFIG_ERROR_CHATID "
347+ fi
348+
334349 send_sticker " $STICKER_URL " " $CONFIG_CHATID "
350+
351+ # Display the error log in the terminal
352+ if [ -f " out/error.log" ]; then
353+ echo -e " \n${RED} Displaying error log:${RESET} "
354+ cat " out/error.log"
355+ fi
335356else
336357 echo -e " $BOLD_GREEN \nBuild successful!$RESET "
337358
0 commit comments