Advise requested - large namespace change and folder change strategy

75 views
Skip to first unread message

Dan Murphy

unread,
Nov 3, 2025, 4:33:01 PMNov 3
to Chromium-dev
Hey all,

We have long standing bugs to do the following:
- change all `web_app::` namespaces to `webapps::` namespaces
- change all `web_applications` folders to `webapps`.

This has always seemed pretty non-trivial and difficult. But - interested if others have had to do something similar in the past, and what that was like / what worked & didn't work.

I was thinking for the namespace change there could be a two-phase thing, where I could start by having all header files add a 'using webapps;' in the web_apps namespace, then do a change that modifies all of the namespaces (but not callers) and keep the `namespace web_app{ using webapps: }` code in each header, and then do a git-cl-split for the final change to update all callers?

Any nice way to do these in a git-cl-split compatible way? Or other ideas?

Dan

Dmitrii Kuragin

unread,
Nov 28, 2025, 10:16:11 PM (11 hours ago) Nov 28
to dmu...@google.com, Chromium-dev
There `move_source_file.py` which allows to rename.move files and it has some documentation here: https://source.chromium.org/chromium/chromium/src/+/main:docs/ios/working_with_files.md;l=125?q=move_source_file

For the namespace renaming, you can utilize the compilation database generated via src/tools/clang/scripts/generate_compdb.py and `clang-change-namespace` which comes from LibTooling: https://clang.llvm.org/extra/clang-change-namespace.html

I think you can mix and match and get those 2 things done separately. If they end-up trivial refactorings without manual changes, it should be easier to get a global approval. Othersie, you can find the problematic places and fix them first, and submit the large-scale change as a single PR.

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/CA%2B4qT32OD6%2BrzP%3D4CMiWiKUfxEJOZY1%3DL4H-iV2QBChWFJRzCA%40mail.gmail.com.

Daniel Cheng

unread,
12:44 AM (8 hours ago) 12:44 AM
to kur...@chromium.org, dmu...@google.com, Chromium-dev
Introducing shims to allow both names to work is a good idea.

To actually update code to use the new namespace, you shouldn't need clang tooling. For simpler tasks, I have a script that runs ninja in a loop and uses regex to figure out what needs to be searched and replaced to fix the build. So in this case, it should be a simple matter of deleting the compatibility `using webapps;` statements and running the autofix script using the `apply_did_you_mean_fixes` helper that's already in the file.


It does mean you need to run the script across all build configurations that you care about: typically, that's Windows+Mac+Linux+Android+CrOS with DCHECKs on, potentially official builds as well, and occasionally, some of the more esoteric ChromeOS/Fuchsia/Android bots. But the script does a good job of getting you 99.9% of the way there, so just a few manual fixes are needed.

Daniel

Harald Alvestrand

unread,
3:35 AM (5 hours ago) 3:35 AM
to dmu...@google.com, Chromium-dev, Evan Shrubsole
Evan Shrubsole (CCed) completed a similar task for WebRTC a few months ago.
He might have some advice to give and some tools to share.



--
Reply all
Reply to author
Forward
0 new messages