Browse Source

Mono/C#: Prevent SCons from building API solutions in parallel

Ignacio Etcheverry 5 years ago
parent
commit
ebdd2bc474

+ 2 - 2
modules/mono/SCsub

@@ -42,14 +42,14 @@ mono_configure.configure(env, env_mono)
 
 
 if env_mono['tools'] and env_mono['mono_glue']:
 if env_mono['tools'] and env_mono['mono_glue']:
     import build_scripts.api_solution_build as api_solution_build
     import build_scripts.api_solution_build as api_solution_build
-    api_solution_build.build(env_mono)
+    api_sln_cmd = api_solution_build.build(env_mono)
 
 
 # Build GodotTools
 # Build GodotTools
 
 
 if env_mono['tools']:
 if env_mono['tools']:
     import build_scripts.godot_tools_build as godot_tools_build
     import build_scripts.godot_tools_build as godot_tools_build
     if env_mono['mono_glue']:
     if env_mono['mono_glue']:
-        godot_tools_build.build(env_mono)
+        godot_tools_build.build(env_mono, api_sln_cmd)
     else:
     else:
         # Building without the glue sources so the Godot API solution may be missing.
         # Building without the glue sources so the Godot API solution may be missing.
         # GodotTools depends on the Godot API solution. As such, we will only build
         # GodotTools depends on the Godot API solution. As such, we will only build

+ 11 - 1
modules/mono/build_scripts/api_solution_build.py

@@ -55,12 +55,22 @@ def build(env_mono):
         'GodotSharpEditor.dll', 'GodotSharpEditor.pdb', 'GodotSharpEditor.xml'
         'GodotSharpEditor.dll', 'GodotSharpEditor.pdb', 'GodotSharpEditor.xml'
     ]
     ]
 
 
+    depend_cmd = []
+
     for build_config in ['Debug', 'Release']:
     for build_config in ['Debug', 'Release']:
         output_dir = Dir('#bin').abspath
         output_dir = Dir('#bin').abspath
         editor_api_dir = os.path.join(output_dir, 'GodotSharp', 'Api', build_config)
         editor_api_dir = os.path.join(output_dir, 'GodotSharp', 'Api', build_config)
 
 
         targets = [os.path.join(editor_api_dir, filename) for filename in target_filenames]
         targets = [os.path.join(editor_api_dir, filename) for filename in target_filenames]
 
 
-        cmd = env_mono.CommandNoCache(targets, [], build_api_solution,
+        cmd = env_mono.CommandNoCache(targets, depend_cmd, build_api_solution,
                                       module_dir=os.getcwd(), solution_build_config=build_config)
                                       module_dir=os.getcwd(), solution_build_config=build_config)
         env_mono.AlwaysBuild(cmd)
         env_mono.AlwaysBuild(cmd)
+
+        # Make the Release build of the API solution depend on the Debug build.
+        # We do this in order to prevent SCons from building them in parallel,
+        # which can freak out MSBuild. In many cases, one of the builds would
+        # hang indefinitely requiring a key to be pressed for it to continue.
+        depend_cmd = cmd
+
+    return depend_cmd

+ 2 - 6
modules/mono/build_scripts/godot_tools_build.py

@@ -74,15 +74,11 @@ def build_godot_tools_project_editor(source, target, env):
         copy_target(str(scons_target))
         copy_target(str(scons_target))
 
 
 
 
-def build(env_mono):
+def build(env_mono, api_sln_cmd):
     assert env_mono['tools']
     assert env_mono['tools']
 
 
     output_dir = Dir('#bin').abspath
     output_dir = Dir('#bin').abspath
     editor_tools_dir = os.path.join(output_dir, 'GodotSharp', 'Tools')
     editor_tools_dir = os.path.join(output_dir, 'GodotSharp', 'Tools')
-    editor_api_dir = os.path.join(output_dir, 'GodotSharp', 'Api', 'Debug')
-
-    source_filenames = ['GodotSharp.dll', 'GodotSharpEditor.dll']
-    sources = [os.path.join(editor_api_dir, filename) for filename in source_filenames]
 
 
     target_filenames = [
     target_filenames = [
         'GodotTools.dll', 'GodotTools.IdeConnection.dll', 'GodotTools.BuildLogger.dll',
         'GodotTools.dll', 'GodotTools.IdeConnection.dll', 'GodotTools.BuildLogger.dll',
@@ -97,7 +93,7 @@ def build(env_mono):
 
 
     targets = [os.path.join(editor_tools_dir, filename) for filename in target_filenames]
     targets = [os.path.join(editor_tools_dir, filename) for filename in target_filenames]
 
 
-    cmd = env_mono.CommandNoCache(targets, sources, build_godot_tools, module_dir=os.getcwd())
+    cmd = env_mono.CommandNoCache(targets, api_sln_cmd, build_godot_tools, module_dir=os.getcwd())
     env_mono.AlwaysBuild(cmd)
     env_mono.AlwaysBuild(cmd)