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

Side by Side Diff: mojo/public/tools/mojom_fetcher/pylib/fetcher/mojom_file.py

Issue 1709333002: Remove mojom_fetcher. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 10 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
OLDNEW
(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 Dependency, target_name_from_path
8
9
10 class MojomFile(object):
11 """Mojom represents an interface file at a given location in the
12 repository."""
13 def __init__(self, repository, name):
14 self.name = name
15 self._repository = repository
16 self.deps = []
17
18 def add_dependency(self, dependency):
19 """Declare a new dependency of this mojom."""
20 self.deps.append(Dependency(self._repository, self.name, dependency))
21
22 def get_jinja_parameters(self, include_dirs):
23 """Get the Jinja parameters to construct the BUILD.gn target of this
24 mojom."""
25 params = {}
26 params["filename"] = os.path.basename(self.name)
27 params["target_name"] = target_name_from_path(self.name)
28 params["deps"] = []
29 params["mojo_sdk_deps"] = []
30 params["import_dirs"] = set()
31
32 for dep in self.deps:
33 # Mojo SDK dependencies have special treatment.
34 if dep.is_sdk_dep():
35 target, _ = dep.get_target_and_import(include_dirs)
36 params["mojo_sdk_deps"].append(target)
37 else:
38 target, import_dir = dep.get_target_and_import(include_dirs)
39 if import_dir != None:
40 params["import_dirs"].add(import_dir)
41 params["deps"].append(target)
42
43 if len(params["import_dirs"]) != 0:
44 params["import_dirs"] = list(params["import_dirs"])
45 else:
46 del params["import_dirs"]
47 return params
48
49 def _os_path_exists(self, path):
50 return os.path.exists(path)
51
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698