Skip to content

Commit dc545b5

Browse files
committed
Fix Issue #3693 - change compilation db field 'target' to 'output' per spec
1 parent 0223d51 commit dc545b5

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

SCons/Tool/compilation_db.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def emit_compilation_db_entry(target, source, env):
8484
entry = env.__COMPILATIONDB_Entry(
8585
target=dbtarget,
8686
source=[],
87-
__COMPILATIONDB_UTARGET=target,
87+
__COMPILATIONDB_UOUTPUT=target,
8888
__COMPILATIONDB_USOURCE=source,
8989
__COMPILATIONDB_UACTION=user_action,
9090
__COMPILATIONDB_ENV=env,
@@ -116,7 +116,7 @@ def compilation_db_entry_action(target, source, env, **kw):
116116
"""
117117

118118
command = env["__COMPILATIONDB_UACTION"].strfunction(
119-
target=env["__COMPILATIONDB_UTARGET"],
119+
target=env["__COMPILATIONDB_UOUTPUT"],
120120
source=env["__COMPILATIONDB_USOURCE"],
121121
env=env["__COMPILATIONDB_ENV"],
122122
)
@@ -125,7 +125,7 @@ def compilation_db_entry_action(target, source, env, **kw):
125125
"directory": env.Dir("#").abspath,
126126
"command": command,
127127
"file": env["__COMPILATIONDB_USOURCE"][0],
128-
"target": env['__COMPILATIONDB_UTARGET'][0]
128+
"output": env['__COMPILATIONDB_UOUTPUT'][0]
129129
}
130130

131131
target[0].write(entry)
@@ -139,25 +139,25 @@ def write_compilation_db(target, source, env):
139139
for s in __COMPILATION_DB_ENTRIES:
140140
entry = s.read()
141141
source_file = entry['file']
142-
target_file = entry['target']
142+
output_file = entry['output']
143143

144144
if use_abspath:
145145
source_file = source_file.abspath
146-
target_file = target_file.abspath
146+
output_file = output_file.abspath
147147
else:
148148
source_file = source_file.path
149-
target_file = target_file.path
149+
output_file = output_file.path
150150

151151
path_entry = {'directory': entry['directory'],
152152
'command': entry['command'],
153153
'file': source_file,
154-
'target': target_file}
154+
'output': output_file}
155155

156156
entries.append(path_entry)
157157

158-
with open(target[0].path, "w") as target_file:
158+
with open(target[0].path, "w") as output_file:
159159
json.dump(
160-
entries, target_file, sort_keys=True, indent=4, separators=(",", ": ")
160+
entries, output_file, sort_keys=True, indent=4, separators=(",", ": ")
161161
)
162162

163163

SCons/Tool/compilation_db.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ env.CompilationDatabase('my_output.json')
101101
<!-- </para>-->
102102
<!-- </summary>-->
103103
<!-- </cvar>-->
104-
<!-- <cvar name="__COMPILATIONDB_UTARGET">-->
104+
<!-- <cvar name="__COMPILATIONDB_UOUTPUT">-->
105105
<!-- <summary>-->
106106
<!-- <para>-->
107107
<!-- This variable stores the action for building a target.-->

test/CompilationDatabase/basic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"command": "%s mygcc.py cc -o test_main.o -c test_main.c",
6464
"directory": "%s",
6565
"file": "test_main.c",
66-
"target": "test_main.o"
66+
"output": "test_main.o"
6767
}
6868
]""" % (sys.executable, test.workdir)
6969

@@ -77,7 +77,7 @@
7777
"command": "%s mygcc.py cc -o test_main.o -c test_main.c",
7878
"directory": "%s",
7979
"file": "%s/test_main.c",
80-
"target": "%s/test_main.o"
80+
"output": "%s/test_main.o"
8181
}
8282
]""" % (sys.executable, test.workdir, test.workdir, test.workdir)
8383

0 commit comments

Comments
 (0)