OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "tools/gn/setup.h" | 5 #include "tools/gn/setup.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <sstream> | 9 #include <sstream> |
10 #include <utility> | 10 #include <utility> |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 } | 514 } |
515 | 515 |
516 if (scheduler_.verbose_logging()) | 516 if (scheduler_.verbose_logging()) |
517 scheduler_.Log("Using source root", FilePathToUTF8(root_path)); | 517 scheduler_.Log("Using source root", FilePathToUTF8(root_path)); |
518 build_settings_.SetRootPath(root_path); | 518 build_settings_.SetRootPath(root_path); |
519 | 519 |
520 return true; | 520 return true; |
521 } | 521 } |
522 | 522 |
523 bool Setup::FillBuildDir(const std::string& build_dir, bool require_exists) { | 523 bool Setup::FillBuildDir(const std::string& build_dir, bool require_exists) { |
524 #if defined(OS_POSIX) | |
525 // Expand all ./, ../, and symbolic links in build_dir. | |
526 char realpath_buf[PATH_MAX]; | |
527 if (!realpath(build_dir.c_str(), realpath_buf)) { | |
528 Err(Location(), "Can't normalize the build directory path.", | |
529 strerror(errno)) .PrintToStdout(); | |
530 return false; | |
531 } | |
532 const std::string build_dir_realpath = realpath_buf; | |
533 #else | |
534 const std::string& build_dir_realpath = build_dir; | |
535 #endif | |
536 | |
537 Err err; | 524 Err err; |
538 SourceDir resolved = | 525 SourceDir resolved = |
539 SourceDirForCurrentDirectory(build_settings_.root_path()). | 526 SourceDirForCurrentDirectory(build_settings_.root_path()). |
540 ResolveRelativeDir(Value(nullptr, build_dir_realpath), &err, | 527 ResolveRelativeDir(Value(nullptr, build_dir), &err, |
541 build_settings_.root_path_utf8()); | 528 build_settings_.root_path_utf8()); |
542 if (err.has_error()) { | 529 if (err.has_error()) { |
543 err.PrintToStdout(); | 530 err.PrintToStdout(); |
544 return false; | 531 return false; |
545 } | 532 } |
546 | 533 |
547 if (scheduler_.verbose_logging()) | 534 if (scheduler_.verbose_logging()) |
548 scheduler_.Log("Using build dir", resolved.value()); | 535 scheduler_.Log("Using build dir", resolved.value()); |
549 | 536 |
550 if (require_exists) { | 537 if (require_exists) { |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 if (err.has_error()) { | 684 if (err.has_error()) { |
698 err.PrintToStdout(); | 685 err.PrintToStdout(); |
699 return false; | 686 return false; |
700 } | 687 } |
701 } | 688 } |
702 build_settings_.set_exec_script_whitelist(std::move(whitelist)); | 689 build_settings_.set_exec_script_whitelist(std::move(whitelist)); |
703 } | 690 } |
704 | 691 |
705 return true; | 692 return true; |
706 } | 693 } |
OLD | NEW |