Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 23 additions & 15 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# found in the LICENSE file.

import("//flutter/common/config.gni")
import("//flutter/shell/platform/config.gni")

if (is_fuchsia) {
import("//build/fuchsia/sdk.gni")
Expand Down Expand Up @@ -63,10 +64,8 @@ group("flutter") {
# If on the host, compile all unittests targets.
if (current_toolchain == host_toolchain) {
if (is_mac) {
public_deps += [
"//flutter/shell/platform/darwin:flutter_channels_unittests",
"//flutter/shell/platform/darwin/macos:flutter_desktop_darwin_unittests",
]
public_deps +=
[ "//flutter/shell/platform/darwin:flutter_channels_unittests" ]
}

public_deps += [
Expand All @@ -75,29 +74,38 @@ group("flutter") {
"//flutter/lib/ui:ui_unittests",
"//flutter/runtime:runtime_unittests",
"//flutter/shell/common:shell_unittests",
"//flutter/shell/platform/common/cpp:common_cpp_core_unittests",
"//flutter/shell/platform/common/cpp:common_cpp_unittests",
"//flutter/shell/platform/common/cpp/client_wrapper:client_wrapper_unittests",
"//flutter/shell/platform/embedder:embedder_unittests",
"//flutter/shell/platform/glfw/client_wrapper:client_wrapper_glfw_unittests",
"//flutter/testing:testing_unittests",
"//flutter/third_party/txt:txt_unittests",
]

if (is_win) {
public_deps += [
"//flutter/shell/platform/windows:flutter_windows_unittests",
"//flutter/shell/platform/windows/client_wrapper:client_wrapper_windows_unittests",
]
}

if (!is_win) {
public_deps += [
"//flutter/fml:fml_benchmarks",
"//flutter/shell/common:shell_benchmarks",
"//flutter/third_party/txt:txt_benchmarks",
]
}

# Unit tests for desktop embeddings should only be built if the desktop
# embeddings are being built.
if (enable_desktop_embeddings) {
public_deps += [
"//flutter/shell/platform/common/cpp:common_cpp_core_unittests",
"//flutter/shell/platform/common/cpp:common_cpp_unittests",
"//flutter/shell/platform/common/cpp/client_wrapper:client_wrapper_unittests",
"//flutter/shell/platform/glfw/client_wrapper:client_wrapper_glfw_unittests",
]
if (is_mac) {
public_deps += [ "//flutter/shell/platform/darwin/macos:flutter_desktop_darwin_unittests" ]
}
if (is_win) {
public_deps += [
"//flutter/shell/platform/windows:flutter_windows_unittests",
"//flutter/shell/platform/windows/client_wrapper:client_wrapper_windows_unittests",
]
}
}
}
}

Expand Down
18 changes: 8 additions & 10 deletions shell/platform/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# found in the LICENSE file.

import("//build/fuchsia/sdk.gni")
import("//flutter/shell/platform/config.gni")

group("platform") {
if (is_mac || is_ios) {
Expand All @@ -14,18 +15,15 @@ group("platform") {
"android",
]
} else if (is_linux) {
if (is_fuchsia_host) {
# The linux build is not supported as part of the Fuchsia host build.
deps = []
} else {
deps = [
"linux",
]
deps = []
if (enable_desktop_embeddings) {
deps += [ "linux" ]
}
} else if (is_win) {
deps = [
"windows",
]
deps = []
if (enable_desktop_embeddings) {
deps += [ "windows" ]
}
} else if (is_fuchsia) {
deps = [
"fuchsia",
Expand Down
8 changes: 8 additions & 0 deletions shell/platform/config.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

declare_args() {
# Whether or not to include desktop embedding targets in the build.
enable_desktop_embeddings = !is_fuchsia_host
}
8 changes: 5 additions & 3 deletions shell/platform/darwin/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

assert(is_mac || is_ios)

import("//flutter/shell/platform/config.gni")
import("//flutter/testing/testing.gni")

group("darwin") {
Expand All @@ -13,9 +14,10 @@ group("darwin") {
]
}
if (is_mac) {
deps = [
"macos",
]
deps = []
if (enable_desktop_embeddings) {
deps += [ "macos" ]
}
}
}

Expand Down
8 changes: 8 additions & 0 deletions tools/gn
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,12 @@ def to_gn_args(args):
gn_args['dart_platform_sdk'] = not args.full_dart_sdk
gn_args['full_dart_sdk'] = args.full_dart_sdk

# Desktop embeddings can have more dependencies than the engine library,
# which can be problematic in some build environments (e.g., building on
# Linux will bring in pkg-config dependencies at generation time). These
# flags allow preventing those those targets from being part of the build
# tree.
gn_args['enable_desktop_embeddings'] = not args.disable_desktop_embeddings
if args.build_glfw_shell is not None:
gn_args['build_glfw_shell'] = args.build_glfw_shell

Expand Down Expand Up @@ -339,6 +345,8 @@ def parse_args(args):
help='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.')

parser.add_argument('--disable-desktop-embeddings', default=False, action='store_true',
help='Do not include desktop embeddings in the build.')
parser.add_argument('--build-glfw-shell', action='store_const', const=True,
help='Build the GLFW shell on supported platforms where it is not built by default.')
parser.add_argument('--no-build-glfw-shell', dest='build_glfw_shell', action='store_const', const=False,
Expand Down