| # Copyright 2025 The Chromium Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| """Presubmit script for ipcz generated & checked-in files. |
| |
| See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
| for more details about the presubmit API built into depot_tools. |
| """ |
| |
| from filecmp import dircmp |
| import os.path |
| import subprocess |
| import tempfile |
| |
| PRESUBMIT_VERSION = '2.0.0' |
| |
| |
| def CheckIpczMessageFilesUpToDate(input_api, output_api): |
| """ |
| Validates that the following generated but checked-in files are up to date: |
| |
| ipcz/node_messages.h |
| ipcz/node_messages.cc |
| ipcz/test_messages.h |
| ipcz/test_messages.cc |
| |
| These files are generated by running: |
| |
| python3 third_party/ipcz/src/ipcz/node_messages.py --dir third_party/ipcz/src/ipcz |
| |
| Files are generated from the following templates: |
| |
| ipcz/node_messages.h.tmpl |
| ipcz/node_messages.cc.tmpl |
| |
| Data used to populate the templates is contained in: |
| |
| ipcz/node_messages_generator.h |
| ipcz/test_messages_generator.h |
| """ |
| generate_script = os.path.join(input_api.PresubmitLocalPath(), |
| 'ipcz/node_messages.py') |
| messages_dir = os.path.join(input_api.PresubmitLocalPath(), 'ipcz') |
| subprocess.run( |
| ['python3', generate_script, '--dir', messages_dir, '--check'], |
| check=True) |
| return [] |