Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compile_commands.json output location when generator_output is None #239

Merged
merged 4 commits into from
Apr 2, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions pylib/gyp/generator/compile_commands_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,14 @@ def GenerateOutput(target_list, target_dicts, data, params):
cwd = os.path.dirname(build_file)
AddCommandsForTarget(cwd, target, params, per_config_commands)

output_dir = None
try:
# generator_output can be `None` on Windows machines
output_dir = params["options"].generator_output or os.getcwd()
# generator_output can be `None` on Windows machines, or even not
# defined in other cases
output_dir = params["options"].generator_output
except (AttributeError, KeyError):
segevfiner marked this conversation as resolved.
Show resolved Hide resolved
pass
if output_dir is None:
output_dir = params["generator_flags"].get("output_dir", "out")
segevfiner marked this conversation as resolved.
Show resolved Hide resolved
for configuration_name, commands in per_config_commands.items():
filename = os.path.join(output_dir, configuration_name, "compile_commands.json")
Expand Down
Loading