From 86d1e4f835099424eb9dfe16d80a3d89780cd040 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Wed, 16 Jan 2019 12:47:39 -0800 Subject: [PATCH] Deprecate FlutterProjectArgs.main_path, packages_path (flutter/engine#7497) As of Dart 2, running from Dart source is no longer supported. Dart code should now be compiled to kernel form and will be loaded by from kernel.blob in the assets directory. We retain the struct members for ABI stability. package_path is also not required since kernel blobs are self-contained. --- .../shell/platform/embedder/embedder.cc | 10 ++++++++++ .../shell/platform/embedder/embedder.h | 20 ++++++++++++++----- .../embedder/tests/embedder_unittests.cc | 2 -- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/engine/src/flutter/shell/platform/embedder/embedder.cc b/engine/src/flutter/shell/platform/embedder/embedder.cc index c8c965fdd68..b719d1ca1d2 100644 --- a/engine/src/flutter/shell/platform/embedder/embedder.cc +++ b/engine/src/flutter/shell/platform/embedder/embedder.cc @@ -270,6 +270,16 @@ FlutterResult FlutterEngineRun(size_t version, return kInvalidArguments; } + if (SAFE_ACCESS(args, main_path__unused__, nullptr) != nullptr) { + FML_LOG(WARNING) + << "FlutterProjectArgs.main_path is deprecated and should be set null."; + } + + if (SAFE_ACCESS(args, packages_path__unused__, nullptr) != nullptr) { + FML_LOG(WARNING) << "FlutterProjectArgs.packages_path is deprecated and " + "should be set null."; + } + if (!IsRendererValid(config)) { return kInvalidArguments; } diff --git a/engine/src/flutter/shell/platform/embedder/embedder.h b/engine/src/flutter/shell/platform/embedder/embedder.h index 535fb702dc5..069578522ad 100644 --- a/engine/src/flutter/shell/platform/embedder/embedder.h +++ b/engine/src/flutter/shell/platform/embedder/embedder.h @@ -185,14 +185,24 @@ typedef struct { // string can be collected after the call to |FlutterEngineRun| returns. The // string must be NULL terminated. const char* assets_path; - // The path to the Dart file containing the |main| entry point. The string can - // be collected after the call to |FlutterEngineRun| returns. The string must - // be NULL terminated. - const char* main_path; + // The path to the Dart file containing the |main| entry point. + // The string can be collected after the call to |FlutterEngineRun| returns. + // The string must be NULL terminated. + // + // \deprecated As of Dart 2, running from Dart source is no longer supported. + // Dart code should now be compiled to kernel form and will be loaded by from + // |kernel_blob.bin| in the assets directory. This struct member is retained + // for ABI stability. + const char* main_path__unused__; // The path to the |.packages| for the project. The string can be collected // after the call to |FlutterEngineRun| returns. The string must be NULL // terminated. - const char* packages_path; + // + // \deprecated As of Dart 2, running from Dart source is no longer supported. + // Dart code should now be compiled to kernel form and will be loaded by from + // |kernel_blob.bin| in the assets directory. This struct member is retained + // for ABI stability. + const char* packages_path__unused__; // The path to the icudtl.dat file for the project. The string can be // collected after the call to |FlutterEngineRun| returns. The string must // be NULL terminated. diff --git a/engine/src/flutter/shell/platform/embedder/tests/embedder_unittests.cc b/engine/src/flutter/shell/platform/embedder/tests/embedder_unittests.cc index 266cf92e55a..deaf8206b66 100644 --- a/engine/src/flutter/shell/platform/embedder/tests/embedder_unittests.cc +++ b/engine/src/flutter/shell/platform/embedder/tests/embedder_unittests.cc @@ -29,8 +29,6 @@ TEST(EmbedderTest, CanLaunchAndShutdownWithValidProjectArgs) { FlutterProjectArgs args = {}; args.struct_size = sizeof(FlutterProjectArgs); args.assets_path = testing::GetFixturesPath(); - args.main_path = ""; - args.packages_path = ""; FlutterEngine engine = nullptr; FlutterResult result = FlutterEngineRun(FLUTTER_ENGINE_VERSION, &config,