| 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 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1817 Platform::Exit(Process::GlobalExitCode()); | 1858 Platform::Exit(Process::GlobalExitCode()); |
| 1818 } | 1859 } |
| 1819 | 1860 |
| 1820 } // namespace bin | 1861 } // namespace bin |
| 1821 } // namespace dart | 1862 } // namespace dart |
| 1822 | 1863 |
| 1823 int main(int argc, char** argv) { | 1864 int main(int argc, char** argv) { |
| 1824 dart::bin::main(argc, argv); | 1865 dart::bin::main(argc, argv); |
| 1825 UNREACHABLE(); | 1866 UNREACHABLE(); |
| 1826 } | 1867 } |
| OLD | NEW |