(chrome_milestone)
| 96 | |
| 97 | |
| 98 | def add_pdls(chrome_milestone): |
| 99 | source_dir = root_dir / f"common/devtools/chromium/v{previous_chrome(chrome_milestone)}" |
| 100 | target_dir = root_dir / f"common/devtools/chromium/v{new_chrome(chrome_milestone)}" |
| 101 | old_dir = root_dir / f"common/devtools/chromium/v{old_chrome(chrome_milestone)}" |
| 102 | |
| 103 | if os.path.isdir(old_dir): |
| 104 | shutil.rmtree(old_dir) |
| 105 | |
| 106 | if not target_dir.is_dir() or not any(target_dir.iterdir()): |
| 107 | os.makedirs(target_dir, exist_ok=True) |
| 108 | if os.path.isdir(source_dir): |
| 109 | shutil.copytree(source_dir, target_dir, dirs_exist_ok=True) |
| 110 | |
| 111 | fetch_and_save( |
| 112 | f"https://api.github.com/repos/chromium/chromium/contents/third_party/blink/public/devtools_protocol/browser_protocol.pdl?ref={chrome_milestone['version']}", |
| 113 | f"{target_dir}/browser_protocol.pdl", |
| 114 | ) |
| 115 | |
| 116 | flatten_browser_pdl(f"{target_dir}/browser_protocol.pdl", chrome_milestone["version"]) |
| 117 | |
| 118 | deps_content = github_fetch( |
| 119 | f"https://api.github.com/repos/chromium/chromium/contents/DEPS?ref={chrome_milestone['version']}" |
| 120 | ).decode("utf-8") |
| 121 | v8_revision_line = next((line for line in deps_content.split("\n") if "v8_revision" in line), None) |
| 122 | if v8_revision_line is None: |
| 123 | raise ValueError(f"No v8_revision found in DEPS for Chrome {chrome_milestone['version']}") |
| 124 | v8_revision = v8_revision_line.split(": ")[1].strip("',") |
| 125 | fetch_and_save( |
| 126 | f"https://api.github.com/repos/v8/v8/contents/include/js_protocol.pdl?ref={v8_revision}", |
| 127 | f"{target_dir}/js_protocol.pdl", |
| 128 | ) |
| 129 | |
| 130 | # javadocs does not like script tags |
| 131 | with open(f"{target_dir}/browser_protocol.pdl", "r+") as file: |
| 132 | script_replace = file.read().replace("`<script>`", "`script`") |
| 133 | file.seek(0) |
| 134 | file.write(script_replace) |
| 135 | file.truncate() |
| 136 | |
| 137 | |
| 138 | def create_new_chrome_files(src_base, chrome_milestone): |
no test coverage detected