From 3b300f519d5e5ede9d771a575e55e7498671ae8d Mon Sep 17 00:00:00 2001 From: Nicholas Shahan Date: Fri, 10 Apr 2020 17:52:24 +0000 Subject: [PATCH] [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 Commit-Queue: Nicholas Shahan --- PRESUBMIT.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/PRESUBMIT.py b/PRESUBMIT.py index 99a82f2ea4c..4cbffadba94 100644 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -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))