(
file_path: Path,
lang_output_dirs: Dict[str, Path],
import_paths: List[Path],
go_nested_type_style: Optional[str],
swift_namespace_style: Optional[str],
emit_fdl: bool,
emit_fdl_path: Optional[Path],
generated: Set[Path],
stack: Set[Path],
resolve_cache: Dict[Path, Schema],
go_module_root: Optional[Path],
generated_outputs: Dict[Path, Path],
grpc: bool = False,
grpc_web: bool = False,
grpc_python_mode: str = "async",
)
| 845 | |
| 846 | |
| 847 | def compile_file_recursive( |
| 848 | file_path: Path, |
| 849 | lang_output_dirs: Dict[str, Path], |
| 850 | import_paths: List[Path], |
| 851 | go_nested_type_style: Optional[str], |
| 852 | swift_namespace_style: Optional[str], |
| 853 | emit_fdl: bool, |
| 854 | emit_fdl_path: Optional[Path], |
| 855 | generated: Set[Path], |
| 856 | stack: Set[Path], |
| 857 | resolve_cache: Dict[Path, Schema], |
| 858 | go_module_root: Optional[Path], |
| 859 | generated_outputs: Dict[Path, Path], |
| 860 | grpc: bool = False, |
| 861 | grpc_web: bool = False, |
| 862 | grpc_python_mode: str = "async", |
| 863 | ) -> bool: |
| 864 | file_path = file_path.resolve() |
| 865 | if file_path in generated: |
| 866 | return True |
| 867 | if file_path in stack: |
| 868 | raise ImportError(f"Circular import detected: {file_path}") |
| 869 | |
| 870 | stack.add(file_path) |
| 871 | try: |
| 872 | schema = parse_idl_file(file_path) |
| 873 | except OSError as e: |
| 874 | print(f"Error reading {file_path}: {e}", file=sys.stderr) |
| 875 | stack.remove(file_path) |
| 876 | return False |
| 877 | except (FrontendError, ValueError) as e: |
| 878 | print(f"Error: {e}", file=sys.stderr) |
| 879 | stack.remove(file_path) |
| 880 | return False |
| 881 | |
| 882 | if "go" in lang_output_dirs and go_module_root is None: |
| 883 | go_module_root = resolve_go_module_root(lang_output_dirs["go"], schema) |
| 884 | |
| 885 | effective_outputs = lang_output_dirs |
| 886 | if "go" in lang_output_dirs: |
| 887 | go_root = go_module_root or lang_output_dirs["go"] |
| 888 | if ( |
| 889 | schema.get_option("go_package") is None |
| 890 | and lang_output_dirs["go"] != go_root |
| 891 | ): |
| 892 | go_out = lang_output_dirs["go"] |
| 893 | else: |
| 894 | go_out = resolve_go_output_dir(go_root, schema) |
| 895 | if go_out != lang_output_dirs["go"]: |
| 896 | effective_outputs = dict(lang_output_dirs) |
| 897 | effective_outputs["go"] = go_out |
| 898 | |
| 899 | for imp in schema.imports: |
| 900 | import_path = resolve_import_path(imp.path, file_path, import_paths) |
| 901 | if import_path is None: |
| 902 | searched = [str(file_path.parent)] |
| 903 | searched.extend(str(p) for p in import_paths) |
| 904 | line = imp.location.line if imp.location else imp.line |
no test coverage detected