Merge pull request #85153 from Repiteo/scons-improve-logs

SCons: Add two new `COMSTR` environment variables
This commit is contained in:
Rémi Verschelde 2024-03-04 13:32:38 +01:00
commit 5d3369e095
No known key found for this signature in database
GPG key ID: C3336907360768E1
14 changed files with 48 additions and 33 deletions

View file

@ -930,17 +930,17 @@ if selected_platform in platform_list:
GLSL_BUILDERS = { GLSL_BUILDERS = {
"RD_GLSL": env.Builder( "RD_GLSL": env.Builder(
action=env.Run(glsl_builders.build_rd_headers, 'Building RD_GLSL header: "$TARGET"'), action=env.Run(glsl_builders.build_rd_headers),
suffix="glsl.gen.h", suffix="glsl.gen.h",
src_suffix=".glsl", src_suffix=".glsl",
), ),
"GLSL_HEADER": env.Builder( "GLSL_HEADER": env.Builder(
action=env.Run(glsl_builders.build_raw_headers, 'Building GLSL header: "$TARGET"'), action=env.Run(glsl_builders.build_raw_headers),
suffix="glsl.gen.h", suffix="glsl.gen.h",
src_suffix=".glsl", src_suffix=".glsl",
), ),
"GLES3_GLSL": env.Builder( "GLES3_GLSL": env.Builder(
action=env.Run(gles3_builders.build_gles3_headers, 'Building GLES3 GLSL header: "$TARGET"'), action=env.Run(gles3_builders.build_gles3_headers),
suffix="glsl.gen.h", suffix="glsl.gen.h",
src_suffix=".glsl", src_suffix=".glsl",
), ),

View file

@ -202,27 +202,23 @@ env.Depends(
env.CommandNoCache( env.CommandNoCache(
"#core/io/certs_compressed.gen.h", "#core/io/certs_compressed.gen.h",
"#thirdparty/certs/ca-certificates.crt", "#thirdparty/certs/ca-certificates.crt",
env.Run(core_builders.make_certs_header, "Building ca-certificates header."), env.Run(core_builders.make_certs_header),
) )
# Authors # Authors
env.Depends("#core/authors.gen.h", "../AUTHORS.md") env.Depends("#core/authors.gen.h", "../AUTHORS.md")
env.CommandNoCache( env.CommandNoCache("#core/authors.gen.h", "../AUTHORS.md", env.Run(core_builders.make_authors_header))
"#core/authors.gen.h", "../AUTHORS.md", env.Run(core_builders.make_authors_header, "Generating authors header.")
)
# Donors # Donors
env.Depends("#core/donors.gen.h", "../DONORS.md") env.Depends("#core/donors.gen.h", "../DONORS.md")
env.CommandNoCache( env.CommandNoCache("#core/donors.gen.h", "../DONORS.md", env.Run(core_builders.make_donors_header))
"#core/donors.gen.h", "../DONORS.md", env.Run(core_builders.make_donors_header, "Generating donors header.")
)
# License # License
env.Depends("#core/license.gen.h", ["../COPYRIGHT.txt", "../LICENSE.txt"]) env.Depends("#core/license.gen.h", ["../COPYRIGHT.txt", "../LICENSE.txt"])
env.CommandNoCache( env.CommandNoCache(
"#core/license.gen.h", "#core/license.gen.h",
["../COPYRIGHT.txt", "../LICENSE.txt"], ["../COPYRIGHT.txt", "../LICENSE.txt"],
env.Run(core_builders.make_license_header, "Generating license header."), env.Run(core_builders.make_license_header),
) )
# Chain load SCsubs # Chain load SCsubs

View file

@ -14,7 +14,7 @@ controller_databases = [
gensource = env.CommandNoCache( gensource = env.CommandNoCache(
"default_controller_mappings.gen.cpp", "default_controller_mappings.gen.cpp",
controller_databases, controller_databases,
env.Run(input_builders.make_default_controller_mappings, "Generating default controller mappings."), env.Run(input_builders.make_default_controller_mappings),
) )
env.add_source_files(env.core_sources, "*.cpp") env.add_source_files(env.core_sources, "*.cpp")

View file

@ -68,7 +68,7 @@ if env.editor_build:
env.CommandNoCache( env.CommandNoCache(
"#editor/doc_data_compressed.gen.h", "#editor/doc_data_compressed.gen.h",
docs, docs,
env.Run(editor_builders.make_doc_header, "Generating documentation header."), env.Run(editor_builders.make_doc_header),
) )
# Editor interface and class reference translations incur a significant size # Editor interface and class reference translations incur a significant size
@ -83,7 +83,7 @@ if env.editor_build:
env.CommandNoCache( env.CommandNoCache(
"#editor/editor_translations.gen.h", "#editor/editor_translations.gen.h",
tlist, tlist,
env.Run(editor_builders.make_editor_translations_header, "Generating editor translations header."), env.Run(editor_builders.make_editor_translations_header),
) )
# Property translations # Property translations
@ -92,7 +92,7 @@ if env.editor_build:
env.CommandNoCache( env.CommandNoCache(
"#editor/property_translations.gen.h", "#editor/property_translations.gen.h",
tlist, tlist,
env.Run(editor_builders.make_property_translations_header, "Generating property translations header."), env.Run(editor_builders.make_property_translations_header),
) )
# Documentation translations # Documentation translations
@ -101,7 +101,7 @@ if env.editor_build:
env.CommandNoCache( env.CommandNoCache(
"#editor/doc_translations.gen.h", "#editor/doc_translations.gen.h",
tlist, tlist,
env.Run(editor_builders.make_doc_translations_header, "Generating translations header."), env.Run(editor_builders.make_doc_translations_header),
) )
# Extractable translations # Extractable translations
@ -110,7 +110,7 @@ if env.editor_build:
env.CommandNoCache( env.CommandNoCache(
"#editor/extractable_translations.gen.h", "#editor/extractable_translations.gen.h",
tlist, tlist,
env.Run(editor_builders.make_extractable_translations_header, "Generating extractable translations header."), env.Run(editor_builders.make_extractable_translations_header),
) )
env.add_source_files(env.editor_sources, "*.cpp") env.add_source_files(env.editor_sources, "*.cpp")

View file

@ -7,7 +7,7 @@ import editor_icons_builders
env["BUILDERS"]["MakeEditorIconsBuilder"] = Builder( env["BUILDERS"]["MakeEditorIconsBuilder"] = Builder(
action=env.Run(editor_icons_builders.make_editor_icons_action, "Generating editor icons header."), action=env.Run(editor_icons_builders.make_editor_icons_action),
suffix=".h", suffix=".h",
src_suffix=".svg", src_suffix=".svg",
) )

View file

@ -16,7 +16,7 @@ env.Depends("#editor/themes/builtin_fonts.gen.h", flist)
env.CommandNoCache( env.CommandNoCache(
"#editor/themes/builtin_fonts.gen.h", "#editor/themes/builtin_fonts.gen.h",
flist, flist,
env.Run(editor_theme_builders.make_fonts_header, "Generating builtin fonts header."), env.Run(editor_theme_builders.make_fonts_header),
) )
env.add_source_files(env.editor_sources, "*.cpp") env.add_source_files(env.editor_sources, "*.cpp")

View file

@ -17,7 +17,7 @@ env_main.Depends("#main/splash.gen.h", "#main/splash.png")
env_main.CommandNoCache( env_main.CommandNoCache(
"#main/splash.gen.h", "#main/splash.gen.h",
"#main/splash.png", "#main/splash.png",
env.Run(main_builders.make_splash, "Building splash screen header."), env.Run(main_builders.make_splash),
) )
if not env_main["no_editor_splash"]: if not env_main["no_editor_splash"]:
@ -25,14 +25,14 @@ if not env_main["no_editor_splash"]:
env_main.CommandNoCache( env_main.CommandNoCache(
"#main/splash_editor.gen.h", "#main/splash_editor.gen.h",
"#main/splash_editor.png", "#main/splash_editor.png",
env.Run(main_builders.make_splash_editor, "Building editor splash screen header."), env.Run(main_builders.make_splash_editor),
) )
env_main.Depends("#main/app_icon.gen.h", "#main/app_icon.png") env_main.Depends("#main/app_icon.gen.h", "#main/app_icon.png")
env_main.CommandNoCache( env_main.CommandNoCache(
"#main/app_icon.gen.h", "#main/app_icon.gen.h",
"#main/app_icon.png", "#main/app_icon.png",
env.Run(main_builders.make_app_icon, "Building application icon."), env.Run(main_builders.make_app_icon),
) )
lib = env_main.add_library("main", env.main_sources) lib = env_main.add_library("main", env.main_sources)

View file

@ -607,6 +607,12 @@ def no_verbose(sys, env):
java_library_message = "{}Creating Java Archive {}$TARGET{} ...{}".format( java_library_message = "{}Creating Java Archive {}$TARGET{} ...{}".format(
colors["blue"], colors["bold_blue"], colors["blue"], colors["reset"] colors["blue"], colors["bold_blue"], colors["blue"], colors["reset"]
) )
compiled_resource_message = "{}Creating Compiled Resource {}$TARGET{} ...{}".format(
colors["blue"], colors["bold_blue"], colors["blue"], colors["reset"]
)
generated_file_message = "{}Generating {}$TARGET{} ...{}".format(
colors["blue"], colors["bold_blue"], colors["blue"], colors["reset"]
)
env.Append(CXXCOMSTR=[compile_source_message]) env.Append(CXXCOMSTR=[compile_source_message])
env.Append(CCCOMSTR=[compile_source_message]) env.Append(CCCOMSTR=[compile_source_message])
@ -618,6 +624,8 @@ def no_verbose(sys, env):
env.Append(LINKCOMSTR=[link_program_message]) env.Append(LINKCOMSTR=[link_program_message])
env.Append(JARCOMSTR=[java_library_message]) env.Append(JARCOMSTR=[java_library_message])
env.Append(JAVACCOMSTR=[java_compile_source_message]) env.Append(JAVACCOMSTR=[java_compile_source_message])
env.Append(RCCOMSTR=[compiled_resource_message])
env.Append(GENCOMSTR=[generated_file_message])
def detect_visual_c_compiler_version(tools_env): def detect_visual_c_compiler_version(tools_env):
@ -817,15 +825,14 @@ def CommandNoCache(env, target, sources, command, **args):
return result return result
def Run(env, function, short_message, subprocess=True): def Run(env, function, subprocess=True):
from SCons.Script import Action from SCons.Script import Action
from platform_methods import run_in_subprocess from platform_methods import run_in_subprocess
output_print = short_message if not env["verbose"] else ""
if not subprocess: if not subprocess:
return Action(function, output_print) return Action(function, "$GENCOMSTR")
else: else:
return Action(run_in_subprocess(function), output_print) return Action(run_in_subprocess(function), "$GENCOMSTR")
def detect_darwin_sdk_path(platform, env): def detect_darwin_sdk_path(platform, env):

View file

@ -19,7 +19,6 @@ env.CommandNoCache(
Value(env.module_list), Value(env.module_list),
env.Run( env.Run(
modules_builders.generate_modules_enabled, modules_builders.generate_modules_enabled,
"Generating enabled modules header.",
# NOTE: No need to run in subprocess since this is still executed serially. # NOTE: No need to run in subprocess since this is still executed serially.
subprocess=False, subprocess=False,
), ),
@ -58,7 +57,6 @@ if env["tests"]:
test_headers, test_headers,
env.Run( env.Run(
modules_builders.generate_modules_tests, modules_builders.generate_modules_tests,
"Generating modules tests header.",
# NOTE: No need to run in subprocess since this is still executed serially. # NOTE: No need to run in subprocess since this is still executed serially.
subprocess=False, subprocess=False,
), ),

View file

@ -5,7 +5,7 @@ Import("env")
import editor.template_builders as build_template_gd import editor.template_builders as build_template_gd
env["BUILDERS"]["MakeGDTemplateBuilder"] = Builder( env["BUILDERS"]["MakeGDTemplateBuilder"] = Builder(
action=env.Run(build_template_gd.make_templates, "Generating GDScript templates header."), action=env.Run(build_template_gd.make_templates),
suffix=".h", suffix=".h",
src_suffix=".gd", src_suffix=".gd",
) )

View file

@ -5,7 +5,7 @@ Import("env")
import editor.template_builders as build_template_cs import editor.template_builders as build_template_cs
env["BUILDERS"]["MakeCSharpTemplateBuilder"] = Builder( env["BUILDERS"]["MakeCSharpTemplateBuilder"] = Builder(
action=env.Run(build_template_cs.make_templates, "Generating C# templates header."), action=env.Run(build_template_cs.make_templates),
suffix=".h", suffix=".h",
src_suffix=".cs", src_suffix=".cs",
) )

View file

@ -42,6 +42,12 @@ def no_verbose(sys, env):
java_library_message = "{}Creating Java Archive {}$TARGET{} ...{}".format( java_library_message = "{}Creating Java Archive {}$TARGET{} ...{}".format(
colors["blue"], colors["bold_blue"], colors["blue"], colors["reset"] colors["blue"], colors["bold_blue"], colors["blue"], colors["reset"]
) )
compiled_resource_message = "{}Creating Compiled Resource {}$TARGET{} ...{}".format(
colors["blue"], colors["bold_blue"], colors["blue"], colors["reset"]
)
generated_file_message = "{}Generating {}$TARGET{} ...{}".format(
colors["blue"], colors["bold_blue"], colors["blue"], colors["reset"]
)
env.Append(CXXCOMSTR=[compile_source_message]) env.Append(CXXCOMSTR=[compile_source_message])
env.Append(CCCOMSTR=[compile_source_message]) env.Append(CCCOMSTR=[compile_source_message])
@ -53,6 +59,8 @@ def no_verbose(sys, env):
env.Append(LINKCOMSTR=[link_program_message]) env.Append(LINKCOMSTR=[link_program_message])
env.Append(JARCOMSTR=[java_library_message]) env.Append(JARCOMSTR=[java_library_message])
env.Append(JAVACCOMSTR=[java_compile_source_message]) env.Append(JAVACCOMSTR=[java_compile_source_message])
env.Append(RCCOMSTR=[compiled_resource_message])
env.Append(GENCOMSTR=[generated_file_message])
def disable_warnings(self): def disable_warnings(self):

View file

@ -42,6 +42,12 @@ def no_verbose(sys, env):
java_library_message = "{}Creating Java Archive {}$TARGET{} ...{}".format( java_library_message = "{}Creating Java Archive {}$TARGET{} ...{}".format(
colors["blue"], colors["bold_blue"], colors["blue"], colors["reset"] colors["blue"], colors["bold_blue"], colors["blue"], colors["reset"]
) )
compiled_resource_message = "{}Creating Compiled Resource {}$TARGET{} ...{}".format(
colors["blue"], colors["bold_blue"], colors["blue"], colors["reset"]
)
generated_file_message = "{}Generating {}$TARGET{} ...{}".format(
colors["blue"], colors["bold_blue"], colors["blue"], colors["reset"]
)
env.Append(CXXCOMSTR=[compile_source_message]) env.Append(CXXCOMSTR=[compile_source_message])
env.Append(CCCOMSTR=[compile_source_message]) env.Append(CCCOMSTR=[compile_source_message])
@ -53,6 +59,8 @@ def no_verbose(sys, env):
env.Append(LINKCOMSTR=[link_program_message]) env.Append(LINKCOMSTR=[link_program_message])
env.Append(JARCOMSTR=[java_library_message]) env.Append(JARCOMSTR=[java_library_message])
env.Append(JAVACCOMSTR=[java_compile_source_message]) env.Append(JAVACCOMSTR=[java_compile_source_message])
env.Append(RCCOMSTR=[compiled_resource_message])
env.Append(GENCOMSTR=[generated_file_message])
def disable_warnings(self): def disable_warnings(self):

View file

@ -6,9 +6,7 @@ import default_theme_icons_builders
env["BUILDERS"]["MakeDefaultThemeIconsBuilder"] = Builder( env["BUILDERS"]["MakeDefaultThemeIconsBuilder"] = Builder(
action=env.Run( action=env.Run(default_theme_icons_builders.make_default_theme_icons_action),
default_theme_icons_builders.make_default_theme_icons_action, "Generating default project theme icons header."
),
suffix=".h", suffix=".h",
src_suffix=".svg", src_suffix=".svg",
) )