diff options
author | Andrii Doroshenko (Xrayez) <xrayez@gmail.com> | 2020-07-27 21:00:26 +0300 |
---|---|---|
committer | Andrii Doroshenko (Xrayez) <xrayez@gmail.com> | 2020-07-28 00:09:21 +0300 |
commit | d86de6c98e435d31bfdebc50d2db6d4d4048be40 (patch) | |
tree | df495708bfab8bb48cc6926c34c0785ea996feb7 /SConstruct | |
parent | f93c04d8efef1bdfff5d5839569eb7e22c667be6 (diff) |
SCons: Refactor running commands through builders
A new `env.Run` method is added which allows to control the verbosity
of builders output automatically depending on whether the "verbose"
option is set. It also allows to optionally run any SCons commands in a
subprocess using the existing `run_in_subprocess` method, unifying
the interface. `Action` objects wrap all builder functions to include a
short build message associated with any action.
Notably, this removes quite verbose output generated by `make_doc_header`
and `make_editor_icons_action` builders.
Diffstat (limited to 'SConstruct')
-rw-r--r-- | SConstruct | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/SConstruct b/SConstruct index 7ec926f99b..96d2f1abe7 100644 --- a/SConstruct +++ b/SConstruct @@ -84,6 +84,7 @@ env_base.__class__.add_shared_library = methods.add_shared_library env_base.__class__.add_library = methods.add_library env_base.__class__.add_program = methods.add_program env_base.__class__.CommandNoCache = methods.CommandNoCache +env_base.__class__.Run = methods.Run env_base.__class__.disable_warnings = methods.disable_warnings env_base.__class__.module_check_dependencies = methods.module_check_dependencies @@ -627,27 +628,24 @@ if selected_platform in platform_list: methods.no_verbose(sys, env) if not env["platform"] == "server": - env.Append( - BUILDERS={ - "GLES2_GLSL": env.Builder( - action=run_in_subprocess(gles_builders.build_gles2_headers), suffix="glsl.gen.h", src_suffix=".glsl" - ) - } - ) - env.Append( - BUILDERS={ - "RD_GLSL": env.Builder( - action=run_in_subprocess(gles_builders.build_rd_headers), suffix="glsl.gen.h", src_suffix=".glsl" - ) - } - ) - env.Append( - BUILDERS={ - "GLSL_HEADER": env.Builder( - action=run_in_subprocess(gles_builders.build_raw_headers), suffix="glsl.gen.h", src_suffix=".glsl" - ) - } - ) + GLSL_BUILDERS = { + "GLES2_GLSL": env.Builder( + action=env.Run(gles_builders.build_gles2_headers, 'Building GLES2_GLSL header: "$TARGET"'), + suffix="glsl.gen.h", + src_suffix=".glsl", + ), + "RD_GLSL": env.Builder( + action=env.Run(gles_builders.build_rd_headers, 'Building RD_GLSL header: "$TARGET"'), + suffix="glsl.gen.h", + src_suffix=".glsl", + ), + "GLSL_HEADER": env.Builder( + action=env.Run(gles_builders.build_raw_headers, 'Building GLSL header: "$TARGET"'), + suffix="glsl.gen.h", + src_suffix=".glsl", + ), + } + env.Append(BUILDERS=GLSL_BUILDERS) scons_cache_path = os.environ.get("SCONS_CACHE") if scons_cache_path != None: |