From 3966592cdab65f7ca0066a120f0b28cea0265c0f Mon Sep 17 00:00:00 2001 From: Dan Mezhiborsky <54985569+dmezh@users.noreply.github.com> Date: Sat, 6 Aug 2022 14:26:25 -0700 Subject: Add newline to end of compilation db --- CHANGES.txt | 3 +++ RELEASE.txt | 2 ++ SCons/Tool/compilation_db.py | 1 + test/CompilationDatabase/basic.py | 6 ++++-- test/CompilationDatabase/variant_dir.py | 12 ++++++++---- 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 66deb26..4519888 100755 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -13,6 +13,9 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER - Whatever John Doe did. + From Dan Mezhiborsky: + - Add newline to end of compilation db (compile_commands.json). + RELEASE 4.4.0 - Sat, 30 Jul 2022 14:08:29 -0700 diff --git a/RELEASE.txt b/RELEASE.txt index 439c863..6306ca7 100755 --- a/RELEASE.txt +++ b/RELEASE.txt @@ -34,6 +34,8 @@ FIXES - List fixes of outright bugs +- Added missing newline to generated compilation database (compile_commands.json) + IMPROVEMENTS ------------ diff --git a/SCons/Tool/compilation_db.py b/SCons/Tool/compilation_db.py index d20d171..9e72fe9 100644 --- a/SCons/Tool/compilation_db.py +++ b/SCons/Tool/compilation_db.py @@ -163,6 +163,7 @@ def write_compilation_db(target, source, env): json.dump( entries, output_file, sort_keys=True, indent=4, separators=(",", ": ") ) + output_file.write("\n") def scan_compilation_db(node, env, path): diff --git a/test/CompilationDatabase/basic.py b/test/CompilationDatabase/basic.py index 2f76752..b6f1a79 100644 --- a/test/CompilationDatabase/basic.py +++ b/test/CompilationDatabase/basic.py @@ -63,7 +63,8 @@ example_rel_file = """[ "file": "test_main.c", "output": "test_main.o" } -]""" % (sys.executable, test.workdir) +] +""" % (sys.executable, test.workdir) if sys.platform == 'win32': example_rel_file = example_rel_file.replace('\\', '\\\\') @@ -80,7 +81,8 @@ example_abs_file = """[ "file": "%s", "output": "%s" } -]""" % (sys.executable, test.workdir, os.path.join(test.workdir, 'test_main.c'), os.path.join(test.workdir, 'test_main.o')) +] +""" % (sys.executable, test.workdir, os.path.join(test.workdir, 'test_main.c'), os.path.join(test.workdir, 'test_main.o')) if sys.platform == 'win32': example_abs_file = example_abs_file.replace('\\', '\\\\') diff --git a/test/CompilationDatabase/variant_dir.py b/test/CompilationDatabase/variant_dir.py index 6a2675b..b0a9464 100644 --- a/test/CompilationDatabase/variant_dir.py +++ b/test/CompilationDatabase/variant_dir.py @@ -77,7 +77,8 @@ example_rel_file = """[ "file": "%(src_file)s", "output": "%(output2_file)s" } -]""" % {'exe': sys.executable, +] +""" % {'exe': sys.executable, 'workdir': test.workdir, 'src_file': os.path.join('src', 'test_main.c'), 'output_file': os.path.join('build', 'test_main.o'), @@ -106,7 +107,8 @@ example_abs_file = """[ "file": "%(abs_src_file)s", "output": "%(abs_output2_file)s" } -]""" % {'exe': sys.executable, +] +""" % {'exe': sys.executable, 'workdir': test.workdir, 'src_file': os.path.join('src', 'test_main.c'), 'abs_src_file': os.path.join(test.workdir, 'src', 'test_main.c'), @@ -130,7 +132,8 @@ example_filter_build_file = """[ "file": "%(src_file)s", "output": "%(output_file)s" } -]""" % {'exe': sys.executable, +] +""" % {'exe': sys.executable, 'workdir': test.workdir, 'src_file': os.path.join('src', 'test_main.c'), 'output_file': os.path.join('build', 'test_main.o'), @@ -151,7 +154,8 @@ example_filter_build2_file = """[ "file": "%(src_file)s", "output": "%(output2_file)s" } -]""" % {'exe': sys.executable, +] +""" % {'exe': sys.executable, 'workdir': test.workdir, 'src_file': os.path.join('src', 'test_main.c'), 'output2_file': os.path.join('build2', 'test_main.o'), -- cgit v0.12