mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Relands https://github.com/flutter/engine/pull/20399 Makes BinaryMessenger available from FlutterEngine, rather than just the plugin registrar. This allows for method channels directly in applications without building them as plugins, and matches the other platforms. Requires some restructuring of code and GN targets in the client wrappers to make the internals in the shared section usable by the implementations of platform-specific parts of the wrappers. Also fixes a latent issue with EnableInputBlocking symbols being declared but not defined for Windows that came up during testing of the restructing. Fixes https://github.com/flutter/flutter/issues/62871
100 lines
3.1 KiB
Plaintext
100 lines
3.1 KiB
Plaintext
# 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.
|
|
|
|
import("//flutter/shell/platform/common/cpp/client_wrapper/publish.gni")
|
|
import("//flutter/testing/testing.gni")
|
|
|
|
_wrapper_includes = [
|
|
"include/flutter/dart_project.h",
|
|
"include/flutter/flutter_engine.h",
|
|
"include/flutter/flutter_view_controller.h",
|
|
"include/flutter/flutter_view.h",
|
|
"include/flutter/plugin_registrar_windows.h",
|
|
]
|
|
|
|
_wrapper_sources = [
|
|
"flutter_engine.cc",
|
|
"flutter_view_controller.cc",
|
|
]
|
|
|
|
# This code will be merged into .../common/cpp/client_wrapper for client use,
|
|
# so uses header paths that assume the merged state. Include the header
|
|
# directories of the core wrapper files so these includes will work.
|
|
config("relative_core_wrapper_headers") {
|
|
include_dirs = [
|
|
"//flutter/shell/platform/common/cpp/client_wrapper",
|
|
"//flutter/shell/platform/common/cpp/client_wrapper/include/flutter",
|
|
]
|
|
}
|
|
|
|
# Windows client wrapper build for internal use by the shell implementation.
|
|
source_set("client_wrapper_windows") {
|
|
sources = _wrapper_sources
|
|
public = _wrapper_includes
|
|
|
|
deps = [
|
|
"//flutter/shell/platform/common/cpp:common_cpp_library_headers",
|
|
"//flutter/shell/platform/common/cpp/client_wrapper:client_wrapper",
|
|
"//flutter/shell/platform/windows:flutter_windows_headers",
|
|
]
|
|
|
|
configs +=
|
|
[ "//flutter/shell/platform/common/cpp:desktop_library_implementation" ]
|
|
|
|
public_configs = [
|
|
":relative_core_wrapper_headers",
|
|
"//flutter/shell/platform/common/cpp:relative_flutter_library_headers",
|
|
"//flutter/shell/platform/windows:relative_flutter_windows_headers",
|
|
]
|
|
}
|
|
|
|
# Copies the Windows client wrapper code to the output directory.
|
|
publish_client_wrapper_extension("publish_wrapper_windows") {
|
|
public = _wrapper_includes
|
|
sources = _wrapper_sources
|
|
}
|
|
|
|
source_set("client_wrapper_library_stubs_windows") {
|
|
sources = [
|
|
"testing/stub_flutter_windows_api.cc",
|
|
"testing/stub_flutter_windows_api.h",
|
|
]
|
|
|
|
defines = [ "FLUTTER_DESKTOP_LIBRARY" ]
|
|
|
|
public_deps = [ "//flutter/shell/platform/windows:flutter_windows_headers" ]
|
|
}
|
|
|
|
test_fixtures("client_wrapper_windows_fixtures") {
|
|
fixtures = []
|
|
}
|
|
|
|
executable("client_wrapper_windows_unittests") {
|
|
testonly = true
|
|
|
|
sources = [
|
|
"dart_project_unittests.cc",
|
|
"flutter_engine_unittests.cc",
|
|
"flutter_view_controller_unittests.cc",
|
|
"flutter_view_unittests.cc",
|
|
"plugin_registrar_windows_unittests.cc",
|
|
]
|
|
|
|
# Set embedder.h to export, not import, since the stubs are locally defined.
|
|
defines = [ "FLUTTER_DESKTOP_LIBRARY" ]
|
|
|
|
deps = [
|
|
":client_wrapper_library_stubs_windows",
|
|
":client_wrapper_windows",
|
|
":client_wrapper_windows_fixtures",
|
|
"//flutter/shell/platform/common/cpp/client_wrapper:client_wrapper_library_stubs",
|
|
"//flutter/testing",
|
|
|
|
# TODO(chunhtai): Consider refactoring flutter_root/testing so that there's a testing
|
|
# target that doesn't require a Dart runtime to be linked in.
|
|
# https://github.com/flutter/flutter/issues/41414.
|
|
"//third_party/dart/runtime:libdart_jit",
|
|
]
|
|
}
|