| OLD | NEW |
| 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 10 matching lines...) Expand all Loading... |
| 21 bundle_data->plugins_dir() = SourceDir(bundle_root_dir + "/Plug Ins"); | 21 bundle_data->plugins_dir() = SourceDir(bundle_root_dir + "/Plug Ins"); |
| 22 } | 22 } |
| 23 | 23 |
| 24 } // namespace | 24 } // namespace |
| 25 | 25 |
| 26 // Tests multiple files with an output pattern. | 26 // Tests multiple files with an output pattern. |
| 27 TEST(NinjaCreateBundleTargetWriter, Run) { | 27 TEST(NinjaCreateBundleTargetWriter, Run) { |
| 28 Err err; | 28 Err err; |
| 29 TestWithScope setup; | 29 TestWithScope setup; |
| 30 | 30 |
| 31 Target bundle_data(setup.settings(), Label(SourceDir("//foo/"), "data")); | 31 Target bundle_data(setup.settings(), Label(SourceDir("//foo/"), "data"), {}); |
| 32 bundle_data.set_output_type(Target::BUNDLE_DATA); | 32 bundle_data.set_output_type(Target::BUNDLE_DATA); |
| 33 bundle_data.sources().push_back(SourceFile("//foo/input1.txt")); | 33 bundle_data.sources().push_back(SourceFile("//foo/input1.txt")); |
| 34 bundle_data.sources().push_back(SourceFile("//foo/input2.txt")); | 34 bundle_data.sources().push_back(SourceFile("//foo/input2.txt")); |
| 35 bundle_data.action_values().outputs() = SubstitutionList::MakeForTest( | 35 bundle_data.action_values().outputs() = SubstitutionList::MakeForTest( |
| 36 "{{bundle_resources_dir}}/{{source_file_part}}"); | 36 "{{bundle_resources_dir}}/{{source_file_part}}"); |
| 37 bundle_data.SetToolchain(setup.toolchain()); | 37 bundle_data.SetToolchain(setup.toolchain()); |
| 38 bundle_data.visibility().SetPublic(); | 38 bundle_data.visibility().SetPublic(); |
| 39 ASSERT_TRUE(bundle_data.OnResolved(&err)); | 39 ASSERT_TRUE(bundle_data.OnResolved(&err)); |
| 40 | 40 |
| 41 Target create_bundle( | 41 Target create_bundle( |
| 42 setup.settings(), | 42 setup.settings(), |
| 43 Label(SourceDir("//baz/"), "bar", setup.toolchain()->label().dir(), | 43 Label(SourceDir("//baz/"), "bar", setup.toolchain()->label().dir(), |
| 44 setup.toolchain()->label().name())); | 44 setup.toolchain()->label().name()), |
| 45 {}); |
| 45 SetupBundleDataDir(&create_bundle.bundle_data(), "//out/Debug"); | 46 SetupBundleDataDir(&create_bundle.bundle_data(), "//out/Debug"); |
| 46 create_bundle.set_output_type(Target::CREATE_BUNDLE); | 47 create_bundle.set_output_type(Target::CREATE_BUNDLE); |
| 47 create_bundle.private_deps().push_back(LabelTargetPair(&bundle_data)); | 48 create_bundle.private_deps().push_back(LabelTargetPair(&bundle_data)); |
| 48 create_bundle.SetToolchain(setup.toolchain()); | 49 create_bundle.SetToolchain(setup.toolchain()); |
| 49 ASSERT_TRUE(create_bundle.OnResolved(&err)); | 50 ASSERT_TRUE(create_bundle.OnResolved(&err)); |
| 50 | 51 |
| 51 std::ostringstream out; | 52 std::ostringstream out; |
| 52 NinjaCreateBundleTargetWriter writer(&create_bundle, out); | 53 NinjaCreateBundleTargetWriter writer(&create_bundle, out); |
| 53 writer.Run(); | 54 writer.Run(); |
| 54 | 55 |
| 55 const char expected[] = | 56 const char expected[] = |
| 56 "build bar.bundle/Contents/Resources/input1.txt: copy_bundle_data " | 57 "build bar.bundle/Contents/Resources/input1.txt: copy_bundle_data " |
| 57 "../../foo/input1.txt\n" | 58 "../../foo/input1.txt\n" |
| 58 "build bar.bundle/Contents/Resources/input2.txt: copy_bundle_data " | 59 "build bar.bundle/Contents/Resources/input2.txt: copy_bundle_data " |
| 59 "../../foo/input2.txt\n" | 60 "../../foo/input2.txt\n" |
| 60 "build obj/baz/bar.stamp: stamp " | 61 "build obj/baz/bar.stamp: stamp " |
| 61 "bar.bundle/Contents/Resources/input1.txt " | 62 "bar.bundle/Contents/Resources/input1.txt " |
| 62 "bar.bundle/Contents/Resources/input2.txt\n" | 63 "bar.bundle/Contents/Resources/input2.txt\n" |
| 63 "build bar.bundle: phony obj/baz/bar.stamp\n"; | 64 "build bar.bundle: phony obj/baz/bar.stamp\n"; |
| 64 std::string out_str = out.str(); | 65 std::string out_str = out.str(); |
| 65 EXPECT_EQ(expected, out_str); | 66 EXPECT_EQ(expected, out_str); |
| 66 } | 67 } |
| 67 | 68 |
| 68 // Tests multiple files from asset catalog. | 69 // Tests multiple files from asset catalog. |
| 69 TEST(NinjaCreateBundleTargetWriter, AssetCatalog) { | 70 TEST(NinjaCreateBundleTargetWriter, AssetCatalog) { |
| 70 Err err; | 71 Err err; |
| 71 TestWithScope setup; | 72 TestWithScope setup; |
| 72 | 73 |
| 73 Target bundle_data(setup.settings(), Label(SourceDir("//foo/"), "data")); | 74 Target bundle_data(setup.settings(), Label(SourceDir("//foo/"), "data"), {}); |
| 74 bundle_data.set_output_type(Target::BUNDLE_DATA); | 75 bundle_data.set_output_type(Target::BUNDLE_DATA); |
| 75 bundle_data.sources().push_back( | 76 bundle_data.sources().push_back( |
| 76 SourceFile("//foo/Foo.xcassets/Contents.json")); | 77 SourceFile("//foo/Foo.xcassets/Contents.json")); |
| 77 bundle_data.sources().push_back( | 78 bundle_data.sources().push_back( |
| 78 SourceFile("//foo/Foo.xcassets/foo.imageset/Contents.json")); | 79 SourceFile("//foo/Foo.xcassets/foo.imageset/Contents.json")); |
| 79 bundle_data.sources().push_back( | 80 bundle_data.sources().push_back( |
| 80 SourceFile("//foo/Foo.xcassets/foo.imageset/FooIcon-29.png")); | 81 SourceFile("//foo/Foo.xcassets/foo.imageset/FooIcon-29.png")); |
| 81 bundle_data.sources().push_back( | 82 bundle_data.sources().push_back( |
| 82 SourceFile("//foo/Foo.xcassets/foo.imageset/FooIcon-29@2x.png")); | 83 SourceFile("//foo/Foo.xcassets/foo.imageset/FooIcon-29@2x.png")); |
| 83 bundle_data.sources().push_back( | 84 bundle_data.sources().push_back( |
| 84 SourceFile("//foo/Foo.xcassets/foo.imageset/FooIcon-29@3x.png")); | 85 SourceFile("//foo/Foo.xcassets/foo.imageset/FooIcon-29@3x.png")); |
| 85 bundle_data.action_values().outputs() = SubstitutionList::MakeForTest( | 86 bundle_data.action_values().outputs() = SubstitutionList::MakeForTest( |
| 86 "{{bundle_resources_dir}}/{{source_file_part}}"); | 87 "{{bundle_resources_dir}}/{{source_file_part}}"); |
| 87 bundle_data.SetToolchain(setup.toolchain()); | 88 bundle_data.SetToolchain(setup.toolchain()); |
| 88 bundle_data.visibility().SetPublic(); | 89 bundle_data.visibility().SetPublic(); |
| 89 ASSERT_TRUE(bundle_data.OnResolved(&err)); | 90 ASSERT_TRUE(bundle_data.OnResolved(&err)); |
| 90 | 91 |
| 91 Target create_bundle( | 92 Target create_bundle( |
| 92 setup.settings(), | 93 setup.settings(), |
| 93 Label(SourceDir("//baz/"), "bar", setup.toolchain()->label().dir(), | 94 Label(SourceDir("//baz/"), "bar", setup.toolchain()->label().dir(), |
| 94 setup.toolchain()->label().name())); | 95 setup.toolchain()->label().name()), |
| 96 {}); |
| 95 SetupBundleDataDir(&create_bundle.bundle_data(), "//out/Debug"); | 97 SetupBundleDataDir(&create_bundle.bundle_data(), "//out/Debug"); |
| 96 create_bundle.set_output_type(Target::CREATE_BUNDLE); | 98 create_bundle.set_output_type(Target::CREATE_BUNDLE); |
| 97 create_bundle.private_deps().push_back(LabelTargetPair(&bundle_data)); | 99 create_bundle.private_deps().push_back(LabelTargetPair(&bundle_data)); |
| 98 create_bundle.bundle_data().product_type().assign("com.apple.product-type"); | 100 create_bundle.bundle_data().product_type().assign("com.apple.product-type"); |
| 99 create_bundle.SetToolchain(setup.toolchain()); | 101 create_bundle.SetToolchain(setup.toolchain()); |
| 100 ASSERT_TRUE(create_bundle.OnResolved(&err)); | 102 ASSERT_TRUE(create_bundle.OnResolved(&err)); |
| 101 | 103 |
| 102 std::ostringstream out; | 104 std::ostringstream out; |
| 103 NinjaCreateBundleTargetWriter writer(&create_bundle, out); | 105 NinjaCreateBundleTargetWriter writer(&create_bundle, out); |
| 104 writer.Run(); | 106 writer.Run(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 116 | 118 |
| 117 // Tests that the phony target for the top-level bundle directory is generated | 119 // Tests that the phony target for the top-level bundle directory is generated |
| 118 // correctly. | 120 // correctly. |
| 119 TEST(NinjaCreateBundleTargetWriter, PhonyTarget) { | 121 TEST(NinjaCreateBundleTargetWriter, PhonyTarget) { |
| 120 Err err; | 122 Err err; |
| 121 TestWithScope setup; | 123 TestWithScope setup; |
| 122 | 124 |
| 123 Target create_bundle( | 125 Target create_bundle( |
| 124 setup.settings(), | 126 setup.settings(), |
| 125 Label(SourceDir("//baz/"), "bar", setup.toolchain()->label().dir(), | 127 Label(SourceDir("//baz/"), "bar", setup.toolchain()->label().dir(), |
| 126 setup.toolchain()->label().name())); | 128 setup.toolchain()->label().name()), |
| 129 {}); |
| 127 SetupBundleDataDir(&create_bundle.bundle_data(), "//out/Debug"); | 130 SetupBundleDataDir(&create_bundle.bundle_data(), "//out/Debug"); |
| 128 create_bundle.set_output_type(Target::CREATE_BUNDLE); | 131 create_bundle.set_output_type(Target::CREATE_BUNDLE); |
| 129 create_bundle.SetToolchain(setup.toolchain()); | 132 create_bundle.SetToolchain(setup.toolchain()); |
| 130 ASSERT_TRUE(create_bundle.OnResolved(&err)); | 133 ASSERT_TRUE(create_bundle.OnResolved(&err)); |
| 131 | 134 |
| 132 std::ostringstream out; | 135 std::ostringstream out; |
| 133 NinjaCreateBundleTargetWriter writer(&create_bundle, out); | 136 NinjaCreateBundleTargetWriter writer(&create_bundle, out); |
| 134 writer.Run(); | 137 writer.Run(); |
| 135 | 138 |
| 136 const char expected[] = | 139 const char expected[] = |
| 137 "build obj/baz/bar.stamp: stamp\n" | 140 "build obj/baz/bar.stamp: stamp\n" |
| 138 "build bar.bundle: phony obj/baz/bar.stamp\n"; | 141 "build bar.bundle: phony obj/baz/bar.stamp\n"; |
| 139 std::string out_str = out.str(); | 142 std::string out_str = out.str(); |
| 140 EXPECT_EQ(expected, out_str); | 143 EXPECT_EQ(expected, out_str); |
| 141 } | 144 } |
| 142 | 145 |
| 143 // Tests complex target with multiple bundle_data sources, including | 146 // Tests complex target with multiple bundle_data sources, including |
| 144 // some asset catalog. | 147 // some asset catalog. |
| 145 TEST(NinjaCreateBundleTargetWriter, Complex) { | 148 TEST(NinjaCreateBundleTargetWriter, Complex) { |
| 146 Err err; | 149 Err err; |
| 147 TestWithScope setup; | 150 TestWithScope setup; |
| 148 | 151 |
| 149 Target bundle_data0(setup.settings(), | 152 Target bundle_data0(setup.settings(), |
| 150 Label(SourceDir("//qux/"), "info_plist")); | 153 Label(SourceDir("//qux/"), "info_plist"), {}); |
| 151 bundle_data0.set_output_type(Target::BUNDLE_DATA); | 154 bundle_data0.set_output_type(Target::BUNDLE_DATA); |
| 152 bundle_data0.sources().push_back(SourceFile("//qux/qux-Info.plist")); | 155 bundle_data0.sources().push_back(SourceFile("//qux/qux-Info.plist")); |
| 153 bundle_data0.action_values().outputs() = | 156 bundle_data0.action_values().outputs() = |
| 154 SubstitutionList::MakeForTest("{{bundle_root_dir}}/Info.plist"); | 157 SubstitutionList::MakeForTest("{{bundle_root_dir}}/Info.plist"); |
| 155 bundle_data0.SetToolchain(setup.toolchain()); | 158 bundle_data0.SetToolchain(setup.toolchain()); |
| 156 bundle_data0.visibility().SetPublic(); | 159 bundle_data0.visibility().SetPublic(); |
| 157 ASSERT_TRUE(bundle_data0.OnResolved(&err)); | 160 ASSERT_TRUE(bundle_data0.OnResolved(&err)); |
| 158 | 161 |
| 159 Target bundle_data1(setup.settings(), Label(SourceDir("//foo/"), "data")); | 162 Target bundle_data1(setup.settings(), Label(SourceDir("//foo/"), "data"), {}); |
| 160 bundle_data1.set_output_type(Target::BUNDLE_DATA); | 163 bundle_data1.set_output_type(Target::BUNDLE_DATA); |
| 161 bundle_data1.sources().push_back(SourceFile("//foo/input1.txt")); | 164 bundle_data1.sources().push_back(SourceFile("//foo/input1.txt")); |
| 162 bundle_data1.sources().push_back(SourceFile("//foo/input2.txt")); | 165 bundle_data1.sources().push_back(SourceFile("//foo/input2.txt")); |
| 163 bundle_data1.action_values().outputs() = SubstitutionList::MakeForTest( | 166 bundle_data1.action_values().outputs() = SubstitutionList::MakeForTest( |
| 164 "{{bundle_resources_dir}}/{{source_file_part}}"); | 167 "{{bundle_resources_dir}}/{{source_file_part}}"); |
| 165 bundle_data1.SetToolchain(setup.toolchain()); | 168 bundle_data1.SetToolchain(setup.toolchain()); |
| 166 bundle_data1.visibility().SetPublic(); | 169 bundle_data1.visibility().SetPublic(); |
| 167 ASSERT_TRUE(bundle_data1.OnResolved(&err)); | 170 ASSERT_TRUE(bundle_data1.OnResolved(&err)); |
| 168 | 171 |
| 169 Target bundle_data2(setup.settings(), Label(SourceDir("//foo/"), "assets")); | 172 Target bundle_data2(setup.settings(), Label(SourceDir("//foo/"), "assets"), |
| 173 {}); |
| 170 bundle_data2.set_output_type(Target::BUNDLE_DATA); | 174 bundle_data2.set_output_type(Target::BUNDLE_DATA); |
| 171 bundle_data2.sources().push_back( | 175 bundle_data2.sources().push_back( |
| 172 SourceFile("//foo/Foo.xcassets/Contents.json")); | 176 SourceFile("//foo/Foo.xcassets/Contents.json")); |
| 173 bundle_data2.sources().push_back( | 177 bundle_data2.sources().push_back( |
| 174 SourceFile("//foo/Foo.xcassets/foo.imageset/Contents.json")); | 178 SourceFile("//foo/Foo.xcassets/foo.imageset/Contents.json")); |
| 175 bundle_data2.sources().push_back( | 179 bundle_data2.sources().push_back( |
| 176 SourceFile("//foo/Foo.xcassets/foo.imageset/FooIcon-29.png")); | 180 SourceFile("//foo/Foo.xcassets/foo.imageset/FooIcon-29.png")); |
| 177 bundle_data2.sources().push_back( | 181 bundle_data2.sources().push_back( |
| 178 SourceFile("//foo/Foo.xcassets/foo.imageset/FooIcon-29@2x.png")); | 182 SourceFile("//foo/Foo.xcassets/foo.imageset/FooIcon-29@2x.png")); |
| 179 bundle_data2.sources().push_back( | 183 bundle_data2.sources().push_back( |
| 180 SourceFile("//foo/Foo.xcassets/foo.imageset/FooIcon-29@3x.png")); | 184 SourceFile("//foo/Foo.xcassets/foo.imageset/FooIcon-29@3x.png")); |
| 181 bundle_data2.action_values().outputs() = SubstitutionList::MakeForTest( | 185 bundle_data2.action_values().outputs() = SubstitutionList::MakeForTest( |
| 182 "{{bundle_resources_dir}}/{{source_file_part}}"); | 186 "{{bundle_resources_dir}}/{{source_file_part}}"); |
| 183 bundle_data2.SetToolchain(setup.toolchain()); | 187 bundle_data2.SetToolchain(setup.toolchain()); |
| 184 bundle_data2.visibility().SetPublic(); | 188 bundle_data2.visibility().SetPublic(); |
| 185 ASSERT_TRUE(bundle_data2.OnResolved(&err)); | 189 ASSERT_TRUE(bundle_data2.OnResolved(&err)); |
| 186 | 190 |
| 187 Target bundle_data3(setup.settings(), Label(SourceDir("//quz/"), "assets")); | 191 Target bundle_data3(setup.settings(), Label(SourceDir("//quz/"), "assets"), |
| 192 {}); |
| 188 bundle_data3.set_output_type(Target::BUNDLE_DATA); | 193 bundle_data3.set_output_type(Target::BUNDLE_DATA); |
| 189 bundle_data3.sources().push_back( | 194 bundle_data3.sources().push_back( |
| 190 SourceFile("//quz/Quz.xcassets/Contents.json")); | 195 SourceFile("//quz/Quz.xcassets/Contents.json")); |
| 191 bundle_data3.sources().push_back( | 196 bundle_data3.sources().push_back( |
| 192 SourceFile("//quz/Quz.xcassets/quz.imageset/Contents.json")); | 197 SourceFile("//quz/Quz.xcassets/quz.imageset/Contents.json")); |
| 193 bundle_data3.sources().push_back( | 198 bundle_data3.sources().push_back( |
| 194 SourceFile("//quz/Quz.xcassets/quz.imageset/QuzIcon-29.png")); | 199 SourceFile("//quz/Quz.xcassets/quz.imageset/QuzIcon-29.png")); |
| 195 bundle_data3.sources().push_back( | 200 bundle_data3.sources().push_back( |
| 196 SourceFile("//quz/Quz.xcassets/quz.imageset/QuzIcon-29@2x.png")); | 201 SourceFile("//quz/Quz.xcassets/quz.imageset/QuzIcon-29@2x.png")); |
| 197 bundle_data3.sources().push_back( | 202 bundle_data3.sources().push_back( |
| 198 SourceFile("//quz/Quz.xcassets/quz.imageset/QuzIcon-29@3x.png")); | 203 SourceFile("//quz/Quz.xcassets/quz.imageset/QuzIcon-29@3x.png")); |
| 199 bundle_data3.action_values().outputs() = SubstitutionList::MakeForTest( | 204 bundle_data3.action_values().outputs() = SubstitutionList::MakeForTest( |
| 200 "{{bundle_resources_dir}}/{{source_file_part}}"); | 205 "{{bundle_resources_dir}}/{{source_file_part}}"); |
| 201 bundle_data3.SetToolchain(setup.toolchain()); | 206 bundle_data3.SetToolchain(setup.toolchain()); |
| 202 bundle_data3.visibility().SetPublic(); | 207 bundle_data3.visibility().SetPublic(); |
| 203 ASSERT_TRUE(bundle_data3.OnResolved(&err)); | 208 ASSERT_TRUE(bundle_data3.OnResolved(&err)); |
| 204 | 209 |
| 205 Target create_bundle( | 210 Target create_bundle( |
| 206 setup.settings(), | 211 setup.settings(), |
| 207 Label(SourceDir("//baz/"), "bar", setup.toolchain()->label().dir(), | 212 Label(SourceDir("//baz/"), "bar", setup.toolchain()->label().dir(), |
| 208 setup.toolchain()->label().name())); | 213 setup.toolchain()->label().name()), |
| 214 {}); |
| 209 SetupBundleDataDir(&create_bundle.bundle_data(), "//out/Debug"); | 215 SetupBundleDataDir(&create_bundle.bundle_data(), "//out/Debug"); |
| 210 create_bundle.set_output_type(Target::CREATE_BUNDLE); | 216 create_bundle.set_output_type(Target::CREATE_BUNDLE); |
| 211 create_bundle.private_deps().push_back(LabelTargetPair(&bundle_data0)); | 217 create_bundle.private_deps().push_back(LabelTargetPair(&bundle_data0)); |
| 212 create_bundle.private_deps().push_back(LabelTargetPair(&bundle_data1)); | 218 create_bundle.private_deps().push_back(LabelTargetPair(&bundle_data1)); |
| 213 create_bundle.private_deps().push_back(LabelTargetPair(&bundle_data2)); | 219 create_bundle.private_deps().push_back(LabelTargetPair(&bundle_data2)); |
| 214 create_bundle.private_deps().push_back(LabelTargetPair(&bundle_data3)); | 220 create_bundle.private_deps().push_back(LabelTargetPair(&bundle_data3)); |
| 215 create_bundle.bundle_data().product_type().assign("com.apple.product-type"); | 221 create_bundle.bundle_data().product_type().assign("com.apple.product-type"); |
| 216 create_bundle.SetToolchain(setup.toolchain()); | 222 create_bundle.SetToolchain(setup.toolchain()); |
| 217 ASSERT_TRUE(create_bundle.OnResolved(&err)); | 223 ASSERT_TRUE(create_bundle.OnResolved(&err)); |
| 218 | 224 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 242 "build bar.bundle: phony obj/baz/bar.stamp\n"; | 248 "build bar.bundle: phony obj/baz/bar.stamp\n"; |
| 243 std::string out_str = out.str(); | 249 std::string out_str = out.str(); |
| 244 EXPECT_EQ(expected, out_str); | 250 EXPECT_EQ(expected, out_str); |
| 245 } | 251 } |
| 246 | 252 |
| 247 // Tests code signing steps. | 253 // Tests code signing steps. |
| 248 TEST(NinjaCreateBundleTargetWriter, CodeSigning) { | 254 TEST(NinjaCreateBundleTargetWriter, CodeSigning) { |
| 249 Err err; | 255 Err err; |
| 250 TestWithScope setup; | 256 TestWithScope setup; |
| 251 | 257 |
| 252 Target executable(setup.settings(), Label(SourceDir("//baz/"), "quz")); | 258 Target executable(setup.settings(), Label(SourceDir("//baz/"), "quz"), {}); |
| 253 executable.set_output_type(Target::EXECUTABLE); | 259 executable.set_output_type(Target::EXECUTABLE); |
| 254 executable.sources().push_back(SourceFile("//baz/quz.c")); | 260 executable.sources().push_back(SourceFile("//baz/quz.c")); |
| 255 executable.SetToolchain(setup.toolchain()); | 261 executable.SetToolchain(setup.toolchain()); |
| 256 executable.visibility().SetPublic(); | 262 executable.visibility().SetPublic(); |
| 257 ASSERT_TRUE(executable.OnResolved(&err)); | 263 ASSERT_TRUE(executable.OnResolved(&err)); |
| 258 | 264 |
| 259 Target bundle_data(setup.settings(), Label(SourceDir("//foo/"), "data")); | 265 Target bundle_data(setup.settings(), Label(SourceDir("//foo/"), "data"), {}); |
| 260 bundle_data.set_output_type(Target::BUNDLE_DATA); | 266 bundle_data.set_output_type(Target::BUNDLE_DATA); |
| 261 bundle_data.sources().push_back(SourceFile("//foo/input1.txt")); | 267 bundle_data.sources().push_back(SourceFile("//foo/input1.txt")); |
| 262 bundle_data.sources().push_back(SourceFile("//foo/input2.txt")); | 268 bundle_data.sources().push_back(SourceFile("//foo/input2.txt")); |
| 263 bundle_data.action_values().outputs() = SubstitutionList::MakeForTest( | 269 bundle_data.action_values().outputs() = SubstitutionList::MakeForTest( |
| 264 "{{bundle_resources_dir}}/{{source_file_part}}"); | 270 "{{bundle_resources_dir}}/{{source_file_part}}"); |
| 265 bundle_data.SetToolchain(setup.toolchain()); | 271 bundle_data.SetToolchain(setup.toolchain()); |
| 266 bundle_data.visibility().SetPublic(); | 272 bundle_data.visibility().SetPublic(); |
| 267 ASSERT_TRUE(bundle_data.OnResolved(&err)); | 273 ASSERT_TRUE(bundle_data.OnResolved(&err)); |
| 268 | 274 |
| 269 Target create_bundle( | 275 Target create_bundle( |
| 270 setup.settings(), | 276 setup.settings(), |
| 271 Label(SourceDir("//baz/"), "bar", setup.toolchain()->label().dir(), | 277 Label(SourceDir("//baz/"), "bar", setup.toolchain()->label().dir(), |
| 272 setup.toolchain()->label().name())); | 278 setup.toolchain()->label().name()), |
| 279 {}); |
| 273 SetupBundleDataDir(&create_bundle.bundle_data(), "//out/Debug"); | 280 SetupBundleDataDir(&create_bundle.bundle_data(), "//out/Debug"); |
| 274 create_bundle.set_output_type(Target::CREATE_BUNDLE); | 281 create_bundle.set_output_type(Target::CREATE_BUNDLE); |
| 275 create_bundle.bundle_data().set_code_signing_script( | 282 create_bundle.bundle_data().set_code_signing_script( |
| 276 SourceFile("//build/codesign.py")); | 283 SourceFile("//build/codesign.py")); |
| 277 create_bundle.bundle_data().code_signing_sources().push_back( | 284 create_bundle.bundle_data().code_signing_sources().push_back( |
| 278 SourceFile("//out/Debug/quz")); | 285 SourceFile("//out/Debug/quz")); |
| 279 create_bundle.bundle_data().code_signing_outputs() = | 286 create_bundle.bundle_data().code_signing_outputs() = |
| 280 SubstitutionList::MakeForTest( | 287 SubstitutionList::MakeForTest( |
| 281 "//out/Debug/bar.bundle/Contents/quz", | 288 "//out/Debug/bar.bundle/Contents/quz", |
| 282 "//out/Debug/bar.bundle/_CodeSignature/CodeResources"); | 289 "//out/Debug/bar.bundle/_CodeSignature/CodeResources"); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 310 "build bar.bundle/Contents/quz bar.bundle/_CodeSignature/CodeResources: " | 317 "build bar.bundle/Contents/quz bar.bundle/_CodeSignature/CodeResources: " |
| 311 "__baz_bar___toolchain_default__code_signing_rule " | 318 "__baz_bar___toolchain_default__code_signing_rule " |
| 312 "| obj/baz/bar.codesigning.inputdeps.stamp\n" | 319 "| obj/baz/bar.codesigning.inputdeps.stamp\n" |
| 313 "build obj/baz/bar.stamp: stamp " | 320 "build obj/baz/bar.stamp: stamp " |
| 314 "bar.bundle/Contents/quz " | 321 "bar.bundle/Contents/quz " |
| 315 "bar.bundle/_CodeSignature/CodeResources\n" | 322 "bar.bundle/_CodeSignature/CodeResources\n" |
| 316 "build bar.bundle: phony obj/baz/bar.stamp\n"; | 323 "build bar.bundle: phony obj/baz/bar.stamp\n"; |
| 317 std::string out_str = out.str(); | 324 std::string out_str = out.str(); |
| 318 EXPECT_EQ(expected, out_str); | 325 EXPECT_EQ(expected, out_str); |
| 319 } | 326 } |
| OLD | NEW |