Skip to content

Commit

Permalink
[macOS] Add README.md for macOS embedder (flutter#40032)
Browse files Browse the repository at this point in the history
Describes how to build and test the macOS embedder.
  • Loading branch information
cbracken authored Mar 3, 2023
1 parent d9a2d7c commit 106db83
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
1 change: 1 addition & 0 deletions ci/licenses_golden/excluded_files
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@
../../../flutter/shell/platform/darwin/Doxyfile
../../../flutter/shell/platform/darwin/common/framework/Source/flutter_codecs_unittest.mm
../../../flutter/shell/platform/darwin/common/framework/Source/flutter_standard_codec_unittest.mm
../../../flutter/shell/platform/darwin/macos/README.md
../../../flutter/shell/platform/darwin/macos/framework/Source/fixtures
../../../flutter/shell/platform/embedder/fixtures
../../../flutter/shell/platform/embedder/platform_view_embedder_unittests.cc
Expand Down
58 changes: 58 additions & 0 deletions shell/platform/darwin/macos/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Flutter macOS Embedder

This directory contains files specific to the Flutter macOS embedder. The
embedder is built as a macOS framework that is linked into the target
application. The framework is composed both of macOS-specific code and code
shared with the iOS embedder. These can be found in:
```
flutter/shell/platform/darwin/common/framework
flutter/shell/platform/darwin/macos/framework
```

Additionally, the framework relies on utility code shared across all embedders,
which is found in:
```
flutter/shell/platform/common
```

To learn more, see the [Engine architecture wiki][wiki_arch].

## Building

Building all artifacts required for macOS occurs in two steps:
* Host binary build: Builds tooling used by the Flutter tool to build Flutter
applications targeting macOS.
* macOS Target build: Builds the framework that implements the macOS Flutter
embedder and exposes public API such as `FlutterViewController` used by
Flutter applications.

Once you've [prepared your environment for engine development][wiki_engine_env],
you can build the macOS embedder from the `src/flutter` directory using the
following commands:
```sh
# Perform the host build.
./tools/gn --unopt --no-goma
autoninja -C ../out/host_debug_unopt

# Perform the macOS target build.
./tools/gn --unopt --mac --no-goma
autoninja -C ../out/mac_debug_unopt
```
Builds are architecture-specific, and can be controlled by specifying
`--mac-cpu=arm64` or `--mac-cpu=x64` (default) when invoking `gn`.

Googlers can remove `--no-goma` to make use of the Goma distributed compile
service.

## Testing

The macOS-specific embedder tests are built as the
`flutter_desktop_darwin_unittests` binary. Like all gtest-based test binaries, a
subset of tests can be run by applying a filter such as
`--gtest_filter='FlutterViewControllerTest.*Key*'`.

More general details on testing can be found on the [Wiki][wiki_engine_testing].

[wiki_arch]: https://github.com/flutter/flutter/wiki/The-Engine-architecture
[wiki_engine_env]: https://github.com/flutter/flutter/wiki/Setting-up-the-Engine-development-environment
[wiki_engine_testing]: https://github.com/flutter/flutter/wiki/Testing-the-engine

0 comments on commit 106db83

Please sign in to comment.