diff --git a/refresh.template.py b/refresh.template.py index 7fd5516..72c4c03 100644 --- a/refresh.template.py +++ b/refresh.template.py @@ -871,10 +871,10 @@ def _get_commands(target: str, flags: str): if file_path.endswith(_get_files.source_extensions): target_statment = f"inputs('{re.escape(file_path)}', {target_statment})" else: - # For header file we try to find from hdrs and srcs to get the targets + # For header files we try to find from hdrs and srcs to get the targets # Since attr function can't query with full path, get the file name to query - head, tail = os.path.split(file_path) - target_statment = f"let v = {target_statment} in attr(hdrs, '{tail}', $v) + attr(srcs, '{tail}', $v)" + fname = os.path.basename(file_path) + target_statment = f"let v = {target_statment} in attr(hdrs, '{fname}', $v) + attr(srcs, '{fname}', $v)" aquery_args = [ 'bazel', 'aquery',