Skip to content

Add a --gn-args (or similar) to forward from et to gn #156909

@matanlurey

Description

@matanlurey

As of today, et has a very limited set of flags:

(Some flags omitted below for readability)

flutter % et help build          

Usage: et build [arguments]
-h, --help                               Print this usage information.

    --[no-]rbe                           Enable pre-configured remote build execution.
                                         (defaults to on)
    --build-strategy                     How to prefer remote or local builds.

          [auto] (default)               Prefer remote builds and fallback silently to local builds.
          [local]                        Use local builds.
                                         No internet connection is required.
          [remote]                       Use remote builds.
                                         If --build-strategy is not specified, the build will fail.

-j, --concurrency                        How many jobs to run in parallel.
flutter % et help build --verbose

Usage: et build [arguments]
-h, --help                                                 Print this usage information.

    --[no-]lto                                             Whether LTO should be enabled for a
                                                           build.
                                                           If omitted, defaults to the
                                                           configuration's specified value, which is
                                                           typically (but not always) --no-lto.
    --[no-]rbe                                             Enable pre-configured remote build
                                                           execution.
                                                           
                                                           Google employees can follow the
                                                           instructions at
                                                           https://flutter.dev/to/engine-rbe to
                                                           enable RBE, which can parallelize builds
                                                           and reduce build times on faster internet
                                                           connections.
                                                           (defaults to on)
    --build-strategy                                       How to prefer remote or local builds.

          [auto] (default)                                 Prefer remote builds and fallback
                                                           silently to local builds.
          [local]                                          Use local builds.
                                                           No internet connection is required.
          [remote]                                         Use remote builds.
                                                           If --build-strategy is not specified, the
                                                           build will fail.

-j, --concurrency                                          How many jobs to run in parallel.

When compared with ./tools/gn --help:

flutter % ./tools/gn --help
usage: gn [-h] [--unoptimized] [--enable-unittests] [--no-enable-unittests]
          [--runtime-mode {debug,profile,release,jit_release}] [--dart-debug]
          [--no-dart-version-git-info] [--full-dart-debug]
          [--dart-optimization-level DART_OPTIMIZATION_LEVEL]
          [--target-os {android,ios,mac,linux,fuchsia,wasm,win}] [--android]
          [--android-cpu {arm,x64,x86,arm64}] [--ios] [--mac] [--mac-cpu {x64,arm64}] [--simulator]
          [--linux] [--fuchsia] [--wasm] [--wasm-use-dwarf] [--web] [--windows]
          [--linux-cpu {x64,x86,arm64,arm}] [--fuchsia-cpu {x64,arm64}]
          [--windows-cpu {x64,arm64,x86}] [--simulator-cpu {x64,arm64}]
          [--arm-float-abi {hard,soft,softfp}] [--backtrace] [--no-backtrace]
          [--build-engine-artifacts] [--no-build-engine-artifacts] [--rbe] [--no-rbe]
          [--rbe-server-address RBE_SERVER_ADDRESS]
          [--rbe-exec-strategy {local,remote,remote_local_fallback,racing}]
          [--rbe-dial-timeout RBE_DIAL_TIMEOUT] [--rbe-platform RBE_PLATFORM] [--rbe-dir RBE_DIR]
          [--goma] [--no-goma] [--xcode-symlinks] [--no-xcode-symlinks] [--depot-tools DEPOT_TOOLS]
          [--lto] [--no-lto] [--clang] [--no-clang] [--clang-static-analyzer]
          [--no-clang-static-analyzer] [--target-sysroot TARGET_SYSROOT]
          [--target-toolchain TARGET_TOOLCHAIN] [--target-triple TARGET_TRIPLE]
          [--operator-new-alignment OPERATOR_NEW_ALIGNMENT] [--macos-enable-metal] [--enable-vulkan]
          [--enable-fontconfig] [--enable-vulkan-validation-layers] [--embedder-for-target]
          [--coverage] [--out-dir OUT_DIR] [--target-dir TARGET_DIR] [--full-dart-sdk]
          [--no-full-dart-sdk] [--build-canvaskit] [--ide IDE] [--allow-deprecated-api-calls]
          [--disable-desktop-embeddings] [--build-glfw-shell] [--no-build-glfw-shell]
          [--build-embedder-examples] [--no-build-embedder-examples] [--stripped] [--no-stripped]
          [--prebuilt-dart-sdk] [--no-prebuilt-dart-sdk] [--use-mallinfo2] [--enable-impeller-3d]
          [--malioc-path MALIOC_PATH] [--impeller-cmake-example] [--slimpeller] [--asan] [--lsan]
          [--msan] [--tsan] [--ubsan] [--fstack-protector] [--darwin-extension-safe] [--verbose]
          [--gn-args GN_ARGS] [--use-glfw-swiftshader]

A script to run `gn gen`.

optional arguments:
  -h, --help            show this help message and exit
  --unoptimized
  --enable-unittests    Force enable building unit test binaries.
  --no-enable-unittests
                        Force disable building unit test binaries.
  --runtime-mode {debug,profile,release,jit_release}
  --dart-debug          Enables assertions in the Dart VM. Does not affect optimization levels. If
                        you need to disable optimizations in Dart, use --full-dart-debug
  --no-dart-version-git-info
                        Set by default; if unset, turns off the dart SDK git hash check
  --full-dart-debug     Implies --dart-debug and also disables optimizations in the Dart VM making it
                        easier to step through VM code in the debugger.
  --dart-optimization-level DART_OPTIMIZATION_LEVEL
                        The default optimization level for the Dart VM runtime.
  --target-os {android,ios,mac,linux,fuchsia,wasm,win}
  --android
  --android-cpu {arm,x64,x86,arm64}
  --ios
  --mac
  --mac-cpu {x64,arm64}
  --simulator
  --linux
  --fuchsia
  --wasm
  --wasm-use-dwarf      Embed dwarf debugging info in the output module instead of using sourcemap
                        files.
  --web
  --windows
  --linux-cpu {x64,x86,arm64,arm}
  --fuchsia-cpu {x64,arm64}
  --windows-cpu {x64,arm64,x86}
  --simulator-cpu {x64,arm64}
  --arm-float-abi {hard,soft,softfp}
  --backtrace           Whether OS support exists for collecting backtraces.
  --no-backtrace
  --build-engine-artifacts
                        Build the host-side development artifacts.
  --no-build-engine-artifacts
                        Do not build the host-side development artifacts.
  --rbe
  --no-rbe
  --rbe-server-address RBE_SERVER_ADDRESS
                        The reproxy serveraddress
  --rbe-exec-strategy {local,remote,remote_local_fallback,racing}
                        The RBE execution strategy.
  --rbe-dial-timeout RBE_DIAL_TIMEOUT
                        The timeout for connecting to the local reproxy server.
  --rbe-platform RBE_PLATFORM
                        The RBE "platform" string. This is used to identify remote platform settings
                        like the docker image to use to run the command.
  --rbe-dir RBE_DIR     The location of the reclient binaries.
  --goma
  --no-goma
  --xcode-symlinks      Set to true for builds targeting macOS or iOS when using RBE. If set,
                        symlinks to the Xcode provided sysroot and SDKs will be created in a
                        generated folder, which will avoid potential backend errors in Fuchsia RBE.
                        Instead of specifying the flag on each invocation the
                        FLUTTER_GOMA_CREATE_XCODE_SYMLINKS environment variable may be set to 1 to
                        achieve the same effect.
  --no-xcode-symlinks
  --depot-tools DEPOT_TOOLS
                        Depot tools provides an alternative location for gomacc in
                        /path/to/depot_tools/.cipd_bin
  --lto
  --no-lto
  --clang
  --no-clang
  --clang-static-analyzer
  --no-clang-static-analyzer
  --target-sysroot TARGET_SYSROOT
  --target-toolchain TARGET_TOOLCHAIN
  --target-triple TARGET_TRIPLE
  --operator-new-alignment OPERATOR_NEW_ALIGNMENT
  --macos-enable-metal
  --enable-vulkan
  --enable-fontconfig
  --enable-vulkan-validation-layers
  --embedder-for-target
  --coverage
  --out-dir OUT_DIR     Root out directory. Target specific gn files will be generated in ${out-dir}/
  --target-dir TARGET_DIR
                        Use the specified name for target out directory. By default this tool
                        determines one.
  --full-dart-sdk       include trained dart2js and dartdevc snapshots. Enable only on steps that
                        create an SDK
  --no-full-dart-sdk
  --build-canvaskit     build canvaskit from source (DEPRECATED: use ninja targets to select what to
                        build)
  --ide IDE             The IDE files to generate using GN. Use `gn gen help` and look for the --ide
                        flag to see supported IDEs. If this flag is not specified, a platform
                        specific default is selected.
  --allow-deprecated-api-calls
                        Turns off warnings about the usage of deprecated APIs.
  --disable-desktop-embeddings
                        Do not include desktop embeddings in the build.
  --build-glfw-shell    Build the GLFW shell on supported platforms where it is not built by default.
  --no-build-glfw-shell
                        Do not build the GLFW shell on platforms where it is built by default.
  --build-embedder-examples
                        Build the example embedders using the Embedder API.
  --no-build-embedder-examples
                        Do not build the example embedders using the Embedder API.
  --stripped            Strip debug symbols from the output. This defaults to true and has no effect
                        on iOS.
  --no-stripped
  --prebuilt-dart-sdk   Whether to use a prebuilt Dart SDK instead of building one. This defaults to
                        true and is enabled on CI.
  --no-prebuilt-dart-sdk
  --use-mallinfo2       Use mallinfo2 to collect malloc stats.
  --enable-impeller-3d  Enables experimental 3d support.
  --malioc-path MALIOC_PATH
                        The path to the malioc tool.
  --impeller-cmake-example
                        Do not run GN. Instead configure the Impeller cmake example build.
  --slimpeller          Enable optimizations that attempt to reduce binary size of the Flutter engine
                        by assuming only the Impeller rendering engine is supported.See
                        [go/slimpeller-dashboard](https://github.com/orgs/flutter/projects/21) for
                        details.
  --asan
  --lsan
  --msan
  --tsan
  --ubsan
  --fstack-protector    Whether the -fstack-protector flag should be passed unconditionally.
  --darwin-extension-safe
                        Whether the produced Flutter.framework is app extension safe. Only for iOS.
  --verbose
  --gn-args GN_ARGS     Additional gn args to be passed to gn. If you need to use this, it should
                        probably be another switch in //flutter/tools/gn.
  --use-glfw-swiftshader
                        Forces glfw to use swiftshader.

We obviously do not want to duplicate every flag.

See flutter/engine#55824 (comment) for source of the discussion.

One question for @zanderso, the ./tools/gn --help docs state:

  --gn-args GN_ARGS     Additional gn args to be passed to gn. If you need to use this, it should
                        probably be another switch in //flutter/tools/gn.

Does that mean based on your comment here (flutter/engine#55824 (comment)):

An overall concern I have with this change is repeating the same mistake that we made with tools/gn in which every GN option is exposed to the user on the command line through explicit plumbing. Instead, I'd recommend adding a generic "Plumb this option to GN" flag to et.

We don't like that approach? Can you expand?

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work liste: engine-toolEngine-specific tooling (i.e. `tools/engine_tool`).team-engineOwned by Engine teamtriaged-engineTriaged by Engine team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions