Inspect marker files and decide whether to reconfigure. Returns a decision struct capturing every reason found so the caller can print a single consolidated message instead of one per marker.
(
*,
build_dir: Path,
markers: MarkerPaths,
hashes: SourceHashes,
debug: bool,
check: bool,
build_mode: str,
enable_examples: bool,
enable_unit_tests: bool,
use_thin_archives: bool,
)
| 158 | |
| 159 | |
| 160 | def check_reconfigure_markers( |
| 161 | *, |
| 162 | build_dir: Path, |
| 163 | markers: MarkerPaths, |
| 164 | hashes: SourceHashes, |
| 165 | debug: bool, |
| 166 | check: bool, |
| 167 | build_mode: str, |
| 168 | enable_examples: bool, |
| 169 | enable_unit_tests: bool, |
| 170 | use_thin_archives: bool, |
| 171 | ) -> ReconfigureDecision: |
| 172 | """Inspect marker files and decide whether to reconfigure. |
| 173 | |
| 174 | Returns a decision struct capturing every reason found so the caller |
| 175 | can print a single consolidated message instead of one per marker. |
| 176 | """ |
| 177 | decision = ReconfigureDecision() |
| 178 | |
| 179 | # SELF-HEALING: introspection corruption marker |
| 180 | intro_corruption_marker = build_dir / ".intro_corruption_detected" |
| 181 | if intro_corruption_marker.exists(): |
| 182 | _ts_print("") |
| 183 | _ts_print("=" * 80) |
| 184 | _ts_print("[MESON] ⚠️ INTROSPECTION FILE CORRUPTION DETECTED - AUTO-HEALING") |
| 185 | _ts_print("=" * 80) |
| 186 | _ts_print("[MESON] Corruption marker detected (created by test discovery)") |
| 187 | _ts_print("[MESON]") |
| 188 | _ts_print( |
| 189 | "[MESON] The build directory has corrupted or missing intro-*.json files." |
| 190 | ) |
| 191 | _ts_print( |
| 192 | "[MESON] These files are required for Meson introspection (test discovery, etc)." |
| 193 | ) |
| 194 | _ts_print("[MESON]") |
| 195 | _ts_print( |
| 196 | "[MESON] 🔧 Auto-fix: Forcing reconfiguration to regenerate intro files" |
| 197 | ) |
| 198 | _ts_print("=" * 80) |
| 199 | _ts_print("") |
| 200 | try: |
| 201 | intro_corruption_marker.unlink() |
| 202 | _ts_print("[MESON] ✅ Removed corruption marker") |
| 203 | except (OSError, IOError) as e: |
| 204 | _ts_print(f"[MESON] Warning: Could not remove corruption marker: {e}") |
| 205 | decision.force_reconfigure = True |
| 206 | decision.force_reason = "introspection files corrupted (auto-healing)" |
| 207 | decision.reasons.append("introspection files corrupted") |
| 208 | |
| 209 | # Thin archive marker |
| 210 | if markers.thin_archive.exists(): |
| 211 | try: |
| 212 | last_thin_setting = markers.thin_archive.read_text().strip() == "True" |
| 213 | if last_thin_setting != use_thin_archives: |
| 214 | decision.reasons.append( |
| 215 | f"thin archive changed: {last_thin_setting} → {use_thin_archives}" |
| 216 | ) |
| 217 | except (OSError, IOError): |
no test coverage detected