Skip to content

Commit 4fbd4a3

Browse files
committed
refresh.template.py: omit warn_missing_generated and rename _file_exists to _warn_if_file_doesnt_exist
1 parent b7ab9ae commit 4fbd4a3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

refresh.template.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ def _print_header_finding_warning_once():
9393
Continuing gracefully...""")
9494
_print_header_finding_warning_once.has_logged = False
9595

96-
def _file_exists(source_file, warn_missing_generated = True):
96+
def _warn_if_file_doesnt_exist(source_file):
9797
if not os.path.isfile(source_file):
98-
if not _file_exists.has_logged_missing_file_error and True == warn_missing_generated: # Just log once; subsequent messages wouldn't add anything.
99-
_file_exists.has_logged_missing_file_error = True
98+
if not _warn_if_file_doesnt_exist.has_logged_missing_file_error: # Just log once; subsequent messages wouldn't add anything.
99+
_warn_if_file_doesnt_exist.has_logged_missing_file_error = True
100100
log_warning(f""">>> A source file you compile doesn't (yet) exist: {source_file}
101101
It's probably a generated file, and you haven't yet run a build to generate it.
102102
That's OK; your code doesn't even have to compile for this tool to work.
@@ -109,7 +109,7 @@ def _file_exists(source_file, warn_missing_generated = True):
109109
Continuing gracefully...""")
110110
return False
111111
return True
112-
_file_exists.has_logged_missing_file_error = False
112+
_warn_if_file_doesnt_exist.has_logged_missing_file_error = False
113113

114114
@functools.lru_cache(maxsize=None)
115115
def _get_bazel_cached_action_keys():
@@ -581,7 +581,7 @@ def _get_files(compile_action):
581581
assert source_file.endswith(_get_files.source_extensions), f"Source file candidate, {source_file}, seems to be wrong.\nSelected from {compile_action.arguments}.\nPlease file an issue with this information!"
582582

583583
# Warn gently about missing files
584-
if not _file_exists(source_file):
584+
if not _warn_if_file_doesnt_exist(source_file):
585585
return {source_file}, set()
586586

587587
# Note: We need to apply commands to headers and sources.
@@ -820,7 +820,7 @@ def _get_swift_command_for_files(compile_action):
820820
source_files = set(filter(lambda x: x[-6:] == ".swift", compile_action.arguments))
821821

822822
for source_file in source_files:
823-
_file_exists(source_file)
823+
_warn_if_file_doesnt_exist(source_file)
824824

825825
return source_files, set(), compile_action.arguments
826826

0 commit comments

Comments
 (0)