Adding PRESUBMIT check to avoid mixing C, C++ and Objc-C/Obj-C++.

The error message will be something like:

GN targets cannot mix .c (or .cc) and .m (or .mm) source files.
Please create a separate target for each collection of sources.
Mixed sources:
{
  BUILD_GN_PATH: [
    [
      TARGET_NAME,
      [
        SOURCES
      ]
    ],
    ...
  ],
  ...
}

Bug: webrtc:7743
Change-Id: I45dd2c621b830e5aeb081fa8d17c9497a49c2554
Reviewed-on: https://webrtc-review.googlesource.com/1980
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Henrik Kjellander <kjellander@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#19897}
This commit is contained in:
Mirko Bonadei
2017-09-19 10:41:02 +02:00
committed by Commit Bot
parent 7de1eb7bdc
commit 0c15c5332f
3 changed files with 138 additions and 28 deletions

View File

@ -25,6 +25,15 @@ class MockInputApi(object):
# pylint: disable=unused-argument
return self.files
def ReadFile(self, affected_file, mode='rU'):
filename = affected_file.AbsoluteLocalPath()
for f in self.files:
if f.LocalPath() == filename:
with open(filename, mode) as f:
return f.read()
# Otherwise, file is not in our mock API.
raise IOError, "No such file or directory: '%s'" % filename
class MockOutputApi(object):
"""Mock class for the OutputApi class.
@ -71,3 +80,6 @@ class MockFile(object):
def LocalPath(self):
return self._local_path
def AbsoluteLocalPath(self):
return self._local_path