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

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

Issue 2006923004: Add support for user defined "pool" to GN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 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
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "tools/gn/pool.h"
6
7 #include <sstream>
8
9 #include "base/logging.h"
10
11 Pool::Pool(const Settings* settings, const Label& label)
12 : Item(settings, label) {}
13
14 Pool::~Pool() {}
15
16 Pool* Pool::AsPool() {
17 return this;
18 }
19
20 const Pool* Pool::AsPool() const {
21 return this;
22 }
23
24 std::string Pool::GetNinjaName(const Label& default_toolchain) const {
25 bool include_toolchain = label().toolchain_dir() != default_toolchain.dir() ||
26 label().toolchain_name() != default_toolchain.name();
27 return GetNinjaName(include_toolchain);
28 }
29
30 std::string Pool::GetNinjaName(bool include_toolchain) const {
31 std::ostringstream buffer;
32 if (include_toolchain) {
33 DCHECK(label().toolchain_dir().is_source_absolute());
34 std::string toolchain_dir = label().toolchain_dir().value();
35 for (std::string::size_type i = 2; i < toolchain_dir.size(); ++i) {
36 buffer << (toolchain_dir[i] == '/' ? '_' : toolchain_dir[i]);
37 }
38 buffer << label().toolchain_name() << "_";
39 }
40
41 DCHECK(label().dir().is_source_absolute());
42 std::string label_dir = label().dir().value();
43 for (std::string::size_type i = 2; i < label_dir.size(); ++i) {
44 buffer << (label_dir[i] == '/' ? '_' : label_dir[i]);
45 }
46 buffer << label().name();
47 return buffer.str();
48 }
OLDNEW
« tools/gn/functions.cc ('K') | « tools/gn/pool.h ('k') | tools/gn/tool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698