Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(499)

Unified Diff: runtime/bin/gen_snapshot.cc

Issue 2044673002: Add --packages option to gen_snapshot in order to accept package map files (see https://github.com/… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: address-code-review Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/tools/create_snapshot_bin.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/gen_snapshot.cc
diff --git a/runtime/bin/gen_snapshot.cc b/runtime/bin/gen_snapshot.cc
index 3cea08e8654fe9303a4b545022aee105225b9965..5d701751a764c5ac0ef845648105e8ad70e9d053 100644
--- a/runtime/bin/gen_snapshot.cc
+++ b/runtime/bin/gen_snapshot.cc
@@ -63,7 +63,17 @@ static const char* isolate_snapshot_filename = NULL;
static const char* assembly_filename = NULL;
static const char* instructions_blob_filename = NULL;
static const char* rodata_blob_filename = NULL;
-static const char* package_root = NULL;
+
+
+// Value of the --package-root flag.
+// (This pointer points into an argv buffer and does not need to be
+// free'd.)
+static const char* commandline_package_root = NULL;
+
+// Value of the --packages flag.
+// (This pointer points into an argv buffer and does not need to be
+// free'd.)
+static const char* commandline_packages_file = NULL;
// Global state which contains a pointer to the script name for which
@@ -249,7 +259,17 @@ static bool ProcessPackageRootOption(const char* option) {
name = ProcessOption(option, "--package-root=");
}
if (name != NULL) {
- package_root = name;
+ commandline_package_root = name;
+ return true;
+ }
+ return false;
+}
+
+
+static bool ProcessPackagesOption(const char* option) {
+ const char* name = ProcessOption(option, "--packages=");
+ if (name != NULL) {
+ commandline_packages_file = name;
return true;
}
return false;
@@ -296,6 +316,7 @@ static int ParseArguments(int argc,
ProcessEmbedderEntryPointsManifestOption(argv[i]) ||
ProcessURLmappingOption(argv[i]) ||
ProcessPackageRootOption(argv[i]) ||
+ ProcessPackagesOption(argv[i]) ||
ProcessEnvironmentOption(argv[i])) {
i += 1;
continue;
@@ -312,6 +333,14 @@ static int ParseArguments(int argc,
*script_name = NULL;
}
+ // Verify consistency of arguments.
+ if ((commandline_package_root != NULL) &&
+ (commandline_packages_file != NULL)) {
+ Log::PrintErr("Specifying both a packages directory and a packages "
+ "file is invalid.\n");
+ return -1;
+ }
+
if (vm_isolate_snapshot_filename == NULL) {
Log::PrintErr("No vm isolate snapshot output file specified.\n\n");
return -1;
@@ -646,6 +675,8 @@ static void PrintUsage() {
" --package_root=<path> Where to find packages, that is, \n"
" package:... imports. \n"
" \n"
+" --packages=<packages_file> Where to find a package spec file \n"
+" \n"
" --url_mapping=<mapping> Uses the URL mapping(s) specified on \n"
" the command line to load the \n"
" libraries. \n"
@@ -1286,7 +1317,8 @@ int main(int argc, char** argv) {
CHECK_RESULT(result);
// Setup package root if specified.
- result = DartUtils::SetupPackageRoot(package_root, NULL);
+ result = DartUtils::SetupPackageRoot(commandline_package_root,
+ commandline_packages_file);
CHECK_RESULT(result);
Dart_ExitScope();
« no previous file with comments | « no previous file | runtime/tools/create_snapshot_bin.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698