Skip to content

Setting up the Engine development environment

Gary Qian edited this page Jan 7, 2019 · 8 revisions

If you've already built the engine and have the configuration set up but merely need a refresher on actually compiling the code, see Compiling the engine.

Make sure you have the following dependencies available:

  • Linux, macOS, or Windows.

    • Linux supports cross-compiling artifacts for Android, but not iOS.

    • macOS supports cross-compiling artifacts for Android and iOS.

    • Windows doesn't support cross-compiling artifacts for either Android or iOS.

  • git (used for source version control).

  • An IDE. Android Studio with the Flutter plugin is our flagship IDE. You can use whatever IDE you feel most comfortable with. See also the section at the bottom of this page for advice on setting up autocomplete with a tool called cquery.

  • An ssh client (used to authenticate with GitHub).

  • Chromium's depot_tools (make sure it's in your path). We use the gclient tool from depot_tools.

  • Python (used by many of our tools, including 'gclient').

  • On macOS and Linux: curl and unzip (used by gclient sync).

  • On Windows: Visual Studio (required for non-Googlers only).

  • On macOS: the latest Xcode.

  • Recommended for Googlers: Goma for distributed builds.

You do not need Dart installed, as a Dart tool chain is automatically downloaded as part of the "getting the code" step. Similarly for the Android SDK, it's downloaded by the gclient sync step below.

Run the following steps to set up your environment:

  1. Fork into your own GitHub account. If you already have a fork, and are now installing a development environment on a new machine, make sure you've updated your fork so that you don't use stale configuration options from long ago. Do not clone this repo locally, scripts will take care of that for you.

  2. If you haven't configured your machine with an SSH key that's known to github then follow the directions here:

  3. Create an empty directory for your copy of the repository. For best results, call it engine: some of the tools assume this name when working across repositories. (They can be configured to use other names too; this isn't a strict requirement. It just makes things easier.)

  4. Create a .gclient file in the engine directory with the following contents, replacing <your_name_here> with your GitHub account name:

    solutions = [
        "managed": False,
        "name": "src/flutter",
        "url": "<your_name_here>/engine.git",
        "custom_deps": {},
        "deps_file": "DEPS",
        "safesync_url": "",
  5. cd engine (Change to the directory in which you put the .gclient file.)

  6. gclient sync This will fetch all the source code that Flutter depends on. Avoid interrupting this script, it can leave your repository in an inconsistent state that is tedious to clean up. (This step automatically runs git clone, among other things.)

  7. cd src/flutter (Change to the flutter directory of the src directory that gclient sync created in your engine directory.)

  8. git remote add upstream (So that you fetch from the master flutter/engine repository, not your clone, when running git fetch et al.)

  9. cd .. (Return to the src directory that gclient sync created in your engine directory.)

  10. If you're on Linux, run: sudo ./build/

  11. If you're on Linux, run: sudo ./build/

  12. If you're on Mac, install Oracle's Java JDK, version 1.7 or later.

  13. If you're on Mac, install ant: brew install ant

  14. If you're on Windows, install Visual Studio (non-Google developers only).

  15. If you're planning on working on the buildroot repository as well, and have a local checkout of that repository, run the following commands in the src directory to update your git remotes accordingly:

    git remote rename origin upstream
    git remote add origin<your_name_here>/buildroot.git
  16. Additionally if you've modified dart sources in flutter/engine, you'll need to add a dependency_overrides section to point to your modified package:sky_engine and package:sky_services to the pubspec.yaml for the flutter app you're using the custom engine with. A typical example would be:

        path: /path/to/flutter/engine/out/host_debug/gen/dart-pkg/sky_engine	
        path: /path/to/flutter/engine/out/host_debug/gen/dart-pkg/sky_services	

    Depending on the platform you choose below, you will need to replace host_debug with the appropriate directory.

Next steps:

Editor autocomplete support

cquery is a highly scalable C/C++/Objective-C language server that supports IDE features like go-to-definition, call hierarchy, autocomplete, find reference etc that works reasonably well with our engine repo.

It supports editors like VSCode, emacs, vim etc.

To set up:

  1. Install cquery
    1. brew install --HEAD cquery on osx or
    2. Build from source
  2. Generate compile_commands.json which our GN tool already does such as via src/flutter/tools/gn --ios --unoptimized
  3. Install an editor extension such as VSCode-cquery
    1. VSCode-query requires the compile_commands.json to be at the project root. Copy or symlink src/out/compile_commands.json to src/ or src/flutter.
    2. Follow Setting up the extension to configure VSCode-query.

Clone this wiki locally
You can’t perform that action at this time.