Save binary fingerprints of fastled shared library and all DLLs to the cache file. Called after each successful build to prepare for the next run's optimization.
(self, build_dir: Path)
| 141 | return touched |
| 142 | |
| 143 | def save_fingerprints(self, build_dir: Path) -> None: |
| 144 | """ |
| 145 | Save binary fingerprints of fastled shared library and all DLLs to the cache file. |
| 146 | Called after each successful build to prepare for the next run's optimization. |
| 147 | """ |
| 148 | lib_path = build_dir / _LIBFASTLED_REL_PATH |
| 149 | data: dict = { |
| 150 | "libfastled_hash": "", |
| 151 | "dll_hashes": {}, |
| 152 | } |
| 153 | |
| 154 | if lib_path.exists(): |
| 155 | data["libfastled_hash"] = _hash_file(lib_path) |
| 156 | |
| 157 | dll_hashes: dict[str, str] = {} |
| 158 | for dll_path in _find_dlls(build_dir): |
| 159 | h = _hash_file(dll_path) |
| 160 | if h: |
| 161 | dll_hashes[str(dll_path)] = h |
| 162 | data["dll_hashes"] = dll_hashes |
| 163 | |
| 164 | try: |
| 165 | self._cache_file.parent.mkdir(parents=True, exist_ok=True) |
| 166 | with open(self._cache_file, "w", encoding="utf-8") as f: |
| 167 | json.dump(data, f, indent=2) |
| 168 | except OSError: |
| 169 | pass |
| 170 | |
| 171 | |
| 172 | def make_build_optimizer( |
no test coverage detected