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

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

Issue 1752033002: Add "create_bundle" target in order to support bundle with gn. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn-bundle-data
Patch Set: Add unit tests, address comments, update docs and format with clang-format Created 4 years, 9 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/target_unittest.cc ('k') | tools/gn/toolchain.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/test_with_scope.h" 5 #include "tools/gn/test_with_scope.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "tools/gn/parser.h" 10 #include "tools/gn/parser.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 // STAMP 131 // STAMP
132 scoped_ptr<Tool> stamp_tool(new Tool); 132 scoped_ptr<Tool> stamp_tool(new Tool);
133 SetCommandForTool("touch {{output}}", stamp_tool.get()); 133 SetCommandForTool("touch {{output}}", stamp_tool.get());
134 toolchain->SetTool(Toolchain::TYPE_STAMP, std::move(stamp_tool)); 134 toolchain->SetTool(Toolchain::TYPE_STAMP, std::move(stamp_tool));
135 135
136 // COPY 136 // COPY
137 scoped_ptr<Tool> copy_tool(new Tool); 137 scoped_ptr<Tool> copy_tool(new Tool);
138 SetCommandForTool("cp {{source}} {{output}}", copy_tool.get()); 138 SetCommandForTool("cp {{source}} {{output}}", copy_tool.get());
139 toolchain->SetTool(Toolchain::TYPE_COPY, std::move(copy_tool)); 139 toolchain->SetTool(Toolchain::TYPE_COPY, std::move(copy_tool));
140 140
141 // COPY_BUNDLE_DATA
142 scoped_ptr<Tool> copy_bundle_data_tool(new Tool);
143 SetCommandForTool("cp {{source}} {{output}}", copy_bundle_data_tool.get());
144 toolchain->SetTool(Toolchain::TYPE_COPY_BUNDLE_DATA,
145 std::move(copy_bundle_data_tool));
146
147 // COMPILE_XCASSETS
148 scoped_ptr<Tool> compile_xcassets_tool(new Tool);
149 SetCommandForTool("touch {{output}}", compile_xcassets_tool.get());
150 toolchain->SetTool(Toolchain::TYPE_COMPILE_XCASSETS,
151 std::move(compile_xcassets_tool));
152
141 toolchain->ToolchainSetupComplete(); 153 toolchain->ToolchainSetupComplete();
142 } 154 }
143 155
144 // static 156 // static
145 void TestWithScope::SetCommandForTool(const std::string& cmd, Tool* tool) { 157 void TestWithScope::SetCommandForTool(const std::string& cmd, Tool* tool) {
146 Err err; 158 Err err;
147 SubstitutionPattern command; 159 SubstitutionPattern command;
148 command.Parse(cmd, nullptr, &err); 160 command.Parse(cmd, nullptr, &err);
149 CHECK(!err.has_error()) 161 CHECK(!err.has_error())
150 << "Couldn't parse \"" << cmd << "\", " << "got " << err.message(); 162 << "Couldn't parse \"" << cmd << "\", " << "got " << err.message();
(...skipping 20 matching lines...) Expand all
171 const std::string& label_string, 183 const std::string& label_string,
172 Target::OutputType type) 184 Target::OutputType type)
173 : Target(setup.settings(), setup.ParseLabel(label_string)) { 185 : Target(setup.settings(), setup.ParseLabel(label_string)) {
174 visibility().SetPublic(); 186 visibility().SetPublic();
175 set_output_type(type); 187 set_output_type(type);
176 SetToolchain(setup.toolchain()); 188 SetToolchain(setup.toolchain());
177 } 189 }
178 190
179 TestTarget::~TestTarget() { 191 TestTarget::~TestTarget() {
180 } 192 }
OLDNEW
« no previous file with comments | « tools/gn/target_unittest.cc ('k') | tools/gn/toolchain.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698