Skip to content

Commit

Permalink
Deprecate FlutterProjectArgs.main_path, packages_path (flutter#7497)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cbracken authored Jan 16, 2019
1 parent b058920 commit 1e93a8e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
10 changes: 10 additions & 0 deletions shell/platform/embedder/embedder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
20 changes: 15 additions & 5 deletions shell/platform/embedder/embedder.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 0 additions & 2 deletions shell/platform/embedder/tests/embedder_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 1e93a8e

Please sign in to comment.