[presubmit] Add check for DDC's dart:_runtime lib

The logic in one subdirectory of the SDK is being unforked so
we need to ensure changes are mirrored in both directions.

Change-Id: I6485bcafe4ebaf135c5683660e8cac3bd9945033
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143003
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
This commit is contained in:
Nicholas Shahan 2020-04-10 17:52:24 +00:00 committed by commit-bot@chromium.org
parent 1ce773c67f
commit 3b300f519d

View file

@ -38,6 +38,30 @@ def _CheckNnbdSdkSync(input_api, output_api):
return []
def _CheckSdkDdcRuntimeSync(input_api, output_api):
files = [git_file.LocalPath() for git_file in input_api.AffectedTextFiles()]
unsynchronized_files = []
runtime_lib = 'lib/_internal/js_dev_runtime/private/ddc_runtime/'
for nnbd_file in files:
if nnbd_file.startswith('sdk_nnbd/' + runtime_lib):
file = 'sdk/' + runtime_lib + nnbd_file[4:]
if not file in files:
unsynchronized_files.append(file)
if unsynchronized_files:
return [
output_api.PresubmitPromptWarning(
'Changes were made to '
'sdk_nnbd/lib/_internal/js_dev_runtime/private/ddc_runtime/ '
'that were not made to '
'sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/ '
'Please copy those changes (without Null Safety syntax) to '
'these files as well:\n'
'\n'
'%s' % ('\n'.join(unsynchronized_files)))
]
return []
def _CheckNnbdTestSync(input_api, output_api):
"""Make sure that any forked SDK tests are kept in sync. If a CL touches
a test, the test's counterpart (if it exists at all) should be in the CL
@ -316,6 +340,7 @@ def _CheckClangTidy(input_api, output_api):
def _CommonChecks(input_api, output_api):
results = []
results.extend(_CheckNnbdSdkSync(input_api, output_api))
results.extend(_CheckSdkDdcRuntimeSync(input_api, output_api))
results.extend(_CheckNnbdTestSync(input_api, output_api))
results.extend(_CheckValidHostsInDEPS(input_api, output_api))
results.extend(_CheckDartFormat(input_api, output_api))