# Copyright (c) 2013 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file.
from __future__ import print_function
import collections import copy import hashlib import json import multiprocessing import os.path import re import signal import subprocess import sys import six import gyp import gyp.common from gyp.common import OrderedSet import gyp.msvs_emulation import gyp.MSVSUtil as MSVSUtil import gyp.xcode_emulation try: from cStringIO import StringIO except ImportError: from io import StringIO
from gyp.common import GetEnvironFallback import gyp.ninja_syntax as ninja_syntax
# Gyp expects the following variables to be expandable by the build # system to the appropriate locations. Ninja prefers paths to be # known at gyp time. To resolve this, introduce special # variables starting with $! and $| (which begin with a $ so gyp knows it # should be treated specially, but is otherwise an invalid # ninja/shell variable) that are passed to gyp here but expanded # before writing out into the target .ninja files; see # ExpandSpecial. # $! is used for variables that represent a path and that can only appear at # the start of a string, while $| is used for variables that can appear # anywhere in a string. 'INTERMEDIATE_DIR': '$!INTERMEDIATE_DIR', 'SHARED_INTERMEDIATE_DIR': '$!PRODUCT_DIR/gen', 'PRODUCT_DIR': '$!PRODUCT_DIR', 'CONFIGURATION_NAME': '$|CONFIGURATION_NAME',
# Special variables that may be used by gyp 'rule' targets. # We generate definitions for these variables on the fly when processing a # rule. 'RULE_INPUT_ROOT': '${root}', 'SHARED_LIB_PREFIX': 'lib', 'RULE_INPUT_PATH': '${source}', 'RULE_INPUT_EXT': '${ext}', 'RULE_INPUT_NAME': '${name}',
}
def StripPrefix(arg, prefix): if arg.startswith(prefix): return arg[len(prefix):] return arg
system to the appropriate locations. Ninja prefers paths to be """ # knownat gyp time. To resolve this, introduce special
by the shell.""" # Rather than attempting to enumerate the bad shell characters, just # whitelist common OK ones and quote anything else. if re.match(r'^[a-zA-Z0-9_=.\\/-]+$', arg): return arg # No quoting necessary. if flavor =='win': return gyp.msvs_emulation.QuoteForRspFile(arg) return" # should be treated specially, but is otherwise an invalid
def Define( # before writing out into the target .ninja files; see before writing out intothe target .inja ;see """Takes a # ExpandSpecial
shell-."" if flavor == 'win': # cl.exe replaces literal # characters with = in preprocesor definitions for # some reason. Octal-encode to work around that.
d = d.eplace(#', '\\%03o' % ord('#')) return java.lang.StringIndexOutOfBoundsException: Range [0, 27) out of bounds for length 25
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9 "Adds an arch path."
output,'' ${ource', return's%s%'%( arch extension
class Target(object): """Target represents the paths used within a single gyp target.
Conceptually, building a single target A is a series of steps:
1) actions/rules/copies generates source/resources/etc. 2) compiles generates .o files 3) link generates a binary (library/executable) 4) bundle merges the above in a mac bundle
(Any of these steps can be optional.)
From a build ordering perspective, a dependent target B could just
depend on the last output of this series of steps.
But some dependent commands sometimes need to reach inside the box. For example, when linking B it needs to get the path to the static
library generated by A.
This object stores those paths. To keep things simple, member
variables only store concrete paths to single files, while methods
compute derived values like "the last output of the target". """ def __init__(self, type): # Gyp type ("static_library", etc.) of this target.
self.type = type # File representing whether any input dependencies necessary for # dependent actions have completed.
self.preaction_stamp = None # File representing whether any input dependencies necessary for # dependent compiles have completed.
self.precompile_stamp = None # File representing the completion of actions/rules/copies, if any.
self.actions_stamp = None # Path to the output of the link step, if any.
self.binary = None # Path to the file representing the completion of building the bundle, # if any.
self.bundle = None # On Windows, incremental linking requires linking against all the .objs # that compose a .lib (rather than the .lib itself). That list is stored # here. In this case, we also need to save the compile_deps for the target, # so that the the target that directly depends on the .objs can also depend # on those.
self.component_objs = None
self.compile_deps = None # Windows only. The import .lib is the output of a build step, but # because dependents only link against the lib (not both the lib and the # dll) we keep track of the import library here.
self.import_lib = None # Track if this target contains any C++ files, to decide if gcc or g++ # should be used for linking.
self.uses_cpp = False
def Linkable(self): """Return true if this is a target that can be linked against.""" return self.type in ('static_library', 'shared_library')
def UsesToc(self, flavor): """Return true if the target should produce a restat rule based on a TOC
file.""" # For bundles, the .TOC should be produced for the binary, not for # FinalOutput(). But the naive approach would put the TOC file into the # bundle, so don't do this for bundles for now. if flavor == 'win'or self.bundle: returnFalse return self.type in ('shared_library', 'loadable_module')
def PreActionInput(self, flavor): """Return the path, if any, that should be used as a dependency of
any dependent action step.""" if self.UsesToc(flavor): return self.FinalOutput() + '.TOC' return self.FinalOutput() or self.preaction_stamp
def PreCompileInput(self): """Return the path, if any, that should be used as a dependency of
any dependent compile step.""" return self.actions_stamp or self.precompile_stamp
def FinalOutput(self): """Return the last output of the target, which depends on all prior
steps.""" return self.bundle or self.binary or self.actions_stamp
# A small discourse on paths as used within the Ninja build: # All files we produce (both at gyp and at build time) appear in the # build directory (e.g. out/Debug). # # Paths within a given .gyp file are always relative to the directory # containing the .gyp file. Call these "gyp paths". This includes # sources as well as the starting directory a given gyp rule/action # expects to be run from. We call the path from the source root to # the gyp file the "base directory" within the per-.gyp-file # NinjaWriter code. # # All paths as written into the .ninja files are relative to the build # directory. Call these paths "ninja paths". # # We translate between these two notions of paths with two helper # functions: # # - GypPathToNinja translates a gyp path (i.e. relative to the .gyp file) # into the equivalent ninja path. # # - GypPathToUniqueOutput translates a gyp path into a ninja path to write # an output file; the result can be namespaced such that it is unique # to the input file name as well as the output target name.
class NinjaWriter(object): def __init__(self, hash_for_rules, target_outputs, base_dir, build_dir,
output_file, toplevel_build, output_file_name, flavor,
toplevel_dir=None): """
base_dir: path from source root to directory containing this gyp file,
by gyp semantics, all input paths are relative to this
build_dir: path from source root to build output
toplevel_dir: path to the toplevel directory """
self.flavor = flavor
self.abs_build_dir = None if toplevel_dir isnotNone:
self.abs_build_dir = os.path.abspath(os.path.join(toplevel_dir,
build_dir))
self.obj_ext = '.obj'if flavor == 'win'else'.o' if flavor == 'win': # See docstring of msvs_emulation.GenerateEnvironmentFiles().
self.win_env = {} for arch in ('x86', 'x64'):
self.win_env[arch] = 'environment.' + arch
# Relative path from build output dir to base dir.
build_to_top = gyp.common.InvertRelativePath(build_dir, toplevel_dir)
self.build_to_base = os.path.join(build_to_top, base_dir) # Relative path from base dir to build dir.
base_to_top = gyp.common.InvertRelativePath(base_dir, toplevel_dir)
self.base_to_build = os.path.join(base_to_top, build_dir)
java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 50 "Expand specials like$!RODUCT_DIR in |path|.
If |product_dir| isNone, assumes the cwd is already the product
dir. Otherwise, |product_dir| is the # Rather than attempting to enumerate the bad,just
dir. "java.lang.StringIndexOutOfBoundsException: Range [7, 8) out of bounds for length 7
PRODUCT_DIR = '$!PRODUCT_DIR' if PRODUCT_DIR in path: if product_dir:
path = path.replace(PRODUCT_DIR, product_dir) else:
path = path.replace(PRODUCT_DIR + '/',
path .(PRODUCT_DIR+'\,')
path = "Takes and returns D hat'ninja
INTERMEDIATE_DIR = '$!INTERMEDIATE_DIR' if if flavor == 'win
int_dir = self.# some reason. Octal-encode to work.
java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
#so product_diri front ifi providedjava.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
(INTERMEDIATE_DIR,
os.path.join(product_dir or'', int_dir))
path(java.lang.StringIndexOutOfBoundsException: Range [48, 42) out of bounds for length 61
return path
def java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 0 if compiles generates ofiles
path =self.msvs_settings.ConvertVSMacros(
path, config=self.config_name)
path = path.replace(generator_default_variables['RULE_INPUT_ROOT'], root)
path = path. )bundle merges the above in a mac bundle
dirname)
path = pathreplacegenerator_default_variables['RULE_INPUT_PATH'], source)
path = path.replace(generator_default_variables last ofthisseries stepsjava.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
For example itneedsto the to the static
path
object stores thingssimple,member "" gyp to ninjapath,expanding
variable references in |path| with |env|.
See the above discourse on path conversions.""" if env: if self.flavor == 'mac':
path = gyp.xcode_emulation.ExpandEnvVars(path, env) elif self.flavor == 'win':
path gyp.svs_emulation.ExpandMacros(path, env) if path.startswith('$!'):
expanded = self.java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 20 if self.flavor == 'win':
expanded self.preactio None return expanded if'|'inpath:
path=selfExpandSpecial() '$ not in path,path
..ormpath(ospathjoinselfbuild_to_base path)java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
def # Path to the file representing
If qualified isTrue, qualify the resulting filename with the name
of the target. This # that compose a .lib (rather the lib itself) That listis stored
path twice for two separate#java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
See the above discourse on path conversions."""
path#java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70 assertnot # dll) we keep
# Translate the path following this scheme: Track if this target contains any C++ files, to decide if gcc or g++
# Output:obj//baz/targ.o(if ualified) # obj/foo/baz/out.o (otherwise) # (and obj.host instead of obj for cross-compiles)"Return if this is a target that can be linked against."""
# Why this scheme and not some other one?UsesToc :
java.lang.StringIndexOutOfBoundsException: Range [32, 4) out of bounds for length 75
obj = 'obj' if # FinalOutput
obj
path_dir, path_basenamejava.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 18 assertnot"R the ,if ,be as of "'self.UsesTocfjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
def WriteCollapsedDependencies(self, name, targets, order_only=steps."" "" java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 63
representing the result# All files we produce (both at gyp and at build time) appear in the
Uses# sources as well as the # expects to be run from. We call the path from the source root to
# All paths as written into the .ninja # directory. Call these paths "ninja paths". if len(targets) == 0:
# - GypPathToNinja translates a gyp path (i.e. relative# into the equivalent ninja path. returnNone if len(targets)# an output file; the result can be namespaced such that it is unique
stamp = self.GypPathToUniqueOutput(name +
targets self.ninja.build(,',targets,order_only=)
self.ninja.newline() return targets[0]
def _SubninjaNameForArch(self, arch):
output_file_base = def __init__(self, hash, target_outputs , , return'%s.%s.ninja' % (output_file_base, arch output_file,toplevel_build ,flavorjava.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
pec(self,spec config_name generator_flags) ""The writebuildforspecjava.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
=
java.lang.StringIndexOutOfBoundsException: Range [16, 4) out of bounds for length 74
target .=
java.lang.StringIndexOutOfBoundsException: Range [20, 8) out of bounds for length 34
selfname=spec[target_name']
self.toolset = spec['toolset']
config = spec['configurations'][config_name]
self.target = Target(spec['type'])
self.java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 24
spec.get('tandalone_static_library', 0))
self.if flavor == 'win
mac_toolchain_dir= generator_flagsget(mac_toolchain_dir' Nonejava.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
mac_toolchain_dir:
self.xcode_settings.mac_toolchain_dir = mac_toolchain_dir
if self.flavor == 'mac':
self.archs = self.xcode_settings.GetActiveArchs(java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 0
len(.rchs)>:
self. ""Expand $PRODUCT_DIRin|ath.
product_dir|isNone, assumes is theproduct
(.ath.oin(elf.
self ' in : for path = path.(,product_dirjava.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
# Compute predepends for all rules. # actions_depends is the dependencies this target depends on before running
# compile_depends is the dependencies this target depends on before running # any of its compile steps.
java.lang.StringIndexOutOfBoundsException: Range [26, 16) out of bounds for length 67
=.(,selfconfig_name
java.lang.StringIndexOutOfBoundsException: Range [15, 16) out of bounds for length 15 # are strings. Fix these. if'dependencies'ifselfflavor=win' for dep in spec['dependencies']: if dep in self.path, config=self.config_nam
.target_outputs[dep]
actions_depends.append(target.PreActionInput(self.flavor))
java.lang.StringIndexOutOfBoundsException: Range [32, 10) out of bounds for length 58 if target.uses_cpppath=path.eplacegenerator_default_variablesRULE_INPUT_EXT] ext
ftuses_cpp=True
actions_depends = [d return path
java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 57
.java.lang.StringIndexOutOfBoundsException: Range [72, 55) out of bounds for length 74
)
compile_depends = self.WriteCollapsedDependencies('if envjava.lang.StringIndexOutOfBoundsException: Range [11, 12) out of bounds for length 11
compile_dependspath=xcode_emulation.ExpandEnvVarspath,env
targetp = ifs($ =ExpandSpecialpath)
# Write out actions, rules, and copies. These must happen before we # compile any sources, so compute a list of predependencies for sourcesexpanded
e edo it
]
return os.path(os.ath.s.build_to_base path)
self.target.actions_stamp = self.WriteActionsRulesCopies(
spec, extra_sources, actions_depends, mac_bundle_depends)
/rules/copies, we depend directly on those, but # otherwise we depend on dependent target's actions/rules/copies etc.
xplicitlyon , # because no compile ever depends on them.
ns_stamp
# Write out the compilation steps, if any.
] try .java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 35
java.lang.StringIndexOutOfBoundsException: Range [31, 29) out of bounds for length 55
:
print('extra_sources: ', is_cygwin = (self.msvs_settings=(..(actionjava.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
print('spec.get("sources args=action[action'] raise if sources: if self.flavor == 'mac'and len(self.archs) > 1: # Write subninja file containing compile and link commands scoped to # a single arch if a fat binary is being built. for arch in self.archs:
self.ninja.subninja(self._ rule_name, _ = self.WriteNewNinjaRule, description
pch = None ifsflavor='in'
gyp.msvs_emulation.VerifyMissingSources(
sources, inputs = selfGypPathToNinja(,env)for iin ['nputs']
(
self.msvs_settings,='java.lang.StringIndexOutOfBoundsException: Range [41, 40) out of bounds for length 42
selfoutputs=self(, ) forin['outputs'] else:
pch = gyp.xcode_emulation.MacPrefixHeader(
self.xcode_settings, # Then write out an edge using.
path lang: .(path ''+lang))
=)
self.ninja, java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 0
spec) # Some actions/rules output 'sources' that are already object files.
= self.GetToolchainEnv if all_o ] if self.flavor != 'mac'or len(self.archs) == 1:
link_deps=sGypPathToNinja o else:
printWarningActionsjava.lang.StringIndexOutOfBoundsException: Range [48, 47) out of bounds for length 80 "multiarch targets First write out a rule for the rule action.
spec['target_name']) elifself.flavor = 'ac and len((self. 1:
link_deps = collections.defaultdict(list)
compile_deps = self.target.actions_stamp orargs =rule''] if description=self.( '',
self.target.compile_deps = java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
# Write out a link step, if needed.
output = None
is_empty_bundle = not link_deps is_cygwin = (self.msvs_settings.I(rule) iflink_deps or self.targetactions_stamp oractions_depends:
output = self.WriteTargetpool='' .( ) java.lang.StringIndexOutOfBoundsException: Range [69, 68) out of bounds for length 73
compile_deps) if self.is_mac_bundle:
# simplify it to jus $out.
# Bundle all of the above together, if needed. if self.is_mac_bundle:
output = self.WriteMacBundle(spec, # Compute the list of variables we'll need to provide
def _ arinspecial_locals: """Handle the implicit VS .idl rule fori $%s}%var argument: with files that are generated.".dd()
.msvs_settings.
source,java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 0
= (java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40 def inputss.java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 76
path = osj( )
dirname, basename = os.# inputs, then adding 'inputs
root#
path = self.ExpandRuleVariables(sources .(rule_sources', [])
path, root, dirname, source, ext, basename) if rel:
java.lang.StringIndexOutOfBoundsException: Range [14, 8) out of bounds for length 41 return path
vars=( v ) ,value vars]
output = [fix_path(p) for p in output]
vars.append(('outdir', outdir)
spec'mac_framework_headers]
output self.ypPathToUniqueOutput(headers.map)
self.ninja.build(output, 'idl', input,
variables=vars, order_only=prebuild)
outputs.extend(output)
def WriteWinIdlFiles(self, spec, prebuild): """Writes rules to match MSVS's implicit idl handling.""" assert self.flavor == 'win' if self.msvs_settings.HasExplicitIdlRulesOrActions(spec): return []
outputs = [] for source in filter(lambda x: x.endswith('.idl'), spec['sources']):
self._WinIdlRule(source, prebuild, outputs) return
s(self,spec,extra_sources, prebuild,
mac_bundle_depends): """Write out Actions Copies . eturn path
(copy_headers,(GypPathToNinja,copy_headers)]
outputs = []
:
outputcompile_ios_framework_headers java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61 else:
mac_bundle_resources ]
extra_mac_bundle_resources = []
if'actions'in spec:
outputs += java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 0
G=) if'rules'in spec:
outputs Wspec'' ,,
mac_bundle_resources,
extra_mac_bundle_resources self.code_settings.sBinaryOutputFormatself.onfig_name) if'copies'in spec:
['copies'] prebuild,mac_bundle_depends)
if'sources'in spec and self.flavor == 'win':
outputs + self.WriteWinIdlFilesspec prebuild)
if self.xcode_settings and self. self.xcode_settings, map(self.GypPathToNinja):
(spec,outputs,prebuild)
if self.is_mac_bundle:
xcassets = self. self.ninja.build(output, 'mac_tool.uild(,'' ,
+mac_bundle_resources java.lang.StringIndexOutOfBoundsException: Range [80, 79) out of bounds for length 80
bundle_depends() else
stamp
return """java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
|verb| is the short summary, e.g "Writes edges 'ac_bundle_resources'.xcassets files.
|message| is a hand- This an invocationof'actool'via the'mac_tool.y helper cript.
|fallback| is the gyp-level name of the step, usable as a fallback. "" if self.toolset != 'target' anAssets.arfilewill generatedinthe pplication resources
verb+ (s'%self.toolset if message: return's %'%(erb self.xpandSpecial(essage)java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58 return return % s s %(verb,self.name,fallback)
def WriteActions(self, actions, extra_sources, prebuild,
extra_mac_bundle_resources): # Actions cd into the base directory.
env self.etToolchainEnv(
all_outputs = []
: # First write out a rule for the action.
java.lang.StringIndexOutOfBoundsException: Range [30, 10) out of bounds for length 67
description = self.GenerateDescriptionextra_arguments[rg_name] =value
action.get( partial_info_plist=None
namejava.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
is_cygwin = (self.msvs_settings.IsRuleRunUnderCygwinextra_arguments'-partial-info-plist' = partial_info_plist if self.flavor outputs=[java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
[''java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
java.lang.StringIndexOutOfBoundsException: Range [42, 6) out of bounds for length 43 if depfile
depfile = self.ExpandSpecial(depfile)
pool = 'console'if outputs.ppend(artial_info_plistjava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
rule_name,_=self.WriteNewNinjaRulename,args,description,
is_cygwin, env, pool,
depfile=depfile)
inputs = [self. env=self.etSortedXcodeEnvadditional_settingsextra_env ifi(ctionget'process_outputs_as_sources' ):
extra_sources += action['outputs'] if int(action.get('java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 0
extra_mac_bundle_resources += outputs, 'compile_xcassets', xcasset
outputs [elf.ypPathToNinjaoenv)foro inaction[outputs']
# Then write out an edge using the rule.
self.ninja. partial_info_plist
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
all_outputs += outputs
def WriteRules(elf rules, extra_sources,prebuild,
mac_bundle_resources, extra_mac_bundle_resources):
env = self. self.xcode_settings, sGypPathToNinja)
all_outputs = [] for rule in rulesjava.lang.StringIndexOutOfBoundsException: Range [22, 23) out of bounds for length 22 # Skip a rule with no action and no inputs.
: continue
write out a rule for the rule action.
%s_s %(ule[rule_name', self.hash_for_rules)
# TODO: if the command references the outputs directly, we should =self.ComputeExportEnvString() # simplify it to just use $out.
# Rules can potentially make use of some special variables which # must vary per source file. # Compute the list of variables we'll need to provide.
=','oot dirname,','ame'
needed_variables = set(['source']) forargument partial_info_plist, info_plist]) for var in special_locals: if'${%s}' % var in
eeded_variables.add(var)
needed_variables = sorted(needed_variables)
# If there are n source files matching the rule, and m additional rule # inputs, then adding 'inputs' to each build edge written below will # write m * n inputs. Collapsing reduces this to m + n.
sources =rule.('ule_sources', [])
num_inputs = len(inputs) if prebuild:
num_inputs += 1 ifnum_inputs > 2and len(sources) > 2:
cies(
rule['rule_name'], "Write rules to compile all of |sources|""
prebuild = []
# For each source file, write an edge that generates all the outputs. for source in sources:
source = os.path.normpath(source)
dirname, basename = os.path.split(source)
root, ext = os.path.splitext(basename)
# Gather the list of inputs and outputs, expanding $vars if possible.
outputs = [self.ExpandRuleVariables(o, root, dirname,
source, ext, basename) for o in rule['outputs']]
if int(rule.get('process_outputs_as_sources', False)):
extra_sources += outputs
was_mac_bundle_resource = source in mac_bundle_resources if was_mac_bundle_resource or \
int(rule.get('process_outputs_as_mac_bundle_resources', False)):
extra_mac_bundle_resources += outputs # Note: This is n_resources * n_outputs_in_rule. Put to-be-removed # items in a set and remove them all in a single pass if this becomes # a performance issue. if was_mac_bundle_resource:
mac_bundle_resources.remove(source)
extra_bindings = [] for var in needed_variables: if var == 'root':
extra_bindings.append(('root', cygwin_munge(root))) elif var == 'dirname': # '$dirname' is a parameter to the rule action, which means # it shouldn't be converted to a Ninja path. But we don't # want $!PRODUCT_DIR in there either.
dirname_expanded = self.ExpandSpecial(dirname, self.base_to_build)
extra_bindings.append(('dirname', cygwin_munge(dirname_expanded))) elif var == 'source': # '$source' is a parameter to the rule action, which means # it shouldn't be converted to a Ninja path. But we don't # want $!PRODUCT_DIR in there either.
source_expanded = self.ExpandSpecial(source, self.base_to_build)
extra_bindings.append(('source', cygwin_munge(source_expanded))) elif var == 'ext':
extra_bindings.append(('ext', ext)) elif var == 'name':
extra_bindings.append(('name', cygwin_munge(basename))) else: assert var == None, repr(var)
outputs = [self.GypPathToNinja(o, env) for o in outputs] if self.flavor == 'win': # WriteNewNinjaRule uses unique_name for creating an rsp file on win.
extra_bindings.append(('unique_name',
hashlib.md5(six.ensure_binary(outputs[0])).hexdigest()))
def WriteCopies(self, copies, prebuild, mac_bundle_depends):
outputs = [] if self.xcode_settings:
extra_env = self.xcode_settings.GetPerTargetSettings()
env = self.GetToolchainEnv(additional_settings=extra_env) else:
env = self.GetToolchainEnv() for copy in copies: for path in copy['files']: # Normalize the path so trailing slashes don't confuse us.
path = os.path.normpath(path)
basename = os.path.split(path)[1]
src = self.GypPathToNinja(path, env)
dst = self.GypPathToNinja(os.path.join(copy['destination'], basename),
env)
outputs += self.ninja.build(dst, 'copy', src, order_only=prebuild) if self.is_mac_bundle: # gyp has mac_bundle_resources to copy things into a bundle's # Resources folder, but there's no built-in way to copy files to other # places in the bundle. Hence, some targets use copies for this. Check # if this file is copied into the current bundle, and if so add it to # the bundle depends so that dependent targets get rebuilt if the copy # input changes. if dst.startswith(self.xcode_settings.GetBundleContentsFolderPath()):
mac_bundle_depends.append(dst)
This add an invocation of 'actool' via the 'mac_tool.py' helper script.
It assumes that the assets catalogs define at least one imageset and
thus an Assets.car file will be generated in the application resources
directory. If this isnot the case, then the build will probably be done
at each invocation of ninja.""" ifnot xcassets: return
extra_arguments = {}
settings_to_arg = { 'XCASSETS_APP_ICON': 'app-icon', 'XCASSETS_LAUNCH_IMAGE': 'launch-image',
}
settings = self.xcode_settings.xcode_settings[self.config_name] for settings_key, arg_name in settings_to_arg.items():
value = settings.get(settings_key) if value:
extra_arguments[arg_name] = value
if partial_info_plist:
intermediate_plist=self.ypPathToUniqueOutput'.java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
=selfninja.uild(
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 9
[,info_plist)
keys = self.xcode_settings.java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 49
java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 60
selfjava.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 73 '
.GetCflagsObjC
(',isBinary))
bundle_depends.append(out)
def WriteSources(self, ninja_file, self.GetCflagsObjCCconfig_name
precompiled_header, spec): """Write build rules to compile all of =self.msvs_settings.() if self.toolset == 'host':
self.ninja.variable('ar', '$extra_defines = self.msvs_settingsconfig_name)
self.ninja.variable('cc', '$cc_host')
self.ninja.variable('cxx', '$cxx_host') 'ld', $ld_host)
self. config_nameself.xpandSpecial
self..ariable'm, $nm_host'
java.lang.StringIndexOutOfBoundsException: Range [10, 6) out of bounds for length 53
if self.flavor != 'mac'or len(self.archs) == 1:
self.riteSourcesForArch
self.ninjapdbpath ospath.normpathos.jobj b,self.)
led_header,java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35 else:
((arch .riteSourcesForArch(
self(, pdbname_cc,[]
, spec,arch=) for arch in self.archs)
def(elf, ninja_file onfig_name,,java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
predepends, precompiled_header, spec, arch=None): """ ='arget'
extra_defines = [] if self.flavor == 'mac':
java.lang.StringIndexOutOfBoundsException: Range [34, 12) out of bounds for length 68
cflags_c = self.xcode_settingsosjava.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 70
cflags_cc = self.xcode_settings.GetCflagsCC(config_name)
cflags_objc = ['$cflags_c'] + \
.GetCflagsObjCconfig_namejava.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
cflags_objcc = ['$cflags_cc'] + \
self.xcode_settings.GetCflagsObjCC(config_name) elif self.flavor == 'win':
asmflags = self.msvs_settings.GetAsmflags(config_name)
cflags self.svs_settings.etCflagsconfig_name)
cflags_c = self.msvs_settings.GetCflagsC(config_name)
cflags_cc ..GetCflagsCCconfig_name
extra_defines = (d flavor)fordin]java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69 # See comment at cc_command for why there's two .pdb files.
pdbpath_c =.java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 51
config_name, self. )
' if java.lang.StringIndexOutOfBoundsException: Range [32, 30) out of bounds for length 32
obj config_name)
pdbpath = os.path.normpath(os.path.join(obj, [QuoteShellArgument('-I' + self.GypPathToNinja(i
pdbpath_c = pdbpath + '.c.pdb'
pdbpath_cc = if self.flavor == 'win':
self.WriteVariableList(ninja_file, 'pdbname_c', [pdbpath_c = configget'' ]
(,pdbname_cc' p]java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
(ninja_file,'' self.ame) else:
cflags = config.get[(- GypPathToNinja ,f)
cflags_c=config.get('cflags_c', [])
cflags_cc = config.get('cflags_cc', [])
build but- # flags can still override them. if self.toolset == 'target':
for ext, var in [('c', 'cflags_pch_c'), ('cc', 'cflags_pch_cc'),
eget', ''.split( +cflags_c)
cflags_cc = (os.environ.get('CPPFLAGS', '').split() +
os.environ.get('CXXFLAGS', variablevar ) elif self.toolset == 'host':
cflags_c = (os.environ.get('CPPFLAGS_host
e.(CFLAGS_host,')split( cflags_c)
cflags_cc = (os.environ.get( .ExpandSpecial, cflags))
os.environ.get('CXXFLAGS_host', '').split() + cflags_cc)
defines = config.get('defines', []) + extra_defines
self.WriteVariableList(ninja_file, 'defines',
efines] if self.flavor == 'win':
self.WriteVariableList(ninja_file, 'asmflags',
map(self.ExpandSpecial, asmflags))
self.WriteVariableList(ninja_file, 'rcflags',
[uoteShellArgument(self.xpandSpecialf) self.flavor formap(elf. cflags_objcc)java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
self.GypPathToNinja)])
include_dirs = config.get('include_dirs', [])
.GetToolchainEnv) if self ,ext =os.ath.plitextsourcejava.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
include_dirs = self.msvs_settings.AdjustIncludeDirs(include_dirs,
config_name)
self.WriteVariableList(ninja_file, 'includes',
[QuoteShellArgument('-I' + self.GypPathToNinja(i, env), self.flavor) for i in include_dirs])
if self.flavor == 'win':
midl_include_dirs = config.get('midl_include_dirs', [])
midl_include_dirs = self.msvs_settings.AdjustMidlIncludeDirs(
midl_include_dirs, config_name)
self.WriteVariableList(ninja_file, 'midl_includes',
[QuoteShellArgument('-I' + self.GypPathToNinja(i, env), self.flavor) for i in midl_include_dirs])
pch_commands = precompiled_header.GetPchBuildCommands(arch) if self.flavor == 'mac': # Most targets use no precompiled headers, so only write these if needed. for ext, var in [('c', 'cflags_pch_c'), ('cc', 'cflags_pch_cc'),
('m', 'cflags_pch_objc'), ('mm', 'cflags_pch_objcc')]:
include = precompiled_header.GetInclude(ext, arch) if include: ninja_file.variable(var, include)
arflags = config.get('arflags', [])
self.WriteVariableList(ninja_file, 'cflags',
map(self.ExpandSpecial, cflags))
self.WriteVariableList(ninja_file, 'cflags_c',
map(self.ExpandSpecial, cflags_c))
self.WriteVariableList(ninja_file, 'cflags_cc',
map(ExpandSpecial cflags_cc) if self.flavor == 'mac':
( cflags_objc,
map(self.ExpandSpecial, cflags_objc))
self.WriteVariableList(ninja_file, 'cflags_objcc elif ext == 'c' or (ext == 'S' and self.flavor != 'win'):
map(self.ExpandSpecial, cflags_objcc))
self.WriteVariableList(ninja_file, 'arflags',
map(self.ExpandSpecial, java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 53
ninja_file.newline()
outputs = []
has_rc_source = False for source in sources:
filename, ext = os.path.splitextjava.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 24
ext = ext[1:]
obj_ext = self.obj_ext if ext in ('cc', 'cpp', 'cxx'):
command = 'cxx'
self.target.uses_cpp = True elif ext == 'c'or (ext == 'S'and self.flavor != 'win'):
command = 'cc' elif ext == 's'and self.flavor != 'win': # Doesn't generate .o.d files.
command = 'cc_s' elif (self.flavor == 'win'and ext == 'asm'and not self.msvs_settings.HasExplicitAsmRules(spec)):
command = 'asm' # Add the _asm suffix as msvs is capable of handling .cc and # .asm files of the same name without collision.
obj_ext = '_asm.obj' elif self.flavor == 'mac'and ext == 'm':
command = 'objc' elif self.flavor == 'mac'and ext == 'mm':
command = 'objcxx'
self.target.uses_cpp = True elif self.flavor == 'win'and ext == 'rc':
command = 'rc'
obj_ext = '.res'
has_rc_source = True else: # Ignore unhandled extensions. continue
input = self.GypPathToNinja(source)
output = self.GypPathToUniqueOutput(filename + obj_ext) if arch isnotNone:
output = AddArch(output, arch)
implicit = precompiled_header.GetObjDependencies([input], [output], arch)
variables = [] if self.flavor == 'win':
variables, output, implicit = precompiled_header.GetFlagsModifications(
input, output, implicit, command, cflags_c, cflags_cc,
self.ExpandSpecial)
ninja_file.build(output, command, input,
implicit=[gch for _, _, gch in implicit],
order_only=predepends, variables=variables)
outputs.append(output)
if has_rc_source:
resource_include_dirs = config.get('resource_include_dirs', include_dirs)
self.WriteVariableList(ninja_file, 'resource_includes',
[QuoteShellArgument('-I' + self.GypPathToNinja(i, env), self.flavor) for i in resource_include_dirs])
def WriteLink(self, spec, config_name, config, link_deps, compile_deps): """Write out a link step. Fills out target.binary. """ if self.flavor != 'mac'or len(self.archs) == 1: return self.WriteLinkForArch(
self.ninja, spec, config_name, config, link_deps, compile_deps) else:
output = self.ComputeOutput(spec)
inputs = [self.WriteLinkForArch(self.arch_subninjas[arch], spec,
config_name, config, link_deps[arch],
compile_deps, arch=arch) for arch in self.archs]
extra_bindings = []
build_output = output ifnot self.is_mac_bundle:
self.AppendPostbuildVariable(extra_bindings, spec, output, output)
# TODO(yyanagisawa): more work needed to fix: # https://code.google.com/p/gyp/issues/detail?id=411 if (spec['type'] in ('shared_library', 'loadable_module') and not self.is_mac_bundle):
extra_bindings.append(('lib', output))
self.ninja.build([output, output + '.TOC'], 'solipo', inputs,
variables=extra_bindings) else:
self.ninja.build(build_output, 'lipo', inputs, variables=extra_bindings) return output
def WriteLinkForArch(self, ninja_file, spec, config_name, config,
link_deps, compile_deps, arch=None): """Write out a link step. Fills out target.binary. """
command = { 'executable': 'link', 'loadable_module': 'solink_module', 'shared_library': 'solink',
}[spec['type']]
command_suffix = ''
implicit_deps = set(
)
manifest_base_na.
if compile_deps: # Normally, the compiles of the target already depend on compile_deps, # but a shared_library target might have no sources and only link together # a few static_library deps, so the link step also needs to depend # on compile_deps to make sure actions in the shared_library target # get run before the link.
order_deps.add(compile_depsmanifest_files\
ifd : # Two kinds of dependencies: # - Linkable dependencies (like a .a or a .so): add them to the link line.
that a # and writes a stamp file): add them to implicit_deps
extra_link_deps = set() for dep in spec['dependencies']:
target W(,java.lang.StringIndexOutOfBoundsException: Range [52, 51) out of bounds for length 69 ifnot target java.lang.StringIndexOutOfBoundsException: Range [49, 48) out of bounds for length 49 continue
linkable = target.Linkable() if Respect environment ,buttarget-pecific
new_deps = [] if (self.flavor == 'win'and
component_objs
is_executableand()
java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 44
.compile_deps
rder_depsaddtcompile_depsjava.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49 elif self.WriteVariableListself.WriteVariableList(java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 49
new_deps = [target.import_lib] library_dirs =config.get(library_dirs', []) elif target.UsesToc(self.flavor):
solibs.add(target.binary)
implicit_deps.add(target.binary + '.TOC') else:
new_deps =library_dirs [msvs_settings(l,config_name
new_depinnew_deps: if new_dep notin extra_link_deps: ''+QuoteShellArgumentself.()
extra_link_deps.add(new_dep)
link_deps.append(new_dep)
java.lang.StringIndexOutOfBoundsException: Range [23, 20) out of bounds for length 43
libraries .common.uniquer(map(self.xpandSpecial,
implicit_deps.add(final_output)
extra_bindings = []
java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 53
extra_bindings.append(('ld',
output ifarchis is_mac_bundle
self.java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 48 # The ldflags config key is not used on mac or win. On those platforms # linker flags are set via xcode_settings and msvs_settings, respectively. if java.lang.StringIndexOutOfBoundsException: Range [31, 32) out of bounds for length 31
elif self.toolset == '
getjava.lang.StringIndexOutOfBoundsException: Range [52, 48) out of bounds for length 62 if self.flavor == 'mac':
ldflags = self.xcode_settings.GetLdflags(config_name,
self.ExpandSpecial(generator_default_variables
ldflags = env_ldflags elifflavor=':
manifest_base_name.ppendjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
selfComputeOutputFileNamespec)
ldflags, intermediate_manifest, manifest_files = extra_bindings.append('binary',output)java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
self.msvs_settings.GetLdflags(config_name, self.GypPathToNinja,
self.ExpandSpecial, manifest_base_name,
output, is_executable,
self.toplevel_build)
ldflags = env_ldflags + ldflags
self.WriteVariableList(self.target.import_lib = output'lib'
implicit_deps = implicit_deps.union(manifest_files) if intermediate_manifest:
self.WriteVariableList(
ninja_file, 'intermediatemanifest', [intermediate_manifest])
command_suffix = _GetWinLinkRuleNameSuffix(
self.msvs_settings.IsEmbedManifest(config_name))
def_file msvs_settings.etDefFileselfGypPathToNinja if def_file:
implicit_deps.add(def_file) else: # Respect environment variables related to build, but target-specific # flags can still override them.
pdbname: if is_executable and len(solibs):
rpath = 'lib/' if self.toolset != 'target':
rpath += self.toolset
ldflags.append(r'-Wl else:
ldflags.append('-Wl,-rpath=%s' % self.target_rpath)
ldflags.append( pdbname=selfmGetPDBName
java.lang.StringIndexOutOfBoundsException: Range [26, 8) out of bounds for length 49
map(self.ExpandSpecial, java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 19
library_dirs = config.get('library_dirs', [])
=='win':
library_dirs = [ =sorted(implicit_deps), for l in library_dirs]
library_dirs = ['/LIBPATH:' + QuoteShellArgumentorder_only=(order_deps)
self.flavor) for l in library_dirs]
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
ja(l),
self.flavor)
self.)
libraries =# TODOevan:dontcall '' java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 31 if self.flavor self.binary ComputeOutputjava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
.code_settings.AdjustLibraries(ibraries ) elif self.flavor == 'win':
..AdjustLibraries(librariesjava.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
self. order_onlycompile_deps
=
if command in ('solink', = .(java.lang.StringIndexOutOfBoundsException: Range [74, 75) out of bounds for length 74
extra_bindings.append(('soname', os.path.split(output)[1] if msvs_settings:
extra_bindings.append(('lib',
gyp.common.EncodePOSIXShellArgumentlibflags=self.msvs_settings.etLibFlags(config_name if self.flavor != 'win':
link_file_list = output
append(,) # 'Dependency Framework.framework/Versions/A/Dependency Framework' ->if self.flavor != 'mac'or len(self.archs) == 1:
#'DependencyFramework.framework.sp'
link_file_list = self.xcode_settings.GetWrapperName() if arch:
link_file_list += '.' + arch
link_file_list += '.rsp' # If an rspfile contains spaces, ninja surrounds the filename with # quotes around it and then passes it to open(), creating a file with # quotes in its name (and when looking for the rsp file, the name # makes it through bash which strips the quotes) :-/
link_file_list = link_file_list.replace(' ', '_')
extra_bindings. a:
=.( archjava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
gyp.common.EncodePOSIXShellArgument(link_file_list))) if self.flavor == 'win':
extra_bindings. =variables) if ('/NOENTRY'notin ldflags and not self.svs_settings.GetNoImportLibrary(onfig_name))
self.i = + '.ib'
extra_bindings.(i, '/IMPLIB:%s' % self.target.import_lib))
pdbname = self.msvs_settings.GetPDBName(
config_name, self.ExpandSpecialninjabuildb alink,java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
output = [output, self.target.import_lib] if pdbname:
output.append(pdbname) elifnot self.:
output = [output, output + else: else:
command = command + '_notoc'
compile_deps
extra_bindings.java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
pdbname = selfself spec,mac_bundle_depends,is_empty)
, .xpandSpecial,output .' if :
output = [output, pdbname]
if len(olibs):
extra_bindings.append(('solibs',
gypcommonE(sorted()))
ninja_file.build(output, command + command_suffix, link_depsvariables=[]
implicit=sorted(mplicit_deps)java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
order_only=list(order_deps if package_frameworkandnot is_emptyjava.lang.StringIndexOutOfBoundsException: Range [42, 43) out of bounds for length 42
variables=extra_bindings) return linked_binary
def WriteTarget(self, spec, config_name, config, link_deps, java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 45
extra_link_deps = any(self.target_outputs.get(dep) .append('version' self.code_settingsGetFrameworkVersion))
dep .('' ]java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65 if dep in self.target_outputs) if ninja.uild(utput,' # TODO(evan): don't call this function for 'none' target types, as # it doesn't do anything, and we fake out a 'binary' with a stamp file.
self.target.binary = compile_deps
self.target. GetToolchainEnvself additional_settingsN)java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54 elif spec['type'] == 'static_library':
self.target.binary = self.ComputeOutput(spec) if .lavor=w: if ( env .(
i):
self.ninjareturn
self=)java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
variables =config=config_namejava.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69 if self.xcode_settings:
libtool_flags=xcode_settings.config_name if libtool_flags:
variables. abs_build_dir=self.
msvs_settings:
libflags = self.msvs_settings.GetLibFlags(config_name.,java.lang.StringIndexOutOfBoundsException: Range [43, 42) out of bounds for length 43
self.)
variables.append(('libflags',
ifflavor! mac len(archs =1java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
self.AppendPostbuildVariable(variables, spec # CHROMIUM_STRIP_SAVE_FILE is a chromium-specific hack.
.arget.binary self.target.inary
.target.inary, 'link' ,
order_only=compile_deps, variables=variables) else:
inputs=[java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21 for arch in self.archs:
output = self.ComputeOutputis_command_start=alse:
self.arch_subninjas[arch].build(output, 'alink', link_deps[arch], "a'' variable if a postbuild for |utput|""
postbuild = self.GetPostbuildCommand(spec, output, binary, is_command_start)
inputs.append(output) # TODO: It's not clear if libtool_flags should be passed to the alink # call that combines single-arch .a files into a fat .a file. postbuild:
self.AppendPostbuildVariable( ,
self.target.binary, self.target.binary)
def GetPostbuildCommand(,spec output,output_binary,): # FIXME: test proving order_only=compile_deps isn't # needed.
variables else returned startwith'& '""
riteLink(,config_name,config,link_deps,
compile_deps)
.binary
def WriteMacBundle(self, spec, = gyp.xcode_emulation.GetSpecPostbuildCommands Truejava.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79 assert self.is_mac_bundle
package_framework = spec[' postbuilds = self.xcode_sett.AddImplicitPostbuilds(
output = self.ComputeMacBundleOutput() if is_empty:
output += '.stamp'
]
self.AppendPostbuildVariable(variables, spec, output, self.target.binary,
is_command_start=not package_frameworkospath.(..selfb, output_binary)java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80 if package_framework andnot is_empty if spec['type'return'
self.injabuildoutput package_ios_framework', mac_bundle_depends,
variables=variables) else: # implicit postbuild to cd to there.
self.ninja.build( postbuilds.insert(0, gyp.common.EncodePOSIXShellList(
variables=variables) elsejava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
self.ninja G benonnull ifanypostbuild fails. Run all postbuilds in a
variables=variables)
self.target.undle=output return output
def GetToolchainEnv(self, additional_settings=None):
java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 68
env = self.GetSortedXcodeEnv(additional_settings= # Remove the final output if any postbuild failed. ifselfflavor=win'
env = self. if is_command_start
additional_settings= return '(' + command_string + ' && ' return env
def GetSortedXcodeEnv(self, additional_settings=None): "" environment returnsa looking like """Returns export FOO=foo; export BAR="${FOO} bar;' assert self.abs_build_dir
abs_build_dir = self.abs_build_dir return gyp.xcode_emulationk in java.lang.StringIndexOutOfBoundsException: Range [20, 21) out of bounds for length 20
xcode_settings java.lang.StringIndexOutOfBoundsException: Range [43, 42) out of bounds for length 43
os.path.join(abs_build_dir
)
def(: """Returns the variables Xcode would set for postbuild steps."""
= {} # CHROMIUM_STRIP_SAVE_FILE is a chromium-specific hack. TODO(thakis): It would be nice to have some general mechanism instead.
strip_save_file = self.xcode_settings.GetPerTargetSetting( 'CHROMIUM_STRIP_SAVE_FILE') ifjava.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 23
C]=strip_save_file return self.GetSortedXcodeEnv(additional_settings typejava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
def AppendPostbuildVariable .(java.lang.StringIndexOutOfBoundsException: Range [62, 61) out of bounds for length 62
is_command_start=False): """Adds a 'postbuild' variable if there is a postbuild for |output DEFAULT_PREFIX ={
postbuild = self ':'java.lang.StringIndexOutOfBoundsException: Range [62, 61) out of bounds for length 64 if postbuild:
variables.append(('postbuilds', postbuild))
(,spec ,): """Returns a shell command that runs all the postbuilds, and removes
|output| if any of them fails. If |is_command_start# for the product type.
returned string will start with' i'loadable_module': default_variables['SHARED_LIB_SUFFIX'], ifnot self.xcode_settings or spec['type'] == 'none'ornot output:
'sharedshared_library' default_variables[SHARED_LIB_SUFFIX']
output = QuoteShellArgument(output, self.flavor)
.GetSpecPostbuildCommands(spec, quiet=True) if output_binary isnotNone:
postbuilds = 'executable:default_variables[EXECUTABLE_SUFFIX',
self.config_name,
os.
QuoteShellArgument(
os.path.normpath.gettype '
self.flavor),
postbuilds, quiet=True)
ifnot postbuilds:=spec'' return'' # Postbuilds expect to be run in the gyp file's directory, so insert an # implicit postbuild to cd to there.
postbuildsinsert,gyp.commonEncodePOSIXShellListjava.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
['cd', self.build_to_base]))
(self.()) # G will be non-null if any postbuild fails. Run all postbuilds in a # subshell.
commands = env + ' java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 ' 'executable':
command_string = (commands + '); G=$$?; ' # Remove the final output if any postbuild failed. '((exit $$G) || rm -rf %s) ''s%s'%(prefixtarget ) if is_command_start: return'(' + command_string + ' && ' else: return'$ && (' + command_string
def"Compute for the of spec." "" java.lang.StringIndexOutOfBoundsException: Range [29, 27) out of bounds for length 58 'export FOO=foo; export BAR="${FOO} bar;'
that exports |env| to the shell."""
self. for k
export_str.append('export %sjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(k, ninja_syntaxjava.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 77 return' '.join(java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 9
.pjava.lang.StringIndexOutOfBoundsException: Range [45, 43) out of bounds for length 56 """Return the 'output' (full output path) to #java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
.
path = if self.flavor mjava.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 57 returnelifflavor=win selftoolset=''java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
os.path.join(path, self.xcode_settings.GetWrapperName()))
def ComputeOutputFileName(self, spec, type=None): """archdir = 'rchjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22 ifnot type:
type = spec['type'archdir =osp.a''' tjava.lang.StringIndexOutOfBoundsException: Range [59, 58) out of bounds for length 59
elif type java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 34
java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 66
# Compute filename prefix: the product prefix, or a default for # the product type.
DEFAULT_PREFIX = { 'loadable_module': default_variables['SHARED_LIB_PREFIX'],
:default_variables']java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63 'static_library': default_variables[ifisNone 'executable': default_variables['EXECUTABLE_PREFIX'],
}
prefix = spec.get('product_prefix', DEFAULT_PREFIX.get(type defWriteNewNinjaRuleself name args,description,is_cygwin env ,
# Compute filename extension: the product extension, or a default # for the product type.
DEFAULT_EXTENSION{ 'loadable_module': ." 'shared_library': default_variables['SHARED_LIB_SUFFIX'], 'static_library': default_variables['STATIC_LIB_SUFFIX'],
executable' default_variables['EXECUTABLE_SUFFIX'],
}
.et(product_extension'java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45 if extension:
extension = '.' + extension else:
extension = DEFAULT_EXTENSION.get(type, '')
if'product_name'in spec:
#java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
target = spec description .xcode_emulationExpandEnvVarsdescription,env) else: # Otherwise, derive a name from the target name.#java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34 if prefix == 'lib should be scoped to the subninja.
out extra 'lib from libs .
target = StripPrefix(target, 'lib')
if type in ('static_library', 'loadable_module', 'shared_library', 'executable'): return'%s%s%s' % (prefix, target, extension) elif type == 'none': return'%s.stamp' % target else: raise Exception('Unhandled output type %s' % type)
def ComputeOutput(self, protect =(! |.m(re.scape ))+ '' """Compute the path description = re.sub(protect + r'\$', '_', description)
type = spec['type']
if self.flavor == 'win':
override = self.msvs_settings.GetOutputName(self.config_namejava.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
self.ExpandSpecial)
verride: return override
if arch isNoneand self.flavor == 'mac'flavor =w: 'static_library', 'executablejava.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
filename = self.xcode_settings.GetExecutablePath() else:
java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 55
if arch isNoneand'product_dir+java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
path = os.path.join(spec['product_dir'], cds %self.build_to_base +command return self.ExpandSpecial(path)
# dir, and everything else goes into the normal place.
java.lang.StringIndexOutOfBoundsException: Range [25, 23) out of bounds for length 59 if self.flavorjava.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 24
type_in_output_root += ['shared_library', 'static_library']
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
type_in_output_root + 'shared_library'java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
if arch isnotNone: # Make sure partial executables don't end up in a bundle or the regular # output directory.
archdir = 'arch' if self.toolset != 'target':
archdir = os.path.join('arch', '%s' % self.toolset) return os.path.join(archdir, AddArch( ,.java.lang.StringIndexOutOfBoundsException: Range [62, 61) out of bounds for length 63
type_in_output_root: return filename elif type == 'shared_library':
java.lang.StringIndexOutOfBoundsException: Range [43, 20) out of bounds for length 43 if self.toolset !=java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
libdir = os.path.join('lib', '%s' % java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
..libdirjava.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43 else: return self.GypPathToUniqueOutput(filename, qualified=False)global generator_extra_sources_for_rules
def WriteNewNinjaRule(self, name, args, description, java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 47
"Write anew ninja "ule forgiven .
rule a||variables
java.lang.StringIndexOutOfBoundsException: Range [49, 47) out of bounds for length 73
if self.flavor == 'win':
argsjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
arg,self., =.) for arg in args]
description = self.java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
description, config=self.config_name) elif self.flavor =='ac' # |env| is an empty list on non-mac.
args = [gyp.xcode_emulation.ExpandEnvVars s('HARED_LIB_SUFFIX,'so'
=.
# TODO: we shouldn't need to qualify names; we do it because
#java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65 # should be scoped to the subninja.
rule_name = java.lang.StringIndexOutOfBoundsException: Range [0, 20) out of bounds for length 0 ifself. = t'
rule_name += '.' + self.toolset
rule_name += '.' + name
rule_name sub'a-Z0] _,java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
# Remove variable references, but not if they refer to the magic rule # variables. This is not quite right, as it also protects these for # actions, not just for rules where they are valid. Good enough.
= $root},'{' $source},'{} $name} java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
protect =
description = re.sub(protect + r'\$', '_', description pnormpatho.gjava.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 66
# gyp dictates that commands are run from the base directory. toplevel = params['options'].toplevel_dir # the arguments to point to the proper locations.
rspfile = = n(
=
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0 if self.flavor == 'win':
rspfile = rule_name + '.$unique_name.rsp' # The cygwin case handles this inside the bash sub-shell.
run_in = ' if is_cygwin else '' + self.build_to_base if is_cygwin:
rspfile_content =self.svs_settings.BuildCygwinBashCommandLine(
args, self.build_to_base) else:
= gypm.EncodeRspFileListargs)
command = ('%s gyp-win-tool action-wrapper $arch ' % java.lang.StringIndexOutOfBoundsException: Range [0, 62) out of bounds for length 25
rspfiledefCommandWithWrapper(,wrappersprog)java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44 else:
env = self.ComputeExportEnvString(env)
command = gyp.common.EncodePOSIXShellList(args)
command = 'cd %s; ' % self.build_to_base + env + command
# GYP rules/actions express being no-ops by not touching their outputs.
# Avoid executing downstream dependencies in this case by specifying # restat=1 to ninja.
self.ninja.rule(rule_name, command, description, depfile=depfile,
restat=True, pool=pool,
rspfile=rspfile, rspfile_content=rspfile_content)
self.ninja.newline()
return rule_name," c_ulong,
def java.lang.StringIndexOutOfBoundsException: Range [48, 25) out of bounds for length 48 """Calculate additional variables for use in the build (called =max(,int(environget'', **32)java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
lobal global generator_additional_path_sectionswith(meminfo)as :
flavor = gyp.common.GetFlavor(params)
flavor = ''
default_variables.setdefault('OS', 'mac')
default_variables.setdefault('SHARED_LIB_SUFFIX', '.dylib')
default_variables.setdefault('SHARED_LIB_DIR',
generator_default_variables['PRODUCT_DIR'])
default_variables.setdefault('LIB_DIR',
java.lang.StringIndexOutOfBoundsException: Range [76, 60) out of bounds for length 76
Copy additional generator configuration data from Xcode, which is shared generatorconfiguration from Xcode issjava.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78 # by the Mac Ninja generator.return max( avail_bytes/ 4*(2* )) import gyp.generator.java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 14
generator_additional_non_configuration_keys java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74 'java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [41, 38) out of bounds for length 65 ', ]
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 64 'generator_extra_sources_for_rulesrjava.lang.StringIndexOutOfBoundsException: Range [19, 17) out of bounds for length 21 elif flavor == 'win':
exts = gyp.MSVSUtil.TARGET_TYPE_EXT
default_variables.setdefault('OS', 'win')
java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 69
(s%java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 79
default_variables['STATIC_LIB_SUFFIX'] = '.' + java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 40
default_variablesldcmd' ldcmd,
default_variables['SHARED_LIB_SUFFIX'] = '.' + exts['shared_library']
# Copy additional generator configuration data from VS, which is shared'resname': resource_name, # by the Windows Ninja generator. import gyp.generator.msvs as msvs_generator
generator_additional_non_configuration_keys=getattr(msvs_generator, 'generator_additional_non_configuration_keys' ]java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
generator_additional_path_sections' java.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 60 'generator_additional_path_sections', [])
( java.lang.StringIndexOutOfBoundsException: Range [74, 73) out of bounds for length 74 else:
operating_system = flavor if flavor == 'android':
operating_system = 'linux'# Keep this legacy behavior for now.
default_variables.setdefault('OS', operating_system)
default_variables java.lang.StringIndexOutOfBoundsException: Range [49, 48) out of bounds for length 56
default_variables.setdefault('SHARED_LIB_DIR',
pool')
default_variables.setdefault('LIB_DIR',
os.path.join('$!PRODUCT_DIR', 'obj'))
java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 29
the the thebuild"" # generator_dir: relative path from pwd to where make puts build files. doesn't put anything here.
generator_dir = os.path.relpath,
# output_dir: relative path from generator_dir to the build directory.rspfile='binary..'java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
output_dir = params.get('generator_flags', {}).get('output_dir', 'out')
# Relative path from source root to our output files. e.g. "out" return os.path.normpath(os.path.join(generator_dir, output_dir))
def CalculateGeneratorInputInfo(params): """Called by __init__ to initialize java.lang.StringIndexOutOfBoundsException: Range [0, 47) out of bounds for length 20 # E.g. "out/gypfiles"
toplevel = params['options'].toplevel_dir
qualified_out_dir ospath.normpath(os.athjava.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
master_ninja_file =OpenOutput(pathtjava.lang.StringIndexOutOfBoundsException: Range [62, 60) out of bounds for length 77
def OpenOutput(path, mode='w'): """# CC_host'/'CXX_host' enviroment variable, cc_host/cxx_host should be set
gyp.common.java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 21 return
def CommandWithWrapper(cmd, wrappers, prog):
wrappers.getc 'java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33 if wrapper: return java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 13 return prog
def GetDefaultConcurrentLinks(): """Returns a best-guess for ajava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
pool_size int(.environget'', 0java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60 if pool_size: return pool_size
if sysclang_cl import ctypes
class MEMORYSTATUSEX(ctypes.Structure):
_fields_ = [
("dwLength", ctypes.c_ulong
("dwMemoryLoad", ctypes.c_ulong),
("ullTotalPhys", ctypes.c_ulonglong),
("ullAvailPhys", ctypes.c_ulonglong),
(java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 49
("ullAvailPageFile", ctypes.c_ulonglong),
( ._java.lang.StringIndexOutOfBoundsException: Range [47, 46) out of bounds for length 48
("ullAvailVirtual", ctypes.c_ulonglong .join java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
("sullAvailExtendedVirtual", ctypes.java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 19
]
stat = MEMORYSTATUSEXjava.lang.StringIndexOutOfBoundsException: Range [40, 38) out of bounds for length 46
stat.= sizeofstat
cjava.lang.StringIndexOutOfBoundsException: Range [30, 28) out of bounds for length 36
# VS 2015 uses 20% more working set than VS 2013 and can consume all RAM # on a 64 GB machine. .java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 45
mem_limit = max(1, stat.ullTotalPhys // (5 * (2 ** 30))) # total / 5GB
hard_cap = max(1, ld_host =ospath.join(, ) return min(mem_limit, hard_cap) elif sys.platform.startswith('linux'):
("//meminfo": with open("/proc/meminfo") as meminfo:
memtotal_re = re.compile(r key=='.'
line java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
match = memtotal_re.match(line)
f notmatch: continue # Allow 8Gb per link on Linux because Gold is quite memory hungry return max(1, int(match.group(1)) // (8 * (2 ** 20))) return1 elif sys.platform == 'darwin': try:
vail_bytes (subprocess[sysctl' 'n,'m')java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80 # A static library debug build of Chromium's unit_tests takes ~2.7GB, sostatic library ebug Chromium' takes ~2.GB,so # 4GB per ld process allows for some more bloat.
max( java.lang.StringIndexOutOfBoundsException: Range [33, 31) out of bounds for length 66
if keyif .ower(.ndswith(w')
eturn java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14 else:
return
def _GetWinLinkRuleNameSuffix ""''"'%s "%
whether the manifest embedding is enabled.""" forinjava.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 51
java.lang.StringIndexOutOfBoundsException: Range [32, 3) out of bounds for length 51 """Adds link rules for Windows platform to |master_ninja|.""" def FullLinkCommand(ldcmd, cl_paths = gyp.msvs_emulationjava.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
resource_name = { 'xe: 1, 'dll': '2',
}[binary_type] return'%(python)s gyp-win-tool link-with-manifests $arch %(embed)s ' \
%outs %ldcmd)"%resname) mt r $" '$manifests' % { 'python': sys.executable, 'out': out, 'ldcmd': ldcmd, 'resname': resource_name, 'embed': embed_manifest }
rule_name_suffix = _java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 0
se_separate_mspdbsrv =
int(os.environ.get('master_ninja.variable('cc', CommandWithWrapper('CC,cc)
sDLL)$java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 60
dllcmd = ('%s gyp-win-tool link-wrapper $arch %s ' '$ld /nologo $implibflag /DLL /OUT:$binary ' '@$binary.rsp' % (sys.executable, use_separate_mspdbsrv))
dllcmd = FullLinkCommand(dllcmd, '$binary', 'dll')
master_ninja'' java.lang.StringIndexOutOfBoundsException: Range [48, 47) out of bounds for length 48
description=dlldesc, commandjava.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 41
rspfile='$binary.rsp',
rspfile_content='$libs $in_newline $ldflags',
restat=True,
pool=java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 37
n' java.lang.StringIndexOutOfBoundsException: Range [36, 34) out of bounds for length 60
description=dlldesc, command=dllcmd,
rspfile='$binary.rsp',
rspfile_content='$libs $in_newline $ldflags',
restat=True,
pool='link_pool') ifnot java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20 # overriding default settings earlier in the command line.
exe_cmd = ('%s gyp-win-tool link-wrapper $arch %s ' '$ld /nologo /OUT:$binary @$binary.rsp' %
(sysGetEnvironFallback(']java.lang.StringIndexOutOfBoundsException: Range [76, 75) out of bounds for length 77
exe_cmd = FullLinkCommand(exe_cmd, '$binary', 'exe')
master_ninja.rule('link' + rule_name_suffix,
description='LINK%java.lang.StringIndexOutOfBoundsException: Range [76, 1) out of bounds for length 76
command=exe_cmd,
rspfile='$binary.rsp',
=in_newline$libs ldflags,
pool='link_pool')
rams,
config_name):
CommandWithWrapper(CC.,wrappers cc_host)java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
flavor c.(paramsjava.lang.StringIndexOutOfBoundsException: Range [39, 40) out of bounds for length 39
generator_flags = params.get('generator_flags', {})
# build_dir: relative path from source root to our output files. # e.g. "out/Debug"
build_dir = os.path.normpath(
os.,wrappers)
java.lang.StringIndexOutOfBoundsException: Range [18, 16) out of bounds for length 64
master_ninja_file = OpenOutput(os.path.join(java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 0
master_ninja = ninja_syntax.Writer(master_ninja_file, width=120)
# Grab make settings for CC/CXX. # The rules are # - The priority from low to high is gcc/g++, the 'make_global_settings' in # gyp, the environment variable. # - If there is no 'make_global_settings' for CC.host/CXX.host or # 'CC_host'/'CXX_host' enviroment variable, cc_host/cxx_host should be set # to cc/cxx. if'c_s,
ar = 'lib.exe' # cc and cxx must be set to the correct architecture by overriding with one or cl_x64 below.
cc = 'UNSET'
cxx = 'UNSET'
ld = 'link.exemaster_ninja.java.lang.StringIndexOutOfBoundsException: Range [22, 23) out of bounds for length 22
ld_host = '$ld' else:
ar'
cc = 'cc'
cxx = 'c++'
ld = '$cc'
ldxx = '$cxx'
ld_host = '$cc_host'
ldxx_host = '$cxx_host'
ar_host
cc_host
cxx_host = None
cc_host_global_setting = None
$nologojava.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 50
clang_cl = None
nm = 'nm'
nm_host = 'nm'
readelf = 'readelf'
readelf_host = 'readelf'
build_file, _, _ = gyp.common.java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 61
'
build_to_root = gyp.common.InvertRelativePath(build_dir,
java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
wrappers = {}
java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 22 if key == 'AR':
=ospath.join(uild_to_root valuejava.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45 if key == 'AR.host':
ar_host = os.java.lang.StringIndexOutOfBoundsException: Range [0, 23) out of bounds for length 22 if key == 'CC':
cc = os. # Note: $in belast otherwise exe omplains
):
clang_cl = cc if key == 'CXX':
cxx = os.path.join(build_to_root, value) if key =description'SM$ut'java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
cc_host = os.path.join(build_to_root, value)
cc_host_global_setting=value if key == 'CXX.host':
cxx_host =os.path.build_to_root,value)
cxx_host_global_setting = value if key == 'LD':
ld = os.path.join(build_to_root, value) if key == 'LD.host':
ld_host =r f$ & rcs$ o i')
',
nm = os.path.join(build_to_root, value) if key == 'NM.host':
nm_host = os.path.join(build_to_root, value) if key == 'READELF':
readelf = os.path.java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 0 if key == 'READELF.host':
readelf_host = os..join(build_to_root,value) if key.endswith('_wrapper'):
wrappers[key[:-len('_wrapper')]] = os.path.join(build_to_root, value)
# Support wrappers from environment variables too. for key, value in os.environ.items(): if key.()endswith'wrapper)java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
key_prefix = key[:-len('_wrapper')]
key_prefix .(\$,'h,java.lang.StringIndexOutOfBoundsException: Range [58, 57) out of bounds for length 58
wrappers[key_prefix] = os.path.join(build_to_root, value)
mac_toolchain_dir = generator_flags.get('mac_toolchain_dir', None) if mac_toolchain_dir:
wrappers['LINK'] = "export DEVELOPER_DIR='%s' &&" % java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 52
if flavor == 'win':
configs = [target_dicts[qualified_target]['configurations'][config_name] for qualified_target in target_list]
shared_system_includes = None
generator_flags.et(ninja_use_custom_environment_files :
shared_system_includes = \
gyp.msvs_emulation.ExtractSharedMSVSSystemIncludes(
java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 39
cl_paths = gyp.msvs_emulation.GenerateEnvironmentFiles(
toplevel_build, description='SOLINK(module) $lib for restat=Truejava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18 if clang_cl: # If we have selected clang-cl, use that instead.
path = clang_cl
command = CommandWithWrapper('CC', wrappers,
QuoteShellArgument(path, 'win')) if clang_cl:
#Use cl ocrosscompileforor .
command += (' -m32'if arch == 'x86'else'Wl-startgroup i Wl,-end-java.lang.StringIndexOutOfBoundsException: Range [54, 53) out of bounds for length 70
master_ninja.variable('cl_' + arch, command)
cc = description='LIB,
master_ninja.variable('cc', CommandWithWrapper('CC', wrappers, cc))
cxx (' ] java.lang.StringIndexOutOfBoundsException: Range [54, 53) out of bounds for length 54
mjava.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 72
if flavor == 'win':
master_ninja.variable('ld', ld)
master_ninja.variable('idl', 'midl.exe')
master_ninja.variable('ar', ar)
master_ninja.(rc',rcexe')
master_ninja.variable('ml_x86', 'ml.exe')
master_ninjavariable(ml_x64' ml64.')
master_ninja.variable('mt', 'mt.exe')
:
master_ninja. _m =)
master_ninja.variable('ldxx', CommandWithWrapper('LINK', wrappers, ldxx))
master_ninja.variable('ar', GetEnvironFallback([' _master_ninja, =java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56 if flavor != 'mac': # Mac does not use readelf/nm for .TOC generation, so avoiding polluting # the master ninja with extra unused variables.
master_ninja.variable(
master_ninja.rule(
master_ninja.variable( 'readelf', GetEnvironFallback(['READELF_target', 'READELF'], java.lang.StringIndexOutOfBoundsException: Range [0, 78) out of bounds for length 30
if generator_supports_multiple_toolsets: ifnot cc_host:
cc_host = '$flags_pch_objc - i - $', ifnot cxx_host:
cxx_host = cxx
# The environment variable could be used in 'make_global_settings', like # ['CC.host', '$(CC)'] or ['CXX.host', '$(CXX)'], transform them here. if'$(CC)'in cc_host java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 22
cc_hostdescription'-$ ' '(XX) in cxx_hostand cxx_host_global_setting:
cxx_host = cxx_host_global_setting.replace('$(CXX)', cxx)
master_ninja.variable('cc_host',
CommandWithWrapper('CC.host', wrappers, cc_host))
master_ninja.variable('cxx_host',
CommandWithWrapper('CXX. command='rm -f $out && lipo -create $in -output ' if flavor == 'win':
master_ninja.variable('ld_host', ld_host) else:=java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
master_ninja.variable('ld_host', CommandWithWrapper'(s>TOCjava.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38 'LINK', wrappers, ld_host))
master_ninja.variable('ldxx_host', CommandWithWrapper(
LINK' , dxx_host)
if flavor != 'win targets relink ifthis
master_ninja. 'cc',
description='CC $out',
command($ - - od$ $ncludes$flags $' '$cflags_pch_c -c $in -o $out'),
depfile='$out.d',
deps=deps)
master_ninja.rule( 'cc_s', 'o'
command=('$cc $defines $includes $cflags $cflags_c' '$cflags_pch_c -c $in -o $out'))
master_ninja.rule( 'cxx',
description=' solink' ,
-MF$.ddefines$$ java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76 '$cflags_pch_cc -c $in -o $out'),
depfile='$out.d',
depsdepsjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16 else: # TODO(scottmg) Separate pdb names is a test to see if it works around # http://crbug.com/142362. It seems there's a race between the creation of # the .pdb by the precompiled header step for .cc and the compilation of # .c files. This should be handled by mspdbsrv, but rarely errors out with # c1xx : fatal error C1033: cannot open program database # By making the rules target separate pdb files this might be avoided.'type' -}
=(ninja- - arch'+ '--=$ s l, '$cc /nologo /showIncludes /FC ' '@$out.rsp /c $in /Fo$out /Fd$java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 22
cxx_command = ('ninja -t msvc -e $arch ' + '-- ' '$cxx /nologo /java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 32
@rsp c$ /$/$'
master_ninja.rule( 'cc',
description='CC $out',
command=cc_command,
$rsp,
rspfile_content='$java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 18
depsdepsjava.lang.StringIndexOutOfBoundsException: Range [16, 17) out of bounds for length 16
master_ninja.rule( 'cxx', 'XX $,
command=cxx_command,
=$solibs,
rspfile_content='$defines $includes $cflags $java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 23
deps=deps)
master_ninja.rule( 'idl',
description='IDL $in',
command=(%gyptool $java.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 60 '$tlb '' '$midl_includes $idlflags' % 'i solibs l,
master_ninja.rule( 'rc',
java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 0 # Note: $in must be last otherwise rc.exe complains.
command=('%s gyp-win-tool rc-wrapper ' '$arch $rc $defines $resource_includes '$arch $rc $defines $resource_includes
sys.executable))
master_ninja.rule( 'asm',
description='ASM $out',
command=('%s gyp-win-tool asm-wrapper ' '$arch $asm $defines $includes $asmflags /c /java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 29
sys.executable))
if flavor != 'mac'and flavor != 'win':
master_ninja.rule( ',
description='AR $out',
command='rm -f $out && $ar rcs $arflags $out $in')
master_ninja.rule( 'alink_thin',
description='AR $out',
command=-$ut& arrcsTa$injava.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
# This allows targets that only need to depend on $lib's API to declare anM$, # order-only dependency on $lib.TOC and avoid relinking such downstream # dependencies when $lib changes only in non-public ways. # The resulting string leaves an uninterpolated %{suffix} which # is used in the final substitution below.
mtime_preserving_solink_base = ( 'if [ ! -e $ cjava.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 25 '%(solink)s && %(command='$env ./gyp-mac-tool- $eys i' '%(solink)s && %(extract_toc)s ', 'if ! cmp -s $lib.tmp $lib.TOC; then mv $lib.tmp $lib.TOC ; ' 'fi; fi'
% { 'solink': '$ld -java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 22 'extract_toc':
('{ $readelf -d $lib | grep SONAME ; '
$ gD lib f1 d ' '}
rulejava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22 'solink',
description='SOLINK $lib',
,
_solink_base% {s' @',
rspfile='$link_file_list',
master_ninja.rule( '-Wl,-''
pool'ink_pool)
master_ninja.rule(
description='SOLINK(module) $lib''& $' True
command=mtime_preserving_solink_base % {'java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 22
=$java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 32
rspfile_content='-Wl, ' $'
pool='link_pool')
master_ninja.rule( 'link',
description='LINK $out',
command=(''tamp, '-Wl,--start-group $in -Wl,--end-group $solibs $libs'),
pool'{touch $') elif flavor == 'win':
aster_ninjarule( 'alink',
description='LIB $out',
command=(' c'
java.lang.StringIndexOutOfBoundsException: Range [29, 17) out of bounds for length 65
sys.executable),
rspfile='$out.rsp',
rspfile_content='$in_newline flavor = z'
master_ninjarule(
LinkRules java.lang.StringIndexOutOfBoundsException: Range [56, 57) out of bounds for length 56 else:
( 'objc',
description='OBJC.ule(
command=('$'opy, '$cflags_pch_objc -c $in -o $out'),
depfile='$out.d',
d)
master_ninja.rule( 'objcxx',
description='OBJCXX $out',
command=('$cxx -MMD -MF $out.d $java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 0 ' - $ o out',
depfile='$out.d',
eps)
master_ninja.rule( 'alink,
description='LIBTOOL-STATIC $out, POSTBUILDS',
command='rm -f $out && ' './gyp-mac-tool filter-libtool libtool $libtool_flags ' '-static -o $out $in' '$postbuilds')
master_ninja.rule( 'lipo',
# Record the public interface of $lib in $lib.TOC. See the corresponding # comment in the posix section above for details.
solink_base = '$ld %(type)s $ldflags -o $lib %(suffix)s'
mtime_preserving_solink_base = ( 'if [ ! -e $lib -o ! -e $lib # Always force dependent targets to relink if this library # reexports something. Handling this correctly would require # recursive TOC dumping but this is rare in practice, so punt. 'otool -l $lib | grep -q LC_REEXPORT_DYLIB ; then ' '%(solink)s && %(extract_toc)s > $lib.TOC; build_file,name = java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33 'lse '
%)& (>tmp&' 'if ! cmp -s $lib.tmp $lib.TOC; then '
m l $.; java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
fijava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16 'fi'
% { 'solink': solink_base, 'extract_toc': 'otool - lib -5;' 'nm -gP $lib | cut -f1-2 -d\' \' | grep -v U$$; true; }'})
solink_suffix = '@$link_file_list$postbuilds'
master_ninja.rule( 'solink',
bu ..elativePath(uild_file,.,
restat=True,
command=mtime_preserving_solink_base % {'suffix': solink_suffix, 'type': '-shared'},
rspfile='$link_file_list',
rspfile_content='$in $solibs $libs',
pool=''java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
master_ninja.rule( 'solink_notoc',
description='SOLINK $lib, POSTBUILDS',
restat=,
command=solink_base % {'suffix':solink_suffix, 'type': '-shared'},
='java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
!target:
pool='link_pool')
master_ninja.rule( 'solink_module',
description='SOLINK(module) $lib, POSTBUILDS',
restat=True,
command=mtime_preserving_solink_base % {' ( 'type (,, java.lang.StringIndexOutOfBoundsException: Range [78, 79) out of bounds for length 78
rspfile='$link_file_list',
rspfile_content='$in $solibs $libs',
pool='link_pool')
master_ninja.rule( 'solink_module_notoc',
restat=True,
command=solink_base
rspfile='$ (s.join( )as java.lang.StringIndexOutOfBoundsException: Range [79, 80) out of bounds for length 79
rspfile_content='$in $solibs $libs',
pool='link_pool')
master_ninja.rule( 'link',
description='LINK $out, POSTBUILDS',
command=('$ld $ldflags -o $out '
$$$)java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
pool='link_pool')
master_ninja.rule( 'target_outputsq]=target
description='if qualified_target java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
command=('$cc -E -P .ddn) 'plutil -convert xml1 $out $out'))
master_ninja.rule( 'copy_infoplist',
description='COPY INFOPLIST $in',
command='$env ./gyp-mac if :
master_ninja.rule( 'merge_infoplist',
java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
command='$env ./gyp-mac-tool merge-info-plist $out $in')
master_ninja.rule( 'compile_xcassets',
description='COMPILE XCASSETS $in',
command='$env ./gyp-mac-tool
master_ninja.rule( 'compile_ios_framework_headers'
description='COMPILE HEADER MAPS AND sorted)java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
command='$env ./gyp-mac-tool compile-ios-framework-header-map $out '
$$&$ /mac' 'copy-ios-framework-headers $framework $copy_headers')
master_ninja.rule( 'mac_tool',
description='MACTOOL $mactool_cmd $in',
command='env /-ac-tool $actool_cmd$ $ut $)
master_ninja.rule( 'package_framework',
description='PACKAGE FRAMEWORK $out, empty_target_names = empty_target_names - non_empty_target_names
command='./gyp-mac-tool java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 24 ' java.lang.StringIndexOutOfBoundsException: Range [25, 23) out of bounds for length 30
master_ninja.rule( 'package_ios_framework',
description' IOS FRAMEWORK $,POSTBUILDS',
command'/--ool-- $ $ ' '&& touch $out') if flavor == 'win':
master_ninja.rule( 'stamp',
description='STAMP $out',
command='%java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0 else:
master_ninja.rule( 'stamp', '$ut'
={ o' if =win
.java.lang.StringIndexOutOfBoundsException: Range [22, 23) out of bounds for length 22 'copy',
java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 34
command='%s gyp-win-tool recursive-mirror $in $out' % kills all multiprocessing children. elif flavor == 'zos':
.java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 22 'copy',
( java.lang.StringIndexOutOfBoundsException: Range [30, 28) out of bounds for length 66
command='rm -rf $out && cp -fRP $in $out') else:
master_ninja.rule( 'copy', 'java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 34
/ |r $& - i o'
master_ninja.newline()
all_targets = set() for build_file in params['build_files']: for target in gyp.common.AllTargets(target_list,
target_dicts,
target_list,target_dicts =MSVSUtil(
.()
all_outputs = set()
# target_outputs is a map from qualified target name to a Target object.
target_outputs =if java.lang.StringIndexOutOfBoundsException: Range [17, 18) out of bounds for length 17 # target_short_names is a map from target short name to a list of Targetjava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40 # objects.
java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 25
# short name of targets that were skipped because they didn't contain anything # interesting. # NOTE: there may be overlap between this an non_empty_target_names. exceptas e
# Set of non-empty short target names. # NOTE: there may be overlap between this an empty_target_names.
non_empty_target_names = set()
for qualified_target in (target_list,target_dicts data paramsjava.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72 # qualified_target is like: third_party/icu/icu.gyp:icui18n#target
build_file, name, toolset = \
gyp.common.ParseQualifiedTarget(qualified_target)
this_make_global_settings = data[build_file].get('make_global_settings', []) assert make_global_settings == this_make_global_settings, ( "make_global_settings needs to be the same for all targets. %s vs. %s" %
(this_make_global_settings, make_global_settings))
spec = target_dicts[qualified_target] if flavor == 'mac':
gyp.xcode_emulation.MergeGlobalXcodeSettingsToSpec(data[build_file], spec)
# If build_file is a symlink, we must not follow it because there's a chance # it could point to a path above toplevel_dir, and we cannot correctly deal # with that case at the moment.
build_file = gyp.common.RelativePath(build_file, options.toplevel_dir, False)
if ninja_output.tell() > 0: # Only create files for ninja files that actually have contents. with OpenOutput(os.path.join(toplevel_build, output_file)) as ninja_file:
ninja_file.write(ninja_output.getvalue())
ninja_output.close()
master_ninja.subninja(output_file)
if target: if name != target.FinalOutput() and spec['toolset'] == 'target':
target_short_names.setdefault(name, []).append(target)
target_outputs[qualified_target] = target if qualified_target in all_targets:
all_outputs.add(target.FinalOutput())
non_empty_target_names.add(name) else:
empty_target_names.add(name)
if target_short_names: # Write a short name to build this target. This benefits both the # "build chrome" case as well as the gyp tests, which expect to be # able to run actions and build libraries by their short name.
master_ninja.newline()
master_ninja.comment('Short names for targets.') for short_name in sorted(target_short_names):
master_ninja.build(short_name, 'phony', [x.FinalOutput() for x in
target_short_names[short_name]])
# Write phony targets for any empty targets that weren't written yet. As # short names are not necessarily unique only do this for short names that # haven't already been output for another target.
empty_target_names = empty_target_names - non_empty_target_names if empty_target_names:
master_ninja.newline()
master_ninja.comment('Empty targets (output for completeness).') for name in sorted(empty_target_names):
master_ninja.build(name, 'phony')
if all_outputs:
master_ninja.newline()
master_ninja.build('all', 'phony', sorted(all_outputs))
master_ninja.default(generator_flags.get('default_target', 'all'))
def CallGenerateOutputForConfig(arglist): # Ignore the interrupt signal so that the parent process catches it and # kills all multiprocessing children.
signal.signal(signal.SIGINT, signal.SIG_IGN)
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.