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