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

Side by Side Diff: tools/gn/setup.cc

Issue 1155713006: GN: Make file/dir resolving return errors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « tools/gn/label_pattern.cc ('k') | tools/gn/source_dir.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <sstream> 10 #include <sstream>
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 } 440 }
441 441
442 if (scheduler_.verbose_logging()) 442 if (scheduler_.verbose_logging())
443 scheduler_.Log("Using source root", FilePathToUTF8(root_path)); 443 scheduler_.Log("Using source root", FilePathToUTF8(root_path));
444 build_settings_.SetRootPath(root_path); 444 build_settings_.SetRootPath(root_path);
445 445
446 return true; 446 return true;
447 } 447 }
448 448
449 bool Setup::FillBuildDir(const std::string& build_dir, bool require_exists) { 449 bool Setup::FillBuildDir(const std::string& build_dir, bool require_exists) {
450 Err err;
450 SourceDir resolved = 451 SourceDir resolved =
451 SourceDirForCurrentDirectory(build_settings_.root_path()). 452 SourceDirForCurrentDirectory(build_settings_.root_path()).
452 ResolveRelativeDir(build_dir, build_settings_.root_path_utf8()); 453 ResolveRelativeDir(Value(nullptr, build_dir), &err,
453 if (resolved.is_null()) { 454 build_settings_.root_path_utf8());
454 Err(Location(), "Couldn't resolve build directory.", 455 if (err.has_error()) {
455 "The build directory supplied (\"" + build_dir + "\") was not valid."). 456 err.PrintToStdout();
456 PrintToStdout();
457 return false; 457 return false;
458 } 458 }
459 459
460 if (scheduler_.verbose_logging()) 460 if (scheduler_.verbose_logging())
461 scheduler_.Log("Using build dir", resolved.value()); 461 scheduler_.Log("Using build dir", resolved.value());
462 462
463 if (require_exists) { 463 if (require_exists) {
464 base::FilePath build_dir_path = build_settings_.GetFullPath(resolved); 464 base::FilePath build_dir_path = build_settings_.GetFullPath(resolved);
465 if (!base::PathExists(build_dir_path.Append( 465 if (!base::PathExists(build_dir_path.Append(
466 FILE_PATH_LITERAL("build.ninja")))) { 466 FILE_PATH_LITERAL("build.ninja")))) {
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 if (!exec_script_whitelist_value->VerifyTypeIs(Value::LIST, &err)) { 615 if (!exec_script_whitelist_value->VerifyTypeIs(Value::LIST, &err)) {
616 err.PrintToStdout(); 616 err.PrintToStdout();
617 return false; 617 return false;
618 } 618 }
619 scoped_ptr<std::set<SourceFile>> whitelist(new std::set<SourceFile>); 619 scoped_ptr<std::set<SourceFile>> whitelist(new std::set<SourceFile>);
620 for (const auto& item : exec_script_whitelist_value->list_value()) { 620 for (const auto& item : exec_script_whitelist_value->list_value()) {
621 if (!item.VerifyTypeIs(Value::STRING, &err)) { 621 if (!item.VerifyTypeIs(Value::STRING, &err)) {
622 err.PrintToStdout(); 622 err.PrintToStdout();
623 return false; 623 return false;
624 } 624 }
625 whitelist->insert(current_dir.ResolveRelativeFile(item.string_value())); 625 whitelist->insert(current_dir.ResolveRelativeFile(item, &err));
626 if (err.has_error()) {
627 err.PrintToStdout();
628 return false;
629 }
626 } 630 }
627 build_settings_.set_exec_script_whitelist(whitelist.Pass()); 631 build_settings_.set_exec_script_whitelist(whitelist.Pass());
628 } 632 }
629 633
630 return true; 634 return true;
631 } 635 }
OLDNEW
« no previous file with comments | « tools/gn/label_pattern.cc ('k') | tools/gn/source_dir.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698