sdefresne | 1232aae | 2016-03-10 20:16:36 | [diff] [blame] | 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 | #ifndef TOOLS_GN_NINJA_CREATE_BUNDLE_TARGET_WRITER_H_ |
| 6 | #define TOOLS_GN_NINJA_CREATE_BUNDLE_TARGET_WRITER_H_ |
| 7 | |
| 8 | #include "base/macros.h" |
| 9 | #include "tools/gn/ninja_target_writer.h" |
| 10 | |
sdefresne | 4c75ba48 | 2016-06-30 21:59:03 | [diff] [blame] | 11 | class BundleFileRule; |
| 12 | |
sdefresne | 1232aae | 2016-03-10 20:16:36 | [diff] [blame] | 13 | // Writes a .ninja file for a bundle_data target type. |
| 14 | class NinjaCreateBundleTargetWriter : public NinjaTargetWriter { |
| 15 | public: |
| 16 | NinjaCreateBundleTargetWriter(const Target* target, std::ostream& out); |
| 17 | ~NinjaCreateBundleTargetWriter() override; |
| 18 | |
| 19 | void Run() override; |
| 20 | |
| 21 | private: |
sdefresne | 14ddbb6 | 2016-06-14 18:33:33 | [diff] [blame] | 22 | // Writes the Ninja rule for invoking the code signing script. |
| 23 | // |
| 24 | // Returns the name of the custom rule generated for the code signing step if |
| 25 | // defined, otherwise returns an empty string. |
| 26 | std::string WriteCodeSigningRuleDefinition(); |
| 27 | |
sdefresne | 4c75ba48 | 2016-06-30 21:59:03 | [diff] [blame] | 28 | // Writes the steps to copy files into the bundle. |
sdefresne | 14ddbb6 | 2016-06-14 18:33:33 | [diff] [blame] | 29 | // |
sdefresne | 4c75ba48 | 2016-06-30 21:59:03 | [diff] [blame] | 30 | // The list of newly created files will be added to |output_files|. |
| 31 | void WriteCopyBundleDataSteps(std::vector<OutputFile>* output_files); |
sdefresne | 14ddbb6 | 2016-06-14 18:33:33 | [diff] [blame] | 32 | |
sdefresne | 4c75ba48 | 2016-06-30 21:59:03 | [diff] [blame] | 33 | // Writes the step to copy files BundleFileRule into the bundle. |
sdefresne | 14ddbb6 | 2016-06-14 18:33:33 | [diff] [blame] | 34 | // |
sdefresne | 4c75ba48 | 2016-06-30 21:59:03 | [diff] [blame] | 35 | // The list of newly created files will be added to |output_files|. |
| 36 | void WriteCopyBundleFileRuleSteps(const BundleFileRule& file_rule, |
| 37 | std::vector<OutputFile>* output_files); |
sdefresne | 14ddbb6 | 2016-06-14 18:33:33 | [diff] [blame] | 38 | |
sdefresne | 4c75ba48 | 2016-06-30 21:59:03 | [diff] [blame] | 39 | // Writes the step to compile assets catalogs. |
sdefresne | 14ddbb6 | 2016-06-14 18:33:33 | [diff] [blame] | 40 | // |
sdefresne | 4c75ba48 | 2016-06-30 21:59:03 | [diff] [blame] | 41 | // The list of newly created files will be added to |output_files|. |
| 42 | void WriteCompileAssetsCatalogStep(std::vector<OutputFile>* output_files); |
| 43 | |
| 44 | // Writes the stamp file for the assets catalog compilation input |
| 45 | // dependencies. |
| 46 | OutputFile WriteCompileAssetsCatalogInputDepsStamp( |
| 47 | const std::vector<const Target*>& dependencies); |
| 48 | |
| 49 | // Writes the code signing step (if a script is defined). |
| 50 | // |
| 51 | // The list of newly created files will be added to |output_files|. As the |
| 52 | // code signing may depends on the full bundle structure, this step will |
| 53 | // depends on all files generated via other rules. |
| 54 | void WriteCodeSigningStep(const std::string& code_signing_rule_name, |
| 55 | std::vector<OutputFile>* output_files); |
sdefresne | 14ddbb6 | 2016-06-14 18:33:33 | [diff] [blame] | 56 | |
| 57 | // Writes the stamp file for the code signing input dependencies. |
| 58 | OutputFile WriteCodeSigningInputDepsStamp( |
sdefresne | 14ddbb6 | 2016-06-14 18:33:33 | [diff] [blame] | 59 | std::vector<OutputFile>* output_files); |
| 60 | |
sdefresne | 1232aae | 2016-03-10 20:16:36 | [diff] [blame] | 61 | DISALLOW_COPY_AND_ASSIGN(NinjaCreateBundleTargetWriter); |
| 62 | }; |
| 63 | |
| 64 | #endif // TOOLS_GN_NINJA_CREATE_BUNDLE_TARGET_WRITER_H_ |