| 300 | |
| 301 | |
| 302 | def update_docs_readme(docs_output_dir: Path, section: str) -> Path: |
| 303 | docs_readme = docs_output_dir / "README.md" |
| 304 | if docs_readme.exists(): |
| 305 | content = docs_readme.read_text(encoding="utf-8").rstrip() |
| 306 | marker = "\n## Xlang Benchmark\n" |
| 307 | if marker in content: |
| 308 | prefix = content.split(marker, 1)[0].rstrip() |
| 309 | content = prefix + "\n\n" + section |
| 310 | else: |
| 311 | content = content + "\n\n" + section |
| 312 | else: |
| 313 | content = "# Java Benchmarks\n\n" + section |
| 314 | docs_readme.write_text(content.rstrip() + "\n", encoding="utf-8") |
| 315 | run_prettier(docs_readme) |
| 316 | return docs_readme |
| 317 | |
| 318 | |
| 319 | def run_prettier(path: Path) -> None: |