aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/buildgen/plugins/generate_vsprojects.py
blob: 982e6812e6172647d249f6ba4fcdea8e5bdd5169 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"""Buildgen vsprojects plugin.

This parses the list of libraries, and generates globals "vsprojects"
and "vsproject_dict", to be used by the visual studio generators.

"""


def mako_plugin(dictionary):
  """The exported plugin code for generate_vsprojeccts

  We want to help the work of the visual studio generators.

  """

  libs = dictionary.get('libs', [])
  targets = dictionary.get('targets', [])

  for lib in libs:
    lib['is_library'] = True
  for target in targets:
    target['is_library'] = False

  projects = []
  projects.extend(libs)
  projects.extend(targets)
  # Exclude projects without a visual project guid, such as the tests.
  projects = [project for project in projects
                if project.get('vs_project_guid', None)]

  # Exclude C++ projects for now
  projects = [project for project in projects
                if not project['language'] == 'c++']

  project_dict = dict([(p['name'], p) for p in projects])

  dictionary['vsprojects'] = projects
  dictionary['vsproject_dict'] = project_dict