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

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

Issue 2239943002: Forward bundle product_type to the compile_xcassets tool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix grammar. Created 4 years, 4 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_create_bundle_target_writer.cc ('k') | tools/gn/substitution_type.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 2016 The Chromium Authors. All rights reserved. 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 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/ninja_create_bundle_target_writer.h" 5 #include "tools/gn/ninja_create_bundle_target_writer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <sstream> 8 #include <sstream>
9 9
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 bundle_data.visibility().SetPublic(); 88 bundle_data.visibility().SetPublic();
89 ASSERT_TRUE(bundle_data.OnResolved(&err)); 89 ASSERT_TRUE(bundle_data.OnResolved(&err));
90 90
91 Target create_bundle( 91 Target create_bundle(
92 setup.settings(), 92 setup.settings(),
93 Label(SourceDir("//baz/"), "bar", setup.toolchain()->label().dir(), 93 Label(SourceDir("//baz/"), "bar", setup.toolchain()->label().dir(),
94 setup.toolchain()->label().name())); 94 setup.toolchain()->label().name()));
95 SetupBundleDataDir(&create_bundle.bundle_data(), "//out/Debug"); 95 SetupBundleDataDir(&create_bundle.bundle_data(), "//out/Debug");
96 create_bundle.set_output_type(Target::CREATE_BUNDLE); 96 create_bundle.set_output_type(Target::CREATE_BUNDLE);
97 create_bundle.private_deps().push_back(LabelTargetPair(&bundle_data)); 97 create_bundle.private_deps().push_back(LabelTargetPair(&bundle_data));
98 create_bundle.bundle_data().product_type().assign("com.apple.product-type");
98 create_bundle.SetToolchain(setup.toolchain()); 99 create_bundle.SetToolchain(setup.toolchain());
99 ASSERT_TRUE(create_bundle.OnResolved(&err)); 100 ASSERT_TRUE(create_bundle.OnResolved(&err));
100 101
101 std::ostringstream out; 102 std::ostringstream out;
102 NinjaCreateBundleTargetWriter writer(&create_bundle, out); 103 NinjaCreateBundleTargetWriter writer(&create_bundle, out);
103 writer.Run(); 104 writer.Run();
104 105
105 const char expected[] = 106 const char expected[] =
106 "build bar.bundle/Contents/Resources/Assets.car: compile_xcassets " 107 "build bar.bundle/Contents/Resources/Assets.car: compile_xcassets "
107 "../../foo/Foo.xcassets | obj/foo/data.stamp\n" 108 "../../foo/Foo.xcassets | obj/foo/data.stamp\n"
109 " product_type = com.apple.product-type\n"
108 "build obj/baz/bar.stamp: stamp " 110 "build obj/baz/bar.stamp: stamp "
109 "bar.bundle/Contents/Resources/Assets.car\n" 111 "bar.bundle/Contents/Resources/Assets.car\n"
110 "build bar.bundle: phony obj/baz/bar.stamp\n"; 112 "build bar.bundle: phony obj/baz/bar.stamp\n";
111 std::string out_str = out.str(); 113 std::string out_str = out.str();
112 EXPECT_EQ(expected, out_str); 114 EXPECT_EQ(expected, out_str);
113 } 115 }
114 116
115 // Tests that the phony target for the top-level bundle directory is generated 117 // Tests that the phony target for the top-level bundle directory is generated
116 // correctly. 118 // correctly.
117 TEST(NinjaCreateBundleTargetWriter, PhonyTarget) { 119 TEST(NinjaCreateBundleTargetWriter, PhonyTarget) {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 Target create_bundle( 205 Target create_bundle(
204 setup.settings(), 206 setup.settings(),
205 Label(SourceDir("//baz/"), "bar", setup.toolchain()->label().dir(), 207 Label(SourceDir("//baz/"), "bar", setup.toolchain()->label().dir(),
206 setup.toolchain()->label().name())); 208 setup.toolchain()->label().name()));
207 SetupBundleDataDir(&create_bundle.bundle_data(), "//out/Debug"); 209 SetupBundleDataDir(&create_bundle.bundle_data(), "//out/Debug");
208 create_bundle.set_output_type(Target::CREATE_BUNDLE); 210 create_bundle.set_output_type(Target::CREATE_BUNDLE);
209 create_bundle.private_deps().push_back(LabelTargetPair(&bundle_data0)); 211 create_bundle.private_deps().push_back(LabelTargetPair(&bundle_data0));
210 create_bundle.private_deps().push_back(LabelTargetPair(&bundle_data1)); 212 create_bundle.private_deps().push_back(LabelTargetPair(&bundle_data1));
211 create_bundle.private_deps().push_back(LabelTargetPair(&bundle_data2)); 213 create_bundle.private_deps().push_back(LabelTargetPair(&bundle_data2));
212 create_bundle.private_deps().push_back(LabelTargetPair(&bundle_data3)); 214 create_bundle.private_deps().push_back(LabelTargetPair(&bundle_data3));
215 create_bundle.bundle_data().product_type().assign("com.apple.product-type");
213 create_bundle.SetToolchain(setup.toolchain()); 216 create_bundle.SetToolchain(setup.toolchain());
214 ASSERT_TRUE(create_bundle.OnResolved(&err)); 217 ASSERT_TRUE(create_bundle.OnResolved(&err));
215 218
216 std::ostringstream out; 219 std::ostringstream out;
217 NinjaCreateBundleTargetWriter writer(&create_bundle, out); 220 NinjaCreateBundleTargetWriter writer(&create_bundle, out);
218 writer.Run(); 221 writer.Run();
219 222
220 const char expected[] = 223 const char expected[] =
221 "build bar.bundle/Contents/Info.plist: copy_bundle_data " 224 "build bar.bundle/Contents/Info.plist: copy_bundle_data "
222 "../../qux/qux-Info.plist\n" 225 "../../qux/qux-Info.plist\n"
223 "build bar.bundle/Contents/Resources/input1.txt: copy_bundle_data " 226 "build bar.bundle/Contents/Resources/input1.txt: copy_bundle_data "
224 "../../foo/input1.txt\n" 227 "../../foo/input1.txt\n"
225 "build bar.bundle/Contents/Resources/input2.txt: copy_bundle_data " 228 "build bar.bundle/Contents/Resources/input2.txt: copy_bundle_data "
226 "../../foo/input2.txt\n" 229 "../../foo/input2.txt\n"
227 "build obj/baz/bar.xcassets.inputdeps.stamp: stamp " 230 "build obj/baz/bar.xcassets.inputdeps.stamp: stamp "
228 "obj/foo/assets.stamp " 231 "obj/foo/assets.stamp "
229 "obj/quz/assets.stamp\n" 232 "obj/quz/assets.stamp\n"
230 "build bar.bundle/Contents/Resources/Assets.car: compile_xcassets " 233 "build bar.bundle/Contents/Resources/Assets.car: compile_xcassets "
231 "../../foo/Foo.xcassets " 234 "../../foo/Foo.xcassets "
232 "../../quz/Quz.xcassets | obj/baz/bar.xcassets.inputdeps.stamp\n" 235 "../../quz/Quz.xcassets | obj/baz/bar.xcassets.inputdeps.stamp\n"
236 " product_type = com.apple.product-type\n"
233 "build obj/baz/bar.stamp: stamp " 237 "build obj/baz/bar.stamp: stamp "
234 "bar.bundle/Contents/Info.plist " 238 "bar.bundle/Contents/Info.plist "
235 "bar.bundle/Contents/Resources/input1.txt " 239 "bar.bundle/Contents/Resources/input1.txt "
236 "bar.bundle/Contents/Resources/input2.txt " 240 "bar.bundle/Contents/Resources/input2.txt "
237 "bar.bundle/Contents/Resources/Assets.car\n" 241 "bar.bundle/Contents/Resources/Assets.car\n"
238 "build bar.bundle: phony obj/baz/bar.stamp\n"; 242 "build bar.bundle: phony obj/baz/bar.stamp\n";
239 std::string out_str = out.str(); 243 std::string out_str = out.str();
240 EXPECT_EQ(expected, out_str); 244 EXPECT_EQ(expected, out_str);
241 } 245 }
242 246
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 "build bar.bundle/Contents/quz bar.bundle/_CodeSignature/CodeResources: " 310 "build bar.bundle/Contents/quz bar.bundle/_CodeSignature/CodeResources: "
307 "__baz_bar___toolchain_default__code_signing_rule " 311 "__baz_bar___toolchain_default__code_signing_rule "
308 "| obj/baz/bar.codesigning.inputdeps.stamp\n" 312 "| obj/baz/bar.codesigning.inputdeps.stamp\n"
309 "build obj/baz/bar.stamp: stamp " 313 "build obj/baz/bar.stamp: stamp "
310 "bar.bundle/Contents/quz " 314 "bar.bundle/Contents/quz "
311 "bar.bundle/_CodeSignature/CodeResources\n" 315 "bar.bundle/_CodeSignature/CodeResources\n"
312 "build bar.bundle: phony obj/baz/bar.stamp\n"; 316 "build bar.bundle: phony obj/baz/bar.stamp\n";
313 std::string out_str = out.str(); 317 std::string out_str = out.str();
314 EXPECT_EQ(expected, out_str); 318 EXPECT_EQ(expected, out_str);
315 } 319 }
OLDNEW
« no previous file with comments | « tools/gn/ninja_create_bundle_target_writer.cc ('k') | tools/gn/substitution_type.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698