Skip to content

Commit e09cb72

Browse files
committed
Leaving the version block at the top of pdl file
1 parent d710cda commit e09cb72

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

scripts/update_cdp.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,12 @@ def old_chrome(chrome_milestone):
6565

6666

6767
def flatten_browser_pdl(file_path, chrome_version):
68-
"""Fetches all included domain .pdl files and concatenates them."""
68+
"""Preserves the version block and concatenates all included domain .pdl files."""
6969
with open(file_path, "r") as file:
7070
content = file.read()
71+
# Extract version block
72+
version_match = re.search(r"(version\s+major\s+\d+\s+minor\s+\d+)", content)
73+
version_block = version_match.group(1) + "\n\n" if version_match else ""
7174
# Find all include lines
7275
includes = re.findall(r"include domains/([A-Za-z0-9_]+\.pdl)", content)
7376
base_url = f"https://raw.githubusercontent.com/chromium/chromium/{chrome_version}/third_party/blink/public/devtools_protocol/domains/"
@@ -76,9 +79,9 @@ def flatten_browser_pdl(file_path, chrome_version):
7679
url = base_url + domain_file
7780
response = http.request("GET", url)
7881
concatenated += response.data.decode("utf-8") + "\n"
79-
# Overwrite the file with concatenated domains
82+
# Overwrite the file with version block + concatenated domains
8083
with open(file_path, "w") as file:
81-
file.write(concatenated)
84+
file.write(version_block + concatenated)
8285

8386

8487
def add_pdls(chrome_milestone):
@@ -231,11 +234,11 @@ def update_js(chrome_milestone):
231234
if __name__ == "__main__":
232235
chrome_milestone = get_chrome_milestone()
233236
add_pdls(chrome_milestone)
234-
update_java(chrome_milestone)
235-
update_dotnet(chrome_milestone)
236-
update_ruby(chrome_milestone)
237+
# update_java(chrome_milestone)
238+
# update_dotnet(chrome_milestone)
239+
# update_ruby(chrome_milestone)
237240
update_python(chrome_milestone)
238-
update_js(chrome_milestone)
241+
# update_js(chrome_milestone)
239242

240243
print(
241244
f"adding CDP {new_chrome(chrome_milestone)} and removing {old_chrome(chrome_milestone)}"

0 commit comments

Comments
 (0)