stuartmorgan 32b1b70e27
[windows] Expose the binary messenger from FlutterEngine (#20551)
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
2020-08-17 05:44:48 -07:00

119 lines
3.5 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/testing/testing.gni")
import("core_wrapper_files.gni")
# Client library build for internal use by the shell implementation.
source_set("client_wrapper") {
sources = core_cpp_client_wrapper_sources
public = core_cpp_client_wrapper_includes +
core_cpp_client_wrapper_internal_headers
deps = [ "//flutter/shell/platform/common/cpp:common_cpp_library_headers" ]
configs +=
[ "//flutter/shell/platform/common/cpp:desktop_library_implementation" ]
public_configs =
[ "//flutter/shell/platform/common/cpp:relative_flutter_library_headers" ]
}
# Temporary test for the legacy EncodableValue implementation. Remove once the
# legacy version is removed.
source_set("client_wrapper_legacy_encodable_value") {
sources = core_cpp_client_wrapper_sources
public = core_cpp_client_wrapper_includes +
core_cpp_client_wrapper_internal_headers
deps = [ "//flutter/shell/platform/common/cpp:common_cpp_library_headers" ]
configs +=
[ "//flutter/shell/platform/common/cpp:desktop_library_implementation" ]
defines = [ "USE_LEGACY_ENCODABLE_VALUE" ]
public_configs =
[ "//flutter/shell/platform/common/cpp:relative_flutter_library_headers" ]
}
source_set("client_wrapper_library_stubs") {
sources = [
"testing/stub_flutter_api.cc",
"testing/stub_flutter_api.h",
]
defines = [ "FLUTTER_DESKTOP_LIBRARY" ]
public_deps =
[ "//flutter/shell/platform/common/cpp:common_cpp_library_headers" ]
}
test_fixtures("client_wrapper_fixtures") {
fixtures = []
}
executable("client_wrapper_unittests") {
testonly = true
sources = [
"basic_message_channel_unittests.cc",
"encodable_value_unittests.cc",
"event_channel_unittests.cc",
"method_call_unittests.cc",
"method_channel_unittests.cc",
"method_result_functions_unittests.cc",
"plugin_registrar_unittests.cc",
"standard_message_codec_unittests.cc",
"standard_method_codec_unittests.cc",
"testing/test_codec_extensions.cc",
"testing/test_codec_extensions.h",
]
deps = [
":client_wrapper",
":client_wrapper_fixtures",
":client_wrapper_library_stubs",
# Build the legacy version as well as a sanity check.
":client_wrapper_unittests_legacy_encodable_value",
"//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",
]
defines = [ "FLUTTER_DESKTOP_LIBRARY" ]
}
# Ensures that the legacy EncodableValue codepath still compiles.
executable("client_wrapper_unittests_legacy_encodable_value") {
testonly = true
sources = [
"encodable_value_unittests.cc",
"standard_message_codec_unittests.cc",
"testing/test_codec_extensions.h",
]
deps = [
":client_wrapper_fixtures",
":client_wrapper_legacy_encodable_value",
":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",
]
defines = [
"FLUTTER_DESKTOP_LIBRARY",
"USE_LEGACY_ENCODABLE_VALUE",
]
}