This skill provides instructions for using tools_webrtc/gn_check_autofix.py to automatically resolve common GN build configuration errors in WebRTC.
When you see “Include not allowed” errors from gn gen --check, use this workflow:
tools_webrtc/gn_check_autofix.py -C <dir>
deps to the appropriate BUILD.gn files.gn format on modified files.If you see “rtc_source_set shall not contain cc files”, the tool will automatically convert them to rtc_library:
tools_webrtc/gn_check_autofix.py -C <dir>
To remove all non-absolute dependencies (those not starting with //) from specific BUILD.gn files:
tools_webrtc/gn_check_autofix.py -r path/to/BUILD.gn
Note: This preserves absolute dependencies (starting with //) and targets ending in _test, _tests, _unittest, or _unittests.
This tool is the recommended second step after running webrtc-include-cleaner. While the include cleaner updates your C++ source files, gn-check-autofix synchronizes your BUILD.gn files to match.
-C <dir>: Path to a local build directory (e.g., out/Default). The tool internally runs gn gen --check --error-limit=20000.-r <files>: Remove all non-absolute dependencies from the specified files.--error-limit: Can be used to override the default error cap.After the tool runs, always verify the changes:
deps list for duplicates.gn gen <dir> to confirm errors are resolved.gn format, but a final git cl format is recommended for consistency.