__init__.py (scons-4.2.0) | : | __init__.py (SCons-4.3.0) | ||
---|---|---|---|---|
skipping to change at line 185 | skipping to change at line 185 | |||
env["NINJA_DISABLE_AUTO_RUN"] = env.get("NINJA_DISABLE_AUTO_RUN", GetOption( 'disable_execute_ninja')) | env["NINJA_DISABLE_AUTO_RUN"] = env.get("NINJA_DISABLE_AUTO_RUN", GetOption( 'disable_execute_ninja')) | |||
env["NINJA_FILE_NAME"] = env.get("NINJA_FILE_NAME", "build.ninja") | env["NINJA_FILE_NAME"] = env.get("NINJA_FILE_NAME", "build.ninja") | |||
# Add the Ninja builder. | # Add the Ninja builder. | |||
always_exec_ninja_action = AlwaysExecAction(ninja_builder, {}) | always_exec_ninja_action = AlwaysExecAction(ninja_builder, {}) | |||
ninja_builder_obj = SCons.Builder.Builder(action=always_exec_ninja_action, | ninja_builder_obj = SCons.Builder.Builder(action=always_exec_ninja_action, | |||
emitter=ninja_emitter) | emitter=ninja_emitter) | |||
env.Append(BUILDERS={"Ninja": ninja_builder_obj}) | env.Append(BUILDERS={"Ninja": ninja_builder_obj}) | |||
env["NINJA_ALIAS_NAME"] = env.get("NINJA_ALIAS_NAME", "generate-ninja") | env["NINJA_ALIAS_NAME"] = env.get("NINJA_ALIAS_NAME", "generate-ninja") | |||
env['NINJA_DIR'] = env.get("NINJA_DIR", env.Dir(".ninja").path) | env['NINJA_DIR'] = env.Dir(env.get("NINJA_DIR", '#/.ninja')) | |||
# here we allow multiple environments to construct rules and builds | # here we allow multiple environments to construct rules and builds | |||
# into the same ninja file | # into the same ninja file | |||
if NINJA_STATE is None: | if NINJA_STATE is None: | |||
ninja_file = env.Ninja() | ninja_file = env.Ninja() | |||
env['NINJA_FILE'] = ninja_file[0] | ||||
env.AlwaysBuild(ninja_file) | env.AlwaysBuild(ninja_file) | |||
env.Alias("$NINJA_ALIAS_NAME", ninja_file) | env.Alias("$NINJA_ALIAS_NAME", ninja_file) | |||
else: | else: | |||
if str(NINJA_STATE.ninja_file) != env["NINJA_FILE_NAME"]: | if str(NINJA_STATE.ninja_file) != env["NINJA_FILE_NAME"]: | |||
SCons.Warnings.SConsWarning("Generating multiple ninja files not sup ported, set ninja file name before tool initialization.") | SCons.Warnings.SConsWarning("Generating multiple ninja files not sup ported, set ninja file name before tool initialization.") | |||
ninja_file = [NINJA_STATE.ninja_file] | ninja_file = [NINJA_STATE.ninja_file] | |||
def ninja_generate_deps(env): | def ninja_generate_deps(env): | |||
"""Return a list of SConscripts | """Return a list of SConscripts | |||
TODO: Should we also include files loaded from site_scons/*** | TODO: Should we also include files loaded from site_scons/*** | |||
skipping to change at line 382 | skipping to change at line 383 | |||
env.SetOption("max_drift", 1) | env.SetOption("max_drift", 1) | |||
# The Serial job class is SIGNIFICANTLY (almost twice as) faster | # The Serial job class is SIGNIFICANTLY (almost twice as) faster | |||
# than the Parallel job class for generating Ninja files. So we | # than the Parallel job class for generating Ninja files. So we | |||
# monkey the Jobs constructor to only use the Serial Job class. | # monkey the Jobs constructor to only use the Serial Job class. | |||
SCons.Job.Jobs.__init__ = ninja_always_serial | SCons.Job.Jobs.__init__ = ninja_always_serial | |||
ninja_syntax = importlib.import_module(".ninja_syntax", package='ninja') | ninja_syntax = importlib.import_module(".ninja_syntax", package='ninja') | |||
if NINJA_STATE is None: | if NINJA_STATE is None: | |||
NINJA_STATE = NinjaState(env, ninja_file[0], ninja_syntax.Writer) | NINJA_STATE = NinjaState(env, ninja_file[0], ninja_syntax) | |||
# TODO: this is hacking into scons, preferable if there were a less intrusiv e way | # TODO: this is hacking into scons, preferable if there were a less intrusiv e way | |||
# We will subvert the normal builder execute to make sure all the ninja file is dependent | # We will subvert the normal builder execute to make sure all the ninja file is dependent | |||
# on all targets generated from any builders | # on all targets generated from any builders | |||
SCons_Builder_BuilderBase__execute = SCons.Builder.BuilderBase._execute | SCons_Builder_BuilderBase__execute = SCons.Builder.BuilderBase._execute | |||
def NinjaBuilderExecute(self, env, target, source, overwarn={}, executor_kw= {}): | def NinjaBuilderExecute(self, env, target, source, overwarn={}, executor_kw= {}): | |||
# this ensures all environments in which a builder executes from will | # this ensures all environments in which a builder executes from will | |||
# not create list actions for linking on windows | # not create list actions for linking on windows | |||
ninja_hack_linkcom(env) | ninja_hack_linkcom(env) | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 3 lines changed or added |