OLD | NEW |
| (Empty) |
1 # Copyright 2015 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 import os | |
6 | |
7 from fetcher.dependency import group_target_name | |
8 | |
9 class MojomDirectory(object): | |
10 """This class represents a directory that directly holds mojom files, in the | |
11 external directory structure.""" | |
12 def __init__(self, path): | |
13 self.path = path | |
14 self.mojoms = [] | |
15 | |
16 def add_mojom(self, mojom): | |
17 self.mojoms.append(mojom) | |
18 | |
19 def get_jinja_parameters(self, include_dirs): | |
20 """Get the Jinja parameters to construct the BUILD.gn file of this | |
21 directory.""" | |
22 params = {} | |
23 params["group_name"] = group_target_name(self.path) | |
24 params["mojoms"] = [] | |
25 for mojom in self.mojoms: | |
26 params["mojoms"].append(mojom.get_jinja_parameters(include_dirs)) | |
27 return params | |
28 | |
29 def get_build_gn_path(self): | |
30 return os.path.join(self.path, "BUILD.gn") | |
OLD | NEW |