gfx/skia/dump_mozbuild.py

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 # Copyright (c) 2012 Google Inc. 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.
     5 import collections
     6 import os
     7 import gyp
     8 import gyp.common
     9 import gyp.msvs_emulation
    10 import json
    11 import sys
    13 generator_supports_multiple_toolsets = True
    15 generator_wants_static_library_dependencies_adjusted = False
    17 generator_default_variables = {
    18 }
    19 for dirname in ['INTERMEDIATE_DIR', 'SHARED_INTERMEDIATE_DIR', 'PRODUCT_DIR',
    20                 'LIB_DIR', 'SHARED_LIB_DIR']:
    21   # Some gyp steps fail if these are empty(!).
    22   generator_default_variables[dirname] = 'dir'
    23 for unused in ['RULE_INPUT_PATH', 'RULE_INPUT_ROOT', 'RULE_INPUT_NAME',
    24                'RULE_INPUT_DIRNAME', 'RULE_INPUT_EXT',
    25                'EXECUTABLE_PREFIX', 'EXECUTABLE_SUFFIX',
    26                'STATIC_LIB_PREFIX', 'STATIC_LIB_SUFFIX',
    27                'SHARED_LIB_PREFIX', 'SHARED_LIB_SUFFIX',
    28                'CONFIGURATION_NAME']:
    29   generator_default_variables[unused] = ''
    32 def CalculateVariables(default_variables, params):
    33   generator_flags = params.get('generator_flags', {})
    34   for key, val in generator_flags.items():
    35     default_variables.setdefault(key, val)
    36   default_variables.setdefault('OS', gyp.common.GetFlavor(params))
    38   flavor = gyp.common.GetFlavor(params)
    39   if flavor =='win':
    40     # Copy additional generator configuration data from VS, which is shared
    41     # by the Windows Ninja generator.
    42     import gyp.generator.msvs as msvs_generator
    43     generator_additional_non_configuration_keys = getattr(msvs_generator,
    44         'generator_additional_non_configuration_keys', [])
    45     generator_additional_path_sections = getattr(msvs_generator,
    46         'generator_additional_path_sections', [])
    48     gyp.msvs_emulation.CalculateCommonVariables(default_variables, params)
    51 def CalculateGeneratorInputInfo(params):
    52   """Calculate the generator specific info that gets fed to input (called by
    53   gyp)."""
    54   generator_flags = params.get('generator_flags', {})
    55   if generator_flags.get('adjust_static_libraries', False):
    56     global generator_wants_static_library_dependencies_adjusted
    57     generator_wants_static_library_dependencies_adjusted = True
    59 def GetOS(params):
    60   for d in params['defines']:
    61     pass
    63 def GenerateOutput(target_list, target_dicts, data, params):
    64   # Map of target -> list of targets it depends on.
    65   edges = {}
    67   # Queue of targets to visit.
    68   targets_to_visit = target_list[:]
    70   sources = [];
    72   while len(targets_to_visit) > 0:
    73     target = targets_to_visit.pop()
    74     if target in edges:
    75       continue
    76     edges[target] = []
    78     target_sources = target_dicts[target].get('sources')
    79     if target_sources:
    80       for source in target_sources:
    81         if source.endswith('.cpp'):
    82           sources.append(source)
    84     for dep in target_dicts[target].get('dependencies', []):
    85       edges[target].append(dep)
    86       targets_to_visit.append(dep)
    88   skia_os = data['gyp/core.gyp']['variables']['skia_os%']
    90   f = open('sources.json', 'w')
    91   json.dump(sources, f)
    92   f.close()

mercurial