blob: 824e7d95f969e9426737676864a6b98b40608358 [file] [log] [blame]
sdefresne1232aae2016-03-10 20:16:361// 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
sdefresne4c75ba482016-06-30 21:59:0311class BundleFileRule;
12
sdefresne1232aae2016-03-10 20:16:3613// Writes a .ninja file for a bundle_data target type.
14class NinjaCreateBundleTargetWriter : public NinjaTargetWriter {
15 public:
16 NinjaCreateBundleTargetWriter(const Target* target, std::ostream& out);
17 ~NinjaCreateBundleTargetWriter() override;
18
19 void Run() override;
20
21 private:
sdefresne14ddbb62016-06-14 18:33:3322 // 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
sdefresne4c75ba482016-06-30 21:59:0328 // Writes the steps to copy files into the bundle.
sdefresne14ddbb62016-06-14 18:33:3329 //
sdefresne4c75ba482016-06-30 21:59:0330 // The list of newly created files will be added to |output_files|.
31 void WriteCopyBundleDataSteps(std::vector<OutputFile>* output_files);
sdefresne14ddbb62016-06-14 18:33:3332
sdefresne4c75ba482016-06-30 21:59:0333 // Writes the step to copy files BundleFileRule into the bundle.
sdefresne14ddbb62016-06-14 18:33:3334 //
sdefresne4c75ba482016-06-30 21:59:0335 // 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);
sdefresne14ddbb62016-06-14 18:33:3338
sdefresne4c75ba482016-06-30 21:59:0339 // Writes the step to compile assets catalogs.
sdefresne14ddbb62016-06-14 18:33:3340 //
sdefresne4c75ba482016-06-30 21:59:0341 // 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);
sdefresne14ddbb62016-06-14 18:33:3356
57 // Writes the stamp file for the code signing input dependencies.
58 OutputFile WriteCodeSigningInputDepsStamp(
sdefresne14ddbb62016-06-14 18:33:3359 std::vector<OutputFile>* output_files);
60
sdefresne1232aae2016-03-10 20:16:3661 DISALLOW_COPY_AND_ASSIGN(NinjaCreateBundleTargetWriter);
62};
63
64#endif // TOOLS_GN_NINJA_CREATE_BUNDLE_TARGET_WRITER_H_