content_shell building analisis
16lz
2021-01-26
We built content_shell.apk with following commands:
export GYP_GENERATORS=ninja. build/android/envsetup.shandroid_gypninja -C out/Debug -j10 content_shell_apkNow we start to analyze what are these command doing:
. build/android/envsetup.shthis line did mainly these things:
. "$(dirname $BASH_SOURCE)"/envsetup_functions.sh defined toolchain, gcc version and path of SDK and NDK tools.
defined shell functions android_gyp as an example.
android_gyp
# Performs a gyp_chromium run to convert gyp->Makefile for android code.android_gyp() { # This is just a simple wrapper of gyp_chromium, please don't add anything # in this function. echo "GYP_GENERATORS set to '$GYP_GENERATORS'" ( "${CHROME_SRC}/build/gyp_chromium" --depth="${CHROME_SRC}" --check "$@" )}
ninja -C out/Debug -j10 content_shell_apk
we need to find out what is ninja:
$ which ninja/home/zeus/Public/depot_tools/ninjathen we open it:
#!/bin/bash# Copyright (c) 2012 Google Inc. All rights reserved.# Use of this source code is governed by a BSD-style license that can be# found in the LICENSE file.OS="$(uname -s)"THIS_DIR="$(dirname "${0}")"function print_help() {cat <<-EOFNo prebuilt ninja binary was found for this system.Try building your own binary by doing: cd ~ git clone https://github.com/martine/ninja.git -b v1.0.0 ./ninja/bootstrap.pyThen add ~/ninja/ to your PATH.EOF}case "$OS" in Linux) MACHINE=$(getconf LONG_BIT) case "$MACHINE" in 32|64) exec "${THIS_DIR}/ninja-linux${MACHINE}" "$@";; *) echo Unknown architecture \($MACHINE\) -- unable to run ninja. print_help exit 1;; esac ;; Darwin) exec "${THIS_DIR}/ninja-mac" "$@";; CYGWIN*) exec cmd.exe /c $(cygpath -t windows $0).exe "$@";; MINGW32*) cmd.exe //c $0.exe "$@";; *) echo "Unsupported OS ${OS}" print_help exit 1;;esac
as we can see ninjia-linux${MACHINE} works just like make, ant it is actually an executable binary:
$ ls /home/zeus/Public/depot_tools/ninja*/home/zeus/Public/depot_tools/ninja /home/zeus/Public/depot_tools/ninja-linux32 /home/zeus/Public/depot_tools/ninja-mac/home/zeus/Public/depot_tools/ninja.exe /home/zeus/Public/depot_tools/ninja-linux64
more about ninja:
http://code.google.com/p/chromium/wiki/NinjaBuild
the source code location of content_shell.apk:
content/shell/android/shell_apk
the real build tool is ant:
yajun@yajun-OptiPlex-390:~/Public/chromium/src$ ninja -C out/Debug -j10 content_shell_apkninja: Entering directory `out/Debug'[1/2] ACTION Building content_shell_apk apk.FAILED: cd ../../content; ant -quiet "-DAPP_ABI=armeabi-v7a" "-DANDROID_GDBSERVER=/home/yajun/Public/chromium/src/third_party/android_tools/ndk//prebuilt/android-arm/gdbserver/gdbserver" "-DANDROID_SDK=/home/yajun/Public/chromium/src/third_party/android_tools/sdk//platforms/android-17" "-DANDROID_SDK_ROOT=/home/yajun/Public/chromium/src/third_party/android_tools/sdk/" "-DANDROID_SDK_TOOLS=/home/yajun/Public/chromium/src/third_party/android_tools/sdk//platform-tools" "-DANDROID_SDK_VERSION=17" "-DANDROID_TOOLCHAIN=/home/yajun/Public/chromium/src/third_party/android_tools/ndk//toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin" "-DCHROMIUM_SRC=\`cd ../out/Debug && pwd -P\`/../.." "-DCONFIGURATION_NAME=Debug" "-DPRODUCT_DIR=\`cd ../out/Debug && pwd -P\`" "-DAPK_NAME=ContentShell" "-DASSET_DIR=\`cd ../out/Debug && pwd -P\`/content_shell/assets" "-DADDITIONAL_SRC_DIRS=" "-DGENERATED_SRC_DIRS=" "-DINPUT_JARS_PATHS=\"../out/Debug/lib.java/chromium_content.jar\" \"../out/Debug/lib.java/chromium_base.jar\" \"../out/Debug/lib.java/chromium_media.jar\" \"../out/Debug/lib.java/chromium_net.jar\" \"../out/Debug/lib.java/chromium_ui.jar\" \"../out/Debug/lib.java/chromium_eyesfree.jar\" \"../out/Debug/lib.java/chromium_guava_javalib.jar\" \"../out/Debug/lib.java/chromium_jsr_305_javalib.jar\" \"../out/Debug/lib.java/chromium_content_shell.jar\"" "-DJAR_NAME=chromium_apk_content_shell_apk.jar" "-DPACKAGE_NAME=content_shell_apk" "-DRESOURCE_DIR=res" "-DADDITIONAL_R_TEXT_FILES=\"../out/Debug/gen/content/java_R/R.txt\" \"../out/Debug/gen/ui/java_R/R.txt\" \"../out/Debug/gen/content_shell/java_R/R.txt\"" "-DADDITIONAL_RES_DIRS=\"../out/Debug/gen/content/res\" ../content/public/android/java/res \"../out/Debug/gen/ui/res\" ../ui/android/java/res \"../out/Debug/gen/content_shell/res\" ../content/shell/android/java/res" "-DADDITIONAL_RES_PACKAGES=org.chromium.content org.chromium.ui org.chromium.content_shell" "-DAPP_MANIFEST_VERSION_NAME=Developer Build" "-DAPP_MANIFEST_VERSION_CODE=0" "-DPROGUARD_FLAGS=" "-DPROGUARD_ENABLED=false" "-Dbasedir=shell/android/shell_apk" -buildfile ../build/android/ant/chromium-apk.xml Debug [javac] /home/yajun/Public/chromium/src/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java:158: onStop() is already defined in org.chromium.content_shell_apk.ContentShellActivity [javac] protected void onStop(){ [javac] ^ [javac] 1 error
更多相关文章
- 代码中设置drawableleft
- android 3.0 隐藏 系统标题栏
- Android开发中activity切换动画的实现
- Android(安卓)学习 笔记_05. 文件下载
- Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
- 技术博客汇总
- android 2.3 wifi (一)
- AndRoid Notification的清空和修改
- Android中的Chronometer