| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stdlib.h> | 5 #include <stdlib.h> |
| 6 #include <string.h> | 6 #include <string.h> |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 | 8 |
| 9 #include "include/dart_api.h" | 9 #include "include/dart_api.h" |
| 10 #include "include/dart_tools_api.h" | 10 #include "include/dart_tools_api.h" |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 } | 487 } |
| 488 | 488 |
| 489 | 489 |
| 490 static bool ProcessShortSocketWriteOption(const char* arg, | 490 static bool ProcessShortSocketWriteOption(const char* arg, |
| 491 CommandLineOptions* vm_options) { | 491 CommandLineOptions* vm_options) { |
| 492 short_socket_write = true; | 492 short_socket_write = true; |
| 493 return true; | 493 return true; |
| 494 } | 494 } |
| 495 | 495 |
| 496 | 496 |
| 497 #if !defined(TARGET_OS_MACOS) |
| 498 extern const char* commandline_root_certs_file; |
| 499 extern const char* commandline_root_certs_cache; |
| 500 |
| 501 static bool ProcessRootCertsFileOption(const char* arg, |
| 502 CommandLineOptions* vm_options) { |
| 503 ASSERT(arg != NULL); |
| 504 if (*arg == '-') { |
| 505 return false; |
| 506 } |
| 507 if (commandline_root_certs_cache != NULL) { |
| 508 Log::PrintErr("Only one of --root-certs-file and --root-certs-cache " |
| 509 "may be specified"); |
| 510 return false; |
| 511 } |
| 512 commandline_root_certs_file = arg; |
| 513 return true; |
| 514 } |
| 515 |
| 516 |
| 517 static bool ProcessRootCertsCacheOption(const char* arg, |
| 518 CommandLineOptions* vm_options) { |
| 519 ASSERT(arg != NULL); |
| 520 if (*arg == '-') { |
| 521 return false; |
| 522 } |
| 523 if (commandline_root_certs_file != NULL) { |
| 524 Log::PrintErr("Only one of --root-certs-file and --root-certs-cache " |
| 525 "may be specified"); |
| 526 return false; |
| 527 } |
| 528 commandline_root_certs_cache = arg; |
| 529 return true; |
| 530 } |
| 531 #endif // !defined(TARGET_OS_MACOS) |
| 532 |
| 533 |
| 497 static struct { | 534 static struct { |
| 498 const char* option_name; | 535 const char* option_name; |
| 499 bool (*process)(const char* option, CommandLineOptions* vm_options); | 536 bool (*process)(const char* option, CommandLineOptions* vm_options); |
| 500 } main_options[] = { | 537 } main_options[] = { |
| 501 // Standard options shared with dart2js. | 538 // Standard options shared with dart2js. |
| 502 { "-D", ProcessEnvironmentOption }, | 539 { "-D", ProcessEnvironmentOption }, |
| 503 { "-h", ProcessHelpOption }, | 540 { "-h", ProcessHelpOption }, |
| 504 { "--help", ProcessHelpOption }, | 541 { "--help", ProcessHelpOption }, |
| 505 { "--packages=", ProcessPackagesOption }, | 542 { "--packages=", ProcessPackagesOption }, |
| 506 { "--package-root=", ProcessPackageRootOption }, | 543 { "--package-root=", ProcessPackageRootOption }, |
| 507 { "-v", ProcessVerboseOption }, | 544 { "-v", ProcessVerboseOption }, |
| 508 { "--verbose", ProcessVerboseOption }, | 545 { "--verbose", ProcessVerboseOption }, |
| 509 { "--version", ProcessVersionOption }, | 546 { "--version", ProcessVersionOption }, |
| 510 | 547 |
| 511 // VM specific options to the standalone dart program. | 548 // VM specific options to the standalone dart program. |
| 512 { "--compile_all", ProcessCompileAllOption }, | 549 { "--compile_all", ProcessCompileAllOption }, |
| 513 { "--enable-vm-service", ProcessEnableVmServiceOption }, | 550 { "--enable-vm-service", ProcessEnableVmServiceOption }, |
| 514 { "--disable-service-origin-check", ProcessDisableServiceOriginCheckOption }, | 551 { "--disable-service-origin-check", ProcessDisableServiceOriginCheckOption }, |
| 515 { "--observe", ProcessObserveOption }, | 552 { "--observe", ProcessObserveOption }, |
| 516 { "--snapshot=", ProcessSnapshotFilenameOption }, | 553 { "--snapshot=", ProcessSnapshotFilenameOption }, |
| 517 { "--snapshot-kind=", ProcessSnapshotKindOption }, | 554 { "--snapshot-kind=", ProcessSnapshotKindOption }, |
| 518 { "--run-app-snapshot=", ProcessRunAppSnapshotOption }, | 555 { "--run-app-snapshot=", ProcessRunAppSnapshotOption }, |
| 519 { "--use-blobs", ProcessUseBlobsOption }, | 556 { "--use-blobs", ProcessUseBlobsOption }, |
| 520 { "--trace-loading", ProcessTraceLoadingOption }, | 557 { "--trace-loading", ProcessTraceLoadingOption }, |
| 521 { "--hot-reload-test-mode", ProcessHotReloadTestModeOption }, | 558 { "--hot-reload-test-mode", ProcessHotReloadTestModeOption }, |
| 522 { "--hot-reload-rollback-test-mode", ProcessHotReloadRollbackTestModeOption }, | 559 { "--hot-reload-rollback-test-mode", ProcessHotReloadRollbackTestModeOption }, |
| 523 { "--short_socket_read", ProcessShortSocketReadOption }, | 560 { "--short_socket_read", ProcessShortSocketReadOption }, |
| 524 { "--short_socket_write", ProcessShortSocketWriteOption }, | 561 { "--short_socket_write", ProcessShortSocketWriteOption }, |
| 562 #if !defined(TARGET_OS_MACOS) |
| 563 { "--root-certs-file=", ProcessRootCertsFileOption }, |
| 564 { "--root-certs-cache=", ProcessRootCertsCacheOption }, |
| 565 #endif // !defined(TARGET_OS_MACOS) |
| 525 { NULL, NULL } | 566 { NULL, NULL } |
| 526 }; | 567 }; |
| 527 | 568 |
| 528 | 569 |
| 529 static bool ProcessMainOptions(const char* option, | 570 static bool ProcessMainOptions(const char* option, |
| 530 CommandLineOptions* vm_options) { | 571 CommandLineOptions* vm_options) { |
| 531 int i = 0; | 572 int i = 0; |
| 532 const char* name = main_options[0].option_name; | 573 const char* name = main_options[0].option_name; |
| 533 int option_length = strlen(option); | 574 int option_length = strlen(option); |
| 534 while (name != NULL) { | 575 while (name != NULL) { |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 953 "\n" | 994 "\n" |
| 954 "--snapshot=<file_name>\n" | 995 "--snapshot=<file_name>\n" |
| 955 " loads Dart script and generates a snapshot in the specified file\n" | 996 " loads Dart script and generates a snapshot in the specified file\n" |
| 956 "\n" | 997 "\n" |
| 957 "--trace-loading\n" | 998 "--trace-loading\n" |
| 958 " enables tracing of library and script loading\n" | 999 " enables tracing of library and script loading\n" |
| 959 "\n" | 1000 "\n" |
| 960 "--enable-vm-service[=<port>[/<bind-address>]]\n" | 1001 "--enable-vm-service[=<port>[/<bind-address>]]\n" |
| 961 " enables the VM service and listens on specified port for connections\n" | 1002 " enables the VM service and listens on specified port for connections\n" |
| 962 " (default port number is 8181, default bind address is 127.0.0.1).\n" | 1003 " (default port number is 8181, default bind address is 127.0.0.1).\n" |
| 1004 #if !defined(TARGET_OS_MACOS) |
| 1005 "\n" |
| 1006 "--root-certs-file=<path>\n" |
| 1007 " The path to a file containing the trusted root certificates to use for\n" |
| 1008 " secure socket connections.\n" |
| 1009 "--root-certs-cache=<path>\n" |
| 1010 " The path to a cache directory containing the trusted root certificates to\n" |
| 1011 " use for secure socket connections.\n" |
| 1012 #endif // !defined(TARGET_OS_MACOS) |
| 963 "\n" | 1013 "\n" |
| 964 "The following options are only used for VM development and may\n" | 1014 "The following options are only used for VM development and may\n" |
| 965 "be changed in any future version:\n"); | 1015 "be changed in any future version:\n"); |
| 966 const char* print_flags = "--print_flags"; | 1016 const char* print_flags = "--print_flags"; |
| 967 Dart_SetVMFlags(1, &print_flags); | 1017 Dart_SetVMFlags(1, &print_flags); |
| 968 } | 1018 } |
| 969 } | 1019 } |
| 970 | 1020 |
| 971 | 1021 |
| 972 char* BuildIsolateName(const char* script_name, | 1022 char* BuildIsolateName(const char* script_name, |
| (...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1817 Platform::Exit(Process::GlobalExitCode()); | 1867 Platform::Exit(Process::GlobalExitCode()); |
| 1818 } | 1868 } |
| 1819 | 1869 |
| 1820 } // namespace bin | 1870 } // namespace bin |
| 1821 } // namespace dart | 1871 } // namespace dart |
| 1822 | 1872 |
| 1823 int main(int argc, char** argv) { | 1873 int main(int argc, char** argv) { |
| 1824 dart::bin::main(argc, argv); | 1874 dart::bin::main(argc, argv); |
| 1825 UNREACHABLE(); | 1875 UNREACHABLE(); |
| 1826 } | 1876 } |
| OLD | NEW |