核心层:ccui.sh

文件内容

#!/bin/bash

function Usage() {
  cat <<eof
    eg:bash run.sh
    Usage: bash ccui.sh []

    Exit status:
     0  if OK,
     1  if minor problems  (e.g., cannot access subdirectory),
     2  if serious trouble (e.g., cannot access command-line argument).

eof
  exit 1
}

function linefeed() {
  echo ""
}

function log_d() {
  echo -e "\033[0m$(date +%Y-%m-%d\ %H:%M:%S) $$ D $* \033[0m"
}

function log_i() {
  echo -e "\033[32m$(date +%Y-%m-%d\ %H:%M:%S) $$ I $* \033[0m"
}

function log_w() {
  echo -e "\033[33m$(date +%Y-%m-%d\ %H:%M:%S) $$ W $* \033[0m"
}

function log_e() {
  echo -e "\033[31m$(date +%Y-%m-%d\ %H:%M:%S) $$ E $* \033[0m"
  exit 1
}

function fatal() {
  echo -e "\033[41m$(date +%Y-%m-%d\ %H:%M:%S) $$ F $* \033[0m"
  exit 2
}

function debugEnable() {
  adb shell setprop "ccui.debug.kernel" true
  adb shell setprop "ccui.debug.speech" true
  adb shell setprop "ccui.debug.server" true
  adb shell setprop "ccui.debug.ota" true
  adb shell setprop "ccui.debug.ipc" true
  adb shell setprop "ccui.debug.bus" true
  adb shell setprop "ccui.debug.iot" true
  showDebugFlag
}

function debugDisable() {
  adb shell setprop "ccui.debug.kernel" false
  adb shell setprop "ccui.debug.speech" false
  adb shell setprop "ccui.debug.server" false
  adb shell setprop "ccui.debug.ota" false
  adb shell setprop "ccui.debug.ipc" false
  adb shell setprop "ccui.debug.bus" false
  adb shell setprop "ccui.debug.iot" false
  showDebugFlag
}

function strictModel() {
    adb shell setprop "ccui.strict.core" true
}

function looseModel() {
    adb shell setprop "ccui.strict.core" false
}

function showDebugFlag(){
  adb shell getprop | grep "ccui.debug"
}

function restart() {
  adb shell am startservice -a ccui.intent.action.DAEMON --es action restart
}

function destroy() {
  adb shell am startservice -a ccui.intent.action.DAEMON --es action destroy
}

function launch() {
  adb shell am start -n com.aispeech.ccui.voice/com.aispeech.ccui.MainActivity -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
}

function deploy(){
  ./gradlew :clean
  ./gradlew :deploy -P kernelBuildIndex=7
}

function dumpMeminfo() {
  process_array=$(adb shell "ps -ef | grep 'com.aispeech.ccui.voice' | grep -v 'grep'" | awk '{print $8}' | awk -v RS='' '{gsub("\n"," "); print}')
  for process in $process_array; do
    adb shell "dumpsys meminfo $process"
  done
}

function md2html() {
#  ./gradlew :app_kernel:assembleRelease -PkernelBuildIndex=22 -PBuildUser=CHYR -PBuildEmail='yanrong.chen@aispeech.com' -PgitBranchCommit='abcdefgh' -PgitBranchName='release-xxxx' -PbuildPurpose=show
    echo "$*"
    cp "outputs/V$1.md" "md2html"
    cd "md2html"
    node_modules/.bin/gulp release --path V"$1".md --title CCUI-KERNEL-V"$1"版本总览
    cp "dist/htmlmin/V$1.html" "../outputs/" && rm "dist/htmlmin/V$1.html" &&  rmdir "dist/htmlmin" && rmdir "dist" && rm "V$1.md"
    cd -
}

if [ $# -gt 0 ]; then
  # shellcheck disable=SC2048
  $*
else
  log_i "support function:"
  grep "function" "$0" | awk '{print $2}' | grep -v -E "function|^log|linefeed|fatal|Usage" | awk -F '(' '{print $1}'
fi

ccui.sh文件在哪里被读取的?

ccui.sh文件内容的编程语言是什么?

Bash

#!/bin/bash 什么意思?

用/bin/bash/解释执行

\033是什么?

设置字体颜色,31代表红色

核心层代码学习 文章被收录于专栏

核心层架构梳理、代码学习

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务