Android OS/: : AOSP

[빌드-개요] Soong 빌드 시스템이란?

Jay.P Morgan 2025. 2. 26. 23:30

 

 

Android 7.0 이전 버전에서는 GNU Make를 독점적으로 사용하여 빌드 규칙을 설명하고 실행했습니다. Make 빌드 시스템은 널리 지원되고 사용되지만, Android 규모에서는 느리고 오류가 발생하며 확장이 불가능하고 테스트하기 어려웠습니다. Soong 빌드 시스템은 Android 빌드에 필요한 유연성을 제공합니다.

따라서 플랫폼 개발자는 가능한 한 빨리 Make에서 Soong으로 전환하는 것이 좋습니다. Google 그룹 android-building에 질문을 보내 지원을 받으세요.

Soong이란 무엇인가요?

Soong 빌드 시스템은 Make를 대체하기 위해 Android 7.0(Nougat)에 도입되었습니다. 이 시스템은 Kati GNU Make 클론 도구와 Ninja 빌드 시스템 구성요소를 활용하여 Android의 빌드 속도를 높입니다.

 

Android 오픈소스 프로젝트(AOSP)의 Android Make 빌드 시스템 설명에서 일반적인 안내를 살펴보고, Android.mk 작성자를 위한 빌드 시스템 변경사항을 참고하여 Make에서 Soong으로 전환하는 데 필요한 수정사항을 알아보세요.

주요 용어의 정의는 용어집의 빌드 관련 항목에서, 전체 세부정보는 Soong 참조 파일에서 확인하세요.

 

주의!: Android가 Make에서 Soong으로 완전히 전환될 때까지는 Make 제품 구성에서 PRODUCT_SOONG_NAMESPACES 값을 지정해야 합니다. 안내는 네임스페이스 모듈 섹션을 참고하세요.

 

Android build system usage:
m [-j] [<targets>] [<variable>=<value>...]
Ways to specify what to build:
  The common way to specify what to build is to set that information in the
  environment via:
    # Set up the shell environment.
    source build/envsetup.sh # Run "hmm" after sourcing for more info
    # Select the device and variant to target. If no argument is given, it
    # will list choices and prompt.
    lunch [<product>-<variant>] # Selects the device and variant to target.
    # Invoke the configured build.
    m [<options>] [<targets>] [<variable>=<value>...]
      <product> is the device that the created image is intended to be run on.
        This is saved in the shell environment as $TARGET_PRODUCT by `lunch`.
      <variant> is one of "user", "userdebug", or "eng", and controls the
        amount of debugging to be added into the generated image.
        This gets saved in the shell environment as $TARGET_BUILD_VARIANT by
          `lunch`.
    Each of <options>, <targets>, and <variable>=<value> is optional.
      If no targets are specified, the build system will build the images
      for the configured product and variant.
  A target may be a file path. For example, out/host/linux-x86/bin/adb .
    Note that when giving a relative file path as a target, that path is
    interpreted relative to the root of the source tree (rather than relative
    to the current working directory).
  A target may also be any other target defined within a Makefile. Run
    `m help` to view the names of some common targets.
  To view the modules and targets defined in a particular directory, look for:
    files named *.mk (most commonly Android.mk)
      these files are defined in Make syntax
    files named Android.bp
      these files are defined in Blueprint syntax
  During a build, a few log files are generated in ${OUT} (or ${DIST_DIR}/logs
    for dist builds):
    verbose.log.gz
      every command run, along with its outputs. This is similar to the
      previous `m showcommands` option.
    error.log
      list of actions that failed during the build, and their outputs.
    soong.log
      verbose debug information from soong_ui
  For now, the full (extremely large) compiled list of targets can be found
    (after running the build once), split among these two files:
    ${OUT}/build-<product>*.ninja
    ${OUT}/soong/build.ninja
    If you find yourself interacting with these files, you are encouraged to
    provide a more convenient tool for browsing targets, and to mention the
    tool here.
Targets that adjust an existing build:
  dist                      Copy into ${DIST_DIR} the portion of the build
                            that must be distributed
Flags
  -j <N>                    Run <N> processes at once
  -j                        Autodetect the number of processes to run at once,
                            and run that many
Variables
  Variables can either be set in the surrounding shell environment or can be
    passed as command-line arguments. For example:
      export I_AM_A_SHELL_VAR=1
      I_AM_ANOTHER_SHELL_VAR=2 m droid I_AM_A_MAKE_VAR=3
  Here are some common variables and their meanings:
    TARGET_PRODUCT          The <product> to build # as described above
    TARGET_BUILD_VARIANT    The <variant> to build # as described above
    DIST_DIR                The directory in which to place the distribution
                            artifacts.
    OUT_DIR                 The directory in which to place non-distribution
                            artifacts.
  There is not yet known a convenient method by which to discover the full
  list of supported variables. Please mention it here when there is.