Skip to content

Commit b602fbe

Browse files
committed
Tidy up
1 parent b33f0ca commit b602fbe

3 files changed

Lines changed: 19 additions & 14 deletions

File tree

src/codechecker.bzl

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,10 @@ def _codechecker_impl(ctx):
101101
ctx.actions.expand_template(
102102
template = ctx.file._codechecker_script_template,
103103
output = ctx.outputs.codechecker_script,
104-
is_executable = True,
104+
is_executable = False,
105105
substitutions = {
106106
"{Mode}": "Run",
107107
"{Verbosity}": "DEBUG",
108-
#"{PythonPath}": python_path(ctx), # "/usr/bin/env python3",
109108
"{codechecker_bin}": CODECHECKER_BIN_PATH,
110109
"{compile_commands}": ctx.outputs.codechecker_commands.path,
111110
"{codechecker_skipfile}": ctx.outputs.codechecker_skipfile.path,
@@ -130,8 +129,6 @@ def _codechecker_impl(ctx):
130129
codechecker_files,
131130
ctx.outputs.codechecker_log,
132131
],
133-
#executable = ctx.outputs.codechecker_script,
134-
#arguments = [],
135132
executable = python_path(ctx),
136133
tools = python_interpreter_tool(ctx),
137134
arguments = [ctx.outputs.codechecker_script.path],
@@ -235,13 +232,12 @@ def _codechecker_test_impl(ctx):
235232
substitutions = {
236233
"{Mode}": "Test",
237234
"{Verbosity}": "INFO",
238-
#"{PythonPath}": python_path(ctx), # "/usr/bin/env python3",
239235
"{codechecker_bin}": CODECHECKER_BIN_PATH,
240236
"{codechecker_files}": codechecker_files.short_path,
241237
"{Severities}": " ".join(ctx.attr.severities),
242238
},
243239
)
244-
# For use in script the short path must be used
240+
# For use in script the short path must be used (or absolute path)
245241
# For use in executable the full path
246242
python_interpreter_path = python_path(ctx)
247243
if python_interpreter_tool(ctx) != []:
@@ -259,13 +255,15 @@ def _codechecker_test_impl(ctx):
259255
)
260256

261257
# Return test script and all required files
262-
run_files = default_runfiles + [ctx.outputs.codechecker_test_script, ctx.outputs.test_script_wrapper] + python_interpreter_tool(ctx)
258+
run_files = default_runfiles + [
259+
ctx.outputs.codechecker_test_script,
260+
ctx.outputs.test_script_wrapper,
261+
] + python_interpreter_tool(ctx)
263262

264263
return [
265264
DefaultInfo(
266265
files = depset(all_files),
267266
runfiles = ctx.runfiles(files = run_files),
268-
#executable = ctx.outputs.codechecker_test_script,
269267
executable = ctx.outputs.test_script_wrapper,
270268
),
271269
]

src/per_file.bzl

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,21 @@ def _run_code_checker(
6060
codechecker_log = ctx.actions.declare_file(codechecker_log_file_name)
6161

6262
if "--ctu" in options:
63-
inputs = [ctx.outputs.per_file_script, compile_commands_json, config_file] + sources_and_headers
63+
inputs = [
64+
ctx.outputs.per_file_script,
65+
compile_commands_json,
66+
config_file,
67+
] + sources_and_headers
6468
else:
6569
# NOTE: we collect only headers, so CTU may not work!
6670
headers = depset(transitive = target[SourceFilesInfo].headers.to_list())
67-
inputs = depset([ctx.outputs.per_file_script, compile_commands_json, config_file, src], transitive = [headers])
71+
inputs = depset(
72+
[
73+
ctx.outputs.per_file_script,
74+
compile_commands_json,
75+
config_file,
76+
src,
77+
], transitive = [headers])
6878

6979
outputs = [clang_tidy_plist, clangsa_plist, codechecker_log]
7080

@@ -131,9 +141,8 @@ def _create_wrapper_script(ctx, options, compile_commands_json, config_file):
131141
ctx.actions.expand_template(
132142
template = ctx.file._per_file_script_template,
133143
output = ctx.outputs.per_file_script,
134-
is_executable = True,
144+
is_executable = False,
135145
substitutions = {
136-
#"{PythonPath}": ctx.attr._python_runtime[PyRuntimeInfo].interpreter_path,
137146
"{compile_commands_json}": compile_commands_json.path,
138147
"{codechecker_args}": options_str,
139148
"{config_file}": config_file.path,

src/per_file_script.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#{PythonPath}
2-
31
# Copyright 2023 Ericsson AB
42
#
53
# Licensed under the Apache License, Version 2.0 (the "License");

0 commit comments

Comments
 (0)