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.
This commit is contained in:
Chris Bracken 2019-01-16 12:47:39 -08:00 committed by GitHub
parent 8c111d9e25
commit 86d1e4f835
3 changed files with 25 additions and 7 deletions

View File

@ -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;
}

View File

@ -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.

View File

@ -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,