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

Side by Side Diff: tools/gn/bundle_data.h

Issue 1752033002: Add "create_bundle" target in order to support bundle with gn. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn-bundle-data
Patch Set: Add unit tests, address comments, update docs and format with clang-format Created 4 years, 9 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/BUILD.gn ('k') | tools/gn/bundle_data.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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_BUNDLE_DATA_H_
6 #define TOOLS_GN_BUNDLE_DATA_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "tools/gn/bundle_file_rule.h"
12
13 class OutputFile;
14 class SourceFile;
15 class Settings;
16 class Target;
17
18 // Returns true if |source| correspond to the path of a file in an asset
19 // catalog. If defined |asset_catalog| is set to its path.
20 //
21 // An asset catalog is an OS X bundle with the ".xcassets" extension. It
22 // contains one directory per assets each of them with the ".imageset"
23 // extension.
24 //
25 // All asset catalogs are compiled by Xcode into single Assets.car file as
26 // part of the creation of an application or framework bundle. BundleData
27 // emulates this with the "compile_xcassets" tool.
28 bool IsSourceFileFromAssetCatalog(const SourceFile& source,
29 SourceFile* asset_catalog);
30
31 // BundleData holds the information required by "create_bundle" target.
32 class BundleData {
33 public:
34 BundleData();
35 ~BundleData();
36
37 // Extracts the information required from a "bundle_data" target.
38 void AddFileRuleFromTarget(const Target* target);
39
40 // Returns the list of inputs.
41 void GetSourceFiles(std::vector<SourceFile>* sources) const;
42
43 // Returns the list of outputs.
44 void GetOutputFiles(const Settings* settings,
45 std::vector<OutputFile>* outputs) const;
46
47 // Returns the list of outputs as SourceFile.
48 void GetOutputsAsSourceFiles(
49 const Settings* settings,
50 std::vector<SourceFile>* outputs_as_source) const;
51
52 // Returns the path to the compiled asset catalog. Only valid if
53 // asset_catalog_sources() is not empty.
54 SourceFile GetCompiledAssetCatalogPath() const;
55
56 // Returns the list of inputs for the compilation of the asset catalog.
57 std::vector<SourceFile>& asset_catalog_sources() {
58 return asset_catalog_sources_;
59 }
60 const std::vector<SourceFile>& asset_catalog_sources() const {
61 return asset_catalog_sources_;
62 }
63
64 std::vector<BundleFileRule>& file_rules() { return file_rules_; }
65 const std::vector<BundleFileRule>& file_rules() const { return file_rules_; }
66
67 std::string& root_dir() { return root_dir_; }
68 const std::string& root_dir() const { return root_dir_; }
69
70 std::string& resources_dir() { return resources_dir_; }
71 const std::string& resources_dir() const { return resources_dir_; }
72
73 std::string& executable_dir() { return executable_dir_; }
74 const std::string& executable_dir() const { return executable_dir_; }
75
76 std::string& plugins_dir() { return plugins_dir_; }
77 const std::string& plugins_dir() const { return plugins_dir_; }
78
79 private:
80 std::vector<SourceFile> asset_catalog_sources_;
81 std::vector<BundleFileRule> file_rules_;
82
83 // All those values are subdirectories relative to root_build_dir, and apart
84 // from root_dir, they are either equal to root_dir_ or subdirectories of it.
85 std::string root_dir_;
86 std::string resources_dir_;
87 std::string executable_dir_;
88 std::string plugins_dir_;
89 };
90
91 #endif // TOOLS_GN_BUNDLE_DATA_H_
OLDNEW
« no previous file with comments | « tools/gn/BUILD.gn ('k') | tools/gn/bundle_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698