gfx/skia/dump_mozbuild.py

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/skia/dump_mozbuild.py	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,92 @@
     1.4 +# Copyright (c) 2012 Google Inc. All rights reserved.
     1.5 +# Use of this source code is governed by a BSD-style license that can be
     1.6 +# found in the LICENSE file.
     1.7 +
     1.8 +import collections
     1.9 +import os
    1.10 +import gyp
    1.11 +import gyp.common
    1.12 +import gyp.msvs_emulation
    1.13 +import json
    1.14 +import sys
    1.15 +
    1.16 +generator_supports_multiple_toolsets = True
    1.17 +
    1.18 +generator_wants_static_library_dependencies_adjusted = False
    1.19 +
    1.20 +generator_default_variables = {
    1.21 +}
    1.22 +for dirname in ['INTERMEDIATE_DIR', 'SHARED_INTERMEDIATE_DIR', 'PRODUCT_DIR',
    1.23 +                'LIB_DIR', 'SHARED_LIB_DIR']:
    1.24 +  # Some gyp steps fail if these are empty(!).
    1.25 +  generator_default_variables[dirname] = 'dir'
    1.26 +for unused in ['RULE_INPUT_PATH', 'RULE_INPUT_ROOT', 'RULE_INPUT_NAME',
    1.27 +               'RULE_INPUT_DIRNAME', 'RULE_INPUT_EXT',
    1.28 +               'EXECUTABLE_PREFIX', 'EXECUTABLE_SUFFIX',
    1.29 +               'STATIC_LIB_PREFIX', 'STATIC_LIB_SUFFIX',
    1.30 +               'SHARED_LIB_PREFIX', 'SHARED_LIB_SUFFIX',
    1.31 +               'CONFIGURATION_NAME']:
    1.32 +  generator_default_variables[unused] = ''
    1.33 +
    1.34 +
    1.35 +def CalculateVariables(default_variables, params):
    1.36 +  generator_flags = params.get('generator_flags', {})
    1.37 +  for key, val in generator_flags.items():
    1.38 +    default_variables.setdefault(key, val)
    1.39 +  default_variables.setdefault('OS', gyp.common.GetFlavor(params))
    1.40 +
    1.41 +  flavor = gyp.common.GetFlavor(params)
    1.42 +  if flavor =='win':
    1.43 +    # Copy additional generator configuration data from VS, which is shared
    1.44 +    # by the Windows Ninja generator.
    1.45 +    import gyp.generator.msvs as msvs_generator
    1.46 +    generator_additional_non_configuration_keys = getattr(msvs_generator,
    1.47 +        'generator_additional_non_configuration_keys', [])
    1.48 +    generator_additional_path_sections = getattr(msvs_generator,
    1.49 +        'generator_additional_path_sections', [])
    1.50 +
    1.51 +    gyp.msvs_emulation.CalculateCommonVariables(default_variables, params)
    1.52 +
    1.53 +
    1.54 +def CalculateGeneratorInputInfo(params):
    1.55 +  """Calculate the generator specific info that gets fed to input (called by
    1.56 +  gyp)."""
    1.57 +  generator_flags = params.get('generator_flags', {})
    1.58 +  if generator_flags.get('adjust_static_libraries', False):
    1.59 +    global generator_wants_static_library_dependencies_adjusted
    1.60 +    generator_wants_static_library_dependencies_adjusted = True
    1.61 +
    1.62 +def GetOS(params):
    1.63 +  for d in params['defines']:
    1.64 +    pass
    1.65 +
    1.66 +def GenerateOutput(target_list, target_dicts, data, params):
    1.67 +  # Map of target -> list of targets it depends on.
    1.68 +  edges = {}
    1.69 +
    1.70 +  # Queue of targets to visit.
    1.71 +  targets_to_visit = target_list[:]
    1.72 +
    1.73 +  sources = [];
    1.74 +
    1.75 +  while len(targets_to_visit) > 0:
    1.76 +    target = targets_to_visit.pop()
    1.77 +    if target in edges:
    1.78 +      continue
    1.79 +    edges[target] = []
    1.80 +
    1.81 +    target_sources = target_dicts[target].get('sources')
    1.82 +    if target_sources:
    1.83 +      for source in target_sources:
    1.84 +        if source.endswith('.cpp'):
    1.85 +          sources.append(source)
    1.86 +
    1.87 +    for dep in target_dicts[target].get('dependencies', []):
    1.88 +      edges[target].append(dep)
    1.89 +      targets_to_visit.append(dep)
    1.90 +
    1.91 +  skia_os = data['gyp/core.gyp']['variables']['skia_os%']
    1.92 +
    1.93 +  f = open('sources.json', 'w')
    1.94 +  json.dump(sources, f)
    1.95 +  f.close()
    1.96 \ No newline at end of file

mercurial