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