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