cd4e46ee65
Configured for a max line length of 120 characters. psf/black is very opinionated and purposely doesn't leave much room for configuration. The output is mostly OK so that should be fine for us, but some things worth noting: - Manually wrapped strings will be reflowed, so by using a line length of 120 for the sake of preserving readability for our long command calls, it also means that some manually wrapped strings are back on the same line and should be manually merged again. - Code generators using string concatenation extensively look awful, since black puts each operand on a single line. We need to refactor these generators to use more pythonic string formatting, for which many options are available (`%`, `format` or f-strings). - CI checks and a pre-commit hook will be added to ensure that future buildsystem changes are well-formatted.
41 lines
1.3 KiB
Python
41 lines
1.3 KiB
Python
# Build GodotTools solution
|
|
|
|
import os
|
|
|
|
from SCons.Script import Dir
|
|
|
|
|
|
def build_godot_tools(source, target, env):
|
|
# source and target elements are of type SCons.Node.FS.File, hence why we convert them to str
|
|
|
|
module_dir = env["module_dir"]
|
|
|
|
solution_path = os.path.join(module_dir, "editor/GodotTools/GodotTools.sln")
|
|
build_config = "Debug" if env["target"] == "debug" else "Release"
|
|
|
|
# Custom build target to make sure output is always copied to the data dir.
|
|
extra_build_args = ["/Target:Build;GodotTools:BuildAlwaysCopyToDataDir"]
|
|
|
|
from .solution_builder import build_solution, nuget_restore
|
|
|
|
nuget_restore(env, solution_path)
|
|
build_solution(env, solution_path, build_config, extra_build_args)
|
|
# No need to copy targets. The GodotTools csproj takes care of copying them.
|
|
|
|
|
|
def build(env_mono, api_sln_cmd):
|
|
assert env_mono["tools"]
|
|
|
|
output_dir = Dir("#bin").abspath
|
|
editor_tools_dir = os.path.join(output_dir, "GodotSharp", "Tools")
|
|
|
|
target_filenames = ["GodotTools.dll"]
|
|
|
|
if env_mono["target"] == "debug":
|
|
target_filenames += ["GodotTools.pdb"]
|
|
|
|
targets = [os.path.join(editor_tools_dir, filename) for filename in target_filenames]
|
|
|
|
cmd = env_mono.CommandNoCache(targets, api_sln_cmd, build_godot_tools, module_dir=os.getcwd())
|
|
env_mono.AlwaysBuild(cmd)
|