| Index: runtime/bin/dartutils.cc
|
| diff --git a/runtime/bin/dartutils.cc b/runtime/bin/dartutils.cc
|
| index 83ffcd35f994e5b5ed2c8a97908e91a960927c50..3c01e64f8f7cbd986fb0083a436aba90869f5d91 100644
|
| --- a/runtime/bin/dartutils.cc
|
| +++ b/runtime/bin/dartutils.cc
|
| @@ -637,6 +637,7 @@ Dart_Handle DartUtils::PrepareBuiltinLibrary(Dart_Handle builtin_lib,
|
| bool is_service_isolate,
|
| bool trace_loading,
|
| const char* package_root,
|
| + const char** package_map,
|
| const char* packages_file) {
|
| // Setup the internal library's 'internalPrint' function.
|
| Dart_Handle print = Dart_Invoke(
|
| @@ -670,6 +671,7 @@ Dart_Handle DartUtils::PrepareBuiltinLibrary(Dart_Handle builtin_lib,
|
|
|
| // Set up package root if specified.
|
| if (package_root != NULL) {
|
| + ASSERT(package_map == NULL);
|
| ASSERT(packages_file == NULL);
|
| result = NewString(package_root);
|
| RETURN_IF_ERROR(result);
|
| @@ -681,6 +683,33 @@ Dart_Handle DartUtils::PrepareBuiltinLibrary(Dart_Handle builtin_lib,
|
| kNumArgs,
|
| dart_args);
|
| RETURN_IF_ERROR(result);
|
| + } else if (package_map != NULL) {
|
| + ASSERT(packages_file == NULL);
|
| + Dart_Handle func_name = NewString("_addPackageMapEntry");
|
| + RETURN_IF_ERROR(func_name);
|
| +
|
| + for (int i = 0; package_map[i] != NULL; i +=2) {
|
| + const int kNumArgs = 2;
|
| + Dart_Handle dart_args[kNumArgs];
|
| + // Get the key.
|
| + result = NewString(package_map[i]);
|
| + RETURN_IF_ERROR(result);
|
| + dart_args[0] = result;
|
| + if (package_map[i + 1] == NULL) {
|
| + return Dart_NewUnhandledExceptionError(
|
| + NewDartArgumentError("Adding package map entry without value."));
|
| + }
|
| + // Get the value.
|
| + result = NewString(package_map[i + 1]);
|
| + RETURN_IF_ERROR(result);
|
| + dart_args[1] = result;
|
| + // Setup the next package map entry.
|
| + result = Dart_Invoke(builtin_lib,
|
| + func_name,
|
| + kNumArgs,
|
| + dart_args);
|
| + RETURN_IF_ERROR(result);
|
| + }
|
| } else if (packages_file != NULL) {
|
| result = NewString(packages_file);
|
| RETURN_IF_ERROR(result);
|
| @@ -738,6 +767,7 @@ Dart_Handle DartUtils::PrepareIsolateLibrary(Dart_Handle isolate_lib) {
|
|
|
|
|
| Dart_Handle DartUtils::PrepareForScriptLoading(const char* package_root,
|
| + const char** package_map,
|
| const char* packages_file,
|
| bool is_service_isolate,
|
| bool trace_loading,
|
| @@ -772,6 +802,7 @@ Dart_Handle DartUtils::PrepareForScriptLoading(const char* package_root,
|
| is_service_isolate,
|
| trace_loading,
|
| package_root,
|
| + package_map,
|
| packages_file);
|
| RETURN_IF_ERROR(result);
|
|
|
|
|