summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-10-26 13:17:27 +0200
committerRémi Verschelde <rverschelde@gmail.com>2023-10-26 15:13:48 +0200
commit495245ed89fe6931387b3821270cdff19c49238e (patch)
tree1890a628acfd087e07b19c0f2af34204b63dda7e
parent46cb7f94f755d452b146aca52c36e3d3523ad807 (diff)
downloadredot-engine-495245ed89fe6931387b3821270cdff19c49238e.tar.gz
SCons: Reduce and cleanup verbose output for SCU builds
Verbose output is meant for debugging the SCU mode itself and can be triggered by changing the `_verbose` bool manually. Prefix all prints with "SCU:" for context, and print the processed folders all at once instead of when adding the sources.
-rw-r--r--SConstruct2
-rw-r--r--methods.py3
-rw-r--r--scu_builders.py30
3 files changed, 16 insertions, 19 deletions
diff --git a/SConstruct b/SConstruct
index 031f421a63..534d5bd95d 100644
--- a/SConstruct
+++ b/SConstruct
@@ -565,7 +565,7 @@ if selected_platform in platform_list:
if read_scu_limit != 0:
max_includes_per_scu = read_scu_limit
- methods.set_scu_folders(scu_builders.generate_scu_files(env["verbose"], max_includes_per_scu))
+ methods.set_scu_folders(scu_builders.generate_scu_files(max_includes_per_scu))
# Must happen after the flags' definition, as configure is when most flags
# are actually handled to change compile options, etc.
diff --git a/methods.py b/methods.py
index d68316f0f0..7a7758e24b 100644
--- a/methods.py
+++ b/methods.py
@@ -96,9 +96,6 @@ def add_source_files_scu(self, sources, files, allow_gen=False):
if section_name not in (_scu_folders):
return False
- if self["verbose"]:
- print("SCU building " + section_name)
-
# Add all the gen.cpp files in the SCU directory
add_source_files_orig(self, sources, subdir + "scu/scu_*.gen.cpp", True)
return True
diff --git a/scu_builders.py b/scu_builders.py
index aaf83c30d5..71427eb717 100644
--- a/scu_builders.py
+++ b/scu_builders.py
@@ -7,7 +7,7 @@ from os.path import normpath, basename
base_folder_path = str(Path(__file__).parent) + "/"
base_folder_only = os.path.basename(os.path.normpath(base_folder_path))
-_verbose = False
+_verbose = True # Set manually for debug prints
_scu_folders = set()
_max_includes_per_scu = 1024
@@ -35,7 +35,7 @@ def find_files_in_folder(folder, sub_folder, include_list, extension, sought_exc
abs_folder = base_folder_path + folder + "/" + sub_folder
if not os.path.isdir(abs_folder):
- print("ERROR " + abs_folder + " not found.")
+ print("SCU: ERROR: %s not found." % abs_folder)
return include_list, found_exceptions
os.chdir(abs_folder)
@@ -67,9 +67,10 @@ def write_output_file(file_count, include_list, start_line, end_line, output_fol
# create
os.mkdir(output_folder)
if not os.path.isdir(output_folder):
- print("ERROR " + output_folder + " could not be created.")
+ print("SCU: ERROR: %s could not be created." % output_folder)
return
- print("CREATING folder " + output_folder)
+ if _verbose:
+ print("SCU: Creating folder: %s" % output_folder)
file_text = ""
@@ -79,8 +80,6 @@ def write_output_file(file_count, include_list, start_line, end_line, output_fol
li = line + "\n"
file_text += li
- # print(file_text)
-
num_string = ""
if file_count > 0:
num_string = "_" + str(file_count)
@@ -88,7 +87,7 @@ def write_output_file(file_count, include_list, start_line, end_line, output_fol
short_filename = output_filename_prefix + num_string + ".gen." + extension
output_filename = output_folder + "/" + short_filename
if _verbose:
- print("generating: " + short_filename)
+ print("SCU: Generating: %s" % short_filename)
output_path = Path(output_filename)
output_path.write_text(file_text, encoding="utf8")
@@ -97,7 +96,7 @@ def write_output_file(file_count, include_list, start_line, end_line, output_fol
def write_exception_output_file(file_count, exception_string, output_folder, output_filename_prefix, extension):
output_folder = os.path.abspath(output_folder)
if not os.path.isdir(output_folder):
- print("ERROR " + output_folder + " does not exist.")
+ print("SCU: ERROR: %s does not exist." % output_folder)
return
file_text = exception_string + "\n"
@@ -110,10 +109,8 @@ def write_exception_output_file(file_count, exception_string, output_folder, out
output_filename = output_folder + "/" + short_filename
if _verbose:
- print("generating: " + short_filename)
+ print("SCU: Generating: " + short_filename)
- # print("text: " + file_text)
- # return
output_path = Path(output_filename)
output_path.write_text(file_text, encoding="utf8")
@@ -242,15 +239,15 @@ def process_folder(folders, sought_exceptions=[], includes_per_scu=0, extension=
)
-def generate_scu_files(verbose, max_includes_per_scu):
+def generate_scu_files(max_includes_per_scu):
print("=============================")
print("Single Compilation Unit Build")
print("=============================")
- global _verbose
- _verbose = verbose
+
global _max_includes_per_scu
_max_includes_per_scu = max_includes_per_scu
- print("Generating SCU build files... (max includes per scu " + str(_max_includes_per_scu) + ")")
+
+ print("SCU: Generating build files... (max includes per SCU: %d)" % _max_includes_per_scu)
curr_folder = os.path.abspath("./")
@@ -334,4 +331,7 @@ def generate_scu_files(verbose, max_includes_per_scu):
# Finally change back the path to the calling folder
os.chdir(curr_folder)
+ if _verbose:
+ print("SCU: Processed folders: %s" % sorted(_scu_folders))
+
return _scu_folders