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

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

Issue 561273003: Add public deps to GN (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 6 years, 3 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/ninja_action_target_writer.cc ('k') | tools/gn/ninja_binary_target_writer.cc » ('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 <algorithm> 5 #include <algorithm>
6 #include <sstream> 6 #include <sstream>
7 7
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "tools/gn/ninja_action_target_writer.h" 9 #include "tools/gn/ninja_action_target_writer.h"
10 #include "tools/gn/substitution_list.h" 10 #include "tools/gn/substitution_list.h"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 Err err; 155 Err err;
156 156
157 setup.build_settings()->SetBuildDir(SourceDir("//out/Debug/")); 157 setup.build_settings()->SetBuildDir(SourceDir("//out/Debug/"));
158 158
159 // Some dependencies that the action can depend on. Use actions for these 159 // Some dependencies that the action can depend on. Use actions for these
160 // so they have a nice platform-independent stamp file that can appear in the 160 // so they have a nice platform-independent stamp file that can appear in the
161 // output (rather than having to worry about how the current platform names 161 // output (rather than having to worry about how the current platform names
162 // binaries). 162 // binaries).
163 Target dep(setup.settings(), Label(SourceDir("//foo/"), "dep")); 163 Target dep(setup.settings(), Label(SourceDir("//foo/"), "dep"));
164 dep.set_output_type(Target::ACTION); 164 dep.set_output_type(Target::ACTION);
165 dep.visibility().SetPublic();
165 dep.SetToolchain(setup.toolchain()); 166 dep.SetToolchain(setup.toolchain());
166 ASSERT_TRUE(dep.OnResolved(&err)); 167 ASSERT_TRUE(dep.OnResolved(&err));
167 168
168 Target datadep(setup.settings(), Label(SourceDir("//foo/"), "datadep")); 169 Target datadep(setup.settings(), Label(SourceDir("//foo/"), "datadep"));
169 datadep.set_output_type(Target::ACTION); 170 datadep.set_output_type(Target::ACTION);
171 datadep.visibility().SetPublic();
170 datadep.SetToolchain(setup.toolchain()); 172 datadep.SetToolchain(setup.toolchain());
171 ASSERT_TRUE(datadep.OnResolved(&err)); 173 ASSERT_TRUE(datadep.OnResolved(&err));
172 174
173 Target target(setup.settings(), Label(SourceDir("//foo/"), "bar")); 175 Target target(setup.settings(), Label(SourceDir("//foo/"), "bar"));
174 target.set_output_type(Target::ACTION_FOREACH); 176 target.set_output_type(Target::ACTION_FOREACH);
175 target.deps().push_back(LabelTargetPair(&dep)); 177 target.private_deps().push_back(LabelTargetPair(&dep));
176 target.datadeps().push_back(LabelTargetPair(&datadep)); 178 target.data_deps().push_back(LabelTargetPair(&datadep));
177 179
178 target.sources().push_back(SourceFile("//foo/input1.txt")); 180 target.sources().push_back(SourceFile("//foo/input1.txt"));
179 target.sources().push_back(SourceFile("//foo/input2.txt")); 181 target.sources().push_back(SourceFile("//foo/input2.txt"));
180 182
181 target.action_values().set_script(SourceFile("//foo/script.py")); 183 target.action_values().set_script(SourceFile("//foo/script.py"));
182 184
183 target.action_values().args() = SubstitutionList::MakeForTest( 185 target.action_values().args() = SubstitutionList::MakeForTest(
184 "-i", 186 "-i",
185 "{{source}}", 187 "{{source}}",
186 "--out=foo bar{{source_name_part}}.o"); 188 "--out=foo bar{{source_name_part}}.o");
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 "build input2.out: __foo_bar___rule ../../foo/input2.txt" 376 "build input2.out: __foo_bar___rule ../../foo/input2.txt"
375 " | obj/foo/bar.inputdeps.stamp\n" 377 " | obj/foo/bar.inputdeps.stamp\n"
376 " unique_name = 1\n" 378 " unique_name = 1\n"
377 " source_name_part = input2\n" 379 " source_name_part = input2\n"
378 " depfile = gen/input2.d\n" 380 " depfile = gen/input2.d\n"
379 "\n" 381 "\n"
380 "build obj/foo/bar.stamp: stamp input1.out input2.out\n"; 382 "build obj/foo/bar.stamp: stamp input1.out input2.out\n";
381 EXPECT_EQ(expected_win, out.str()); 383 EXPECT_EQ(expected_win, out.str());
382 } 384 }
383 } 385 }
OLDNEW
« no previous file with comments | « tools/gn/ninja_action_target_writer.cc ('k') | tools/gn/ninja_binary_target_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698