summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Schwarzer <me@timoschwarzer.com>2017-07-08 11:39:07 +0200
committerTimo Schwarzer <me@timoschwarzer.com>2017-07-11 19:46:23 +0200
commitf93bb4f458b84315b68c7c2ce6ddf1e692121ef8 (patch)
tree31b01bb895aa885360aa11f9e736f592deb2f9dd
parenta5bb77d5232668045fc2fb82637b00b5295b8741 (diff)
Add options for more human-friendly build output
-rw-r--r--.gitignore3
-rw-r--r--.travis.yml4
-rw-r--r--SConstruct45
3 files changed, 48 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
index 7552e8fd17..497d8b50d2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -284,3 +284,6 @@ platform/windows/godot_res.res
# Visual Studio 2017 and Visual Studio Code workspace folder
/.vs
/.vscode
+
+# Scons progress indicator
+.scons_node_count
diff --git a/.travis.yml b/.travis.yml
index 12d49f5d5d..8aa21a4de4 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -88,8 +88,8 @@ script:
sh ./misc/travis/clang-format.sh;
else
if [ "$TRAVIS_OS_NAME" = "windows" ]; then
- scons platform=$GODOT_TARGET CXX=$CXX openssl=builtin;
+ scons platform=$GODOT_TARGET progress=no verbose=yes CXX=$CXX openssl=builtin;
else
- scons platform=$GODOT_TARGET bits=64 CXX=$CXX openssl=builtin;
+ scons platform=$GODOT_TARGET progress=no verbose=yes bits=64 CXX=$CXX openssl=builtin;
fi
fi
diff --git a/SConstruct b/SConstruct
index a403117065..e2cfd3ec35 100644
--- a/SConstruct
+++ b/SConstruct
@@ -150,9 +150,11 @@ opts.Add('disable_3d', "Disable 3D nodes for smaller executable (yes/no)", 'no')
opts.Add('disable_advanced_gui', "Disable advance 3D gui nodes and behaviors (yes/no)", 'no')
opts.Add('extra_suffix', "Custom extra suffix added to the base filename of all generated binary files", '')
opts.Add('unix_global_settings_path', "UNIX-specific path to system-wide settings. Currently only used for templates", '')
-opts.Add('verbose', "Enable verbose output for the compilation (yes/no)", 'yes')
+opts.Add('verbose', "Enable verbose output for the compilation (yes/no)", 'no')
opts.Add('vsproj', "Generate Visual Studio Project. (yes/no)", 'no')
-opts.Add('warnings', "Set the level of warnings emitted during compilation (extra/all/moderate/no)", 'all')
+opts.Add('warnings', "Set the level of warnings emitted during compilation (extra/all/moderate/no)", 'no')
+opts.Add('progress', "Show a progress indicator during build (yes/no)", 'yes')
+opts.Add('dev', "If yes, alias for verbose=yes warnings=all (yes/no)", 'no')
# Thirdparty libraries
opts.Add('builtin_enet', "Use the builtin enet library (yes/no)", 'yes')
@@ -231,6 +233,10 @@ if selected_platform in platform_list:
env = detect.create(env_base)
else:
env = env_base.Clone()
+
+ if (env["dev"] == "yes"):
+ env["warnings"] = "all"
+ env["verbose"] = "yes"
if env['vsproj'] == "yes":
env.vs_incs = []
@@ -449,3 +455,38 @@ else:
for x in platform_list:
print("\t" + x)
print("\nPlease run scons again with argument: platform=<string>")
+
+
+screen = sys.stdout
+node_count = 0
+node_count_max = 0
+node_count_interval = 1
+node_count_fname = str(env.Dir('#')) + '/.scons_node_count'
+
+def progress_function(node):
+ global node_count, node_count_max, node_count_interval, node_count_fname
+ node_count += node_count_interval
+ if (node_count_max > 0 and node_count <= node_count_max):
+ screen.write('\r[%3d%%] ' % (node_count * 100 / node_count_max))
+ screen.flush()
+ elif (node_count_max > 0 and node_count > node_count_max):
+ screen.write('\r[100%] ')
+ screen.flush()
+ else:
+ screen.write('\r[Initial build] ')
+ screen.flush()
+
+def progress_finish(target, source, env):
+ global node_count
+ with open(node_count_fname, 'w') as f:
+ f.write('%d\n' % node_count)
+
+if (env["progress"] == "yes"):
+ try:
+ with open(node_count_fname) as f:
+ node_count_max = int(f.readline())
+ except:
+ pass
+ Progress(progress_function, interval = node_count_interval)
+ progress_finish_command = Command('progress_finish', [], progress_finish)
+ AlwaysBuild(progress_finish_command)