Skip to content

Commit 8e834df

Browse files
committed
Flip the if statement in constructor target_statment
1 parent 75c7065 commit 8e834df

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

refresh.template.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -868,13 +868,13 @@ def _get_commands(target: str, flags: str):
868868
target_statment = f"filter('^//', {target_statment})"
869869
if file_flags:
870870
file_path = file_flags[0]
871-
# For header file we try to find from hdrs and srcs to get the targets
872-
if file_path.endswith('.h'):
871+
if any(file_path.endswith(extension) for extension in _get_files.source_extensions):
872+
target_statment = f"inputs('{re.escape(file_path)}', {target_statment})"
873+
else:
874+
# For header file we try to find from hdrs and srcs to get the targets
873875
# Since attr function can't query with full path, get the file name to query
874876
head, tail = os.path.split(file_path)
875877
target_statment = f"attr(hdrs, '{tail}', {target_statment}) + attr(srcs, '{tail}', {target_statment})"
876-
else:
877-
target_statment = f"inputs('{re.escape(file_path)}', {target_statment})"
878878
aquery_args = [
879879
'bazel',
880880
'aquery',

0 commit comments

Comments
 (0)