mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Standard*Codec allows for extensions to support arbitrary types; this had not previously been implemented for the C++ version. Overview of changes: - EncodableValue's std::variant type now allows for a new CustomEncodableValue, which is a thin wrapper around std::any, to store arbitrary extension types. - ByteBufferStream* has been split into an interface class and the buffer-based implementation, with the former now part of the public API surface to be used in standard codec extensions. - They also gained utility methods for some common data types to simplify writing extensions. - StandardCodecSerializer is now part of the public API surface, and is subclassable. - StandardCodecSerializer's ReadValue has been split into ReadValue and ReadValueOfType to match the structure used when subclassing on the Dart side, for easier porting of custom extensions across languages. - Standard*Codec now optionally accepts a non-default serializer in GetInstance, providing a shared instance using that serializer. Fixes https://github.com/flutter/flutter/issues/31174
69 lines
1.9 KiB
Plaintext
69 lines
1.9 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
|
|
|
|
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" ]
|
|
}
|
|
|
|
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",
|
|
"//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" ]
|
|
}
|