-
Notifications
You must be signed in to change notification settings - Fork 483
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GM3Restyling] Update run command menu
Also add a script that given an image name adds required image paths to devtools_image_files.gni and devtools_grd_files.gni Screenshot: https://imgur.com/a/MaU8tFD Bug: 325442580 Change-Id: I13d1af601c5534507f5303608fc28faf612c7d3a Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6170727 Auto-Submit: Kateryna Prokopenko <[email protected]> Reviewed-by: Kim-Anh Tran <[email protected]> Reviewed-by: Simon Zünd <[email protected]> Commit-Queue: Simon Zünd <[email protected]>
- Loading branch information
Kateryna Prokopenko
authored and
Devtools-frontend LUCI CQ
committed
Jan 16, 2025
1 parent
7a44ab7
commit 3354660
Showing
15 changed files
with
208 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# Copyright 2024 The Chromium Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
import sys | ||
|
||
|
||
def add_image_to_config(image_name): | ||
""" | ||
Adds required image paths to the devtools_grd_files.gni and devtools_image_files.gni. | ||
Args: | ||
image_name: The name of the image file (e.g., "palette"). | ||
""" | ||
|
||
grd_files_path = "config/gni/devtools_grd_files.gni" | ||
image_files_path = "config/gni/devtools_image_files.gni" | ||
|
||
grd_files_line = f' "front_end/Images/{image_name}.svg",' | ||
image_files_line = f' "{image_name}.svg",' | ||
|
||
# --- Update devtools-frontend/config/gni/devtools_grd_files.gni --- | ||
|
||
with open(grd_files_path, "r") as f: | ||
grd_files_lines = f.readlines() | ||
|
||
start_index = grd_files_lines.index("grd_files_release_sources = [\n") + 1 | ||
end_index = grd_files_lines.index("]\n", start_index) | ||
|
||
for i in range(start_index, end_index): | ||
current_file_name = grd_files_lines[i].strip().strip('",') | ||
if current_file_name.startswith("front_end/Images/"): | ||
current_file_name = current_file_name[len("front_end/Images/"):] | ||
if current_file_name > f"{image_name}.svg": | ||
grd_files_lines.insert(i, grd_files_line + "\n") | ||
break | ||
else: | ||
grd_files_lines.insert(end_index, grd_files_line + "\n") | ||
|
||
with open(grd_files_path, "w") as f: | ||
f.writelines(grd_files_lines) | ||
|
||
# --- Update devtools-frontend/config/gni/devtools_image_files.gni --- | ||
|
||
with open(image_files_path, "r") as f: | ||
image_files_lines = f.readlines() | ||
|
||
start_index = image_files_lines.index("devtools_svg_sources = [\n") + 1 | ||
end_index = image_files_lines.index("]\n", start_index) | ||
|
||
for i in range(start_index, end_index): | ||
if image_files_lines[i] > image_files_line: | ||
image_files_lines.insert(i, image_files_line + "\n") | ||
break | ||
else: | ||
image_files_lines.insert(end_index, image_files_line + "\n") | ||
|
||
with open(image_files_path, "w") as f: | ||
f.writelines(image_files_lines) | ||
|
||
|
||
if __name__ == "__main__": | ||
if len(sys.argv) != 2: | ||
print("Usage: python add_icon_paths.py <image_name>") | ||
sys.exit(1) | ||
|
||
image_name = sys.argv[1] | ||
add_image_to_config(image_name) | ||
print(f"Successfully added {image_name} to the configuration files.") |