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

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

Issue 630223002: gn: Support build directories outside the source tree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated patch set Created 6 years, 2 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
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/label.h" 5 #include "tools/gn/label.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "tools/gn/err.h" 8 #include "tools/gn/err.h"
9 #include "tools/gn/parse_tree.h" 9 #include "tools/gn/parse_tree.h"
10 #include "tools/gn/value.h" 10 #include "tools/gn/value.h"
(...skipping 26 matching lines...) Expand all
37 37
38 // Don't allow directories to start with a single slash. All labels must be 38 // Don't allow directories to start with a single slash. All labels must be
39 // in the source root. 39 // in the source root.
40 if (input[0] == '/' && (input.size() == 1 || input[1] != '/')) { 40 if (input[0] == '/' && (input.size() == 1 || input[1] != '/')) {
41 *err = Err(input_value, "Label can't start with a single slash", 41 *err = Err(input_value, "Label can't start with a single slash",
42 "Labels must be either relative (no slash at the beginning) or be " 42 "Labels must be either relative (no slash at the beginning) or be "
43 "absolute\ninside the source root (two slashes at the beginning)."); 43 "absolute\ninside the source root (two slashes at the beginning).");
44 return false; 44 return false;
45 } 45 }
46 46
47 *result = current_dir.ResolveRelativeDir(input); 47 *result = current_dir.ResolveRelativeDir(input, base::FilePath());
48 return true; 48 return true;
49 } 49 }
50 50
51 // Given the separated-out target name (after the colon) computes the final 51 // Given the separated-out target name (after the colon) computes the final
52 // name, using the implicit name from the previously-generated 52 // name, using the implicit name from the previously-generated
53 // computed_location if necessary. The input_value is used only for generating 53 // computed_location if necessary. The input_value is used only for generating
54 // error messages. 54 // error messages.
55 bool ComputeTargetNameFromDep(const Value& input_value, 55 bool ComputeTargetNameFromDep(const Value& input_value,
56 const SourceDir& computed_location, 56 const SourceDir& computed_location,
57 const base::StringPiece& input, 57 const base::StringPiece& input,
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 } 262 }
263 return ret; 263 return ret;
264 } 264 }
265 265
266 std::string Label::GetUserVisibleName(const Label& default_toolchain) const { 266 std::string Label::GetUserVisibleName(const Label& default_toolchain) const {
267 bool include_toolchain = 267 bool include_toolchain =
268 default_toolchain.dir() != toolchain_dir_ || 268 default_toolchain.dir() != toolchain_dir_ ||
269 default_toolchain.name() != toolchain_name_; 269 default_toolchain.name() != toolchain_name_;
270 return GetUserVisibleName(include_toolchain); 270 return GetUserVisibleName(include_toolchain);
271 } 271 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698