From dac3e879c56a50696a36f53e1e5e353e48fa665f Mon Sep 17 00:00:00 2001 From: "zhanyong.wan" Date: Tue, 14 Sep 2010 05:35:59 +0000 Subject: Include gtest headers as user headers instead of system headers. --- scripts/fuse_gtest_files.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'scripts/fuse_gtest_files.py') diff --git a/scripts/fuse_gtest_files.py b/scripts/fuse_gtest_files.py index 148444ca..57ef72f0 100755 --- a/scripts/fuse_gtest_files.py +++ b/scripts/fuse_gtest_files.py @@ -67,8 +67,8 @@ import sys # Test root directory. DEFAULT_GTEST_ROOT_DIR = os.path.join(os.path.dirname(__file__), '..') -# Regex for matching '#include '. -INCLUDE_GTEST_FILE_REGEX = re.compile(r'^\s*#\s*include\s*<(gtest/.+)>') +# Regex for matching '#include "gtest/..."'. +INCLUDE_GTEST_FILE_REGEX = re.compile(r'^\s*#\s*include\s*"(gtest/.+)"') # Regex for matching '#include "src/..."'. INCLUDE_SRC_FILE_REGEX = re.compile(r'^\s*#\s*include\s*"(src/.+)"') @@ -162,7 +162,7 @@ def FuseGTestH(gtest_root, output_dir): for line in file(os.path.join(gtest_root, gtest_header_path), 'r'): m = INCLUDE_GTEST_FILE_REGEX.match(line) if m: - # It's '#include ' - let's process it recursively. + # It's '#include "gtest/..."' - let's process it recursively. ProcessFile('include/' + m.group(1)) else: # Otherwise we copy the line unchanged to the output file. @@ -191,19 +191,19 @@ def FuseGTestAllCcToFile(gtest_root, output_file): m = INCLUDE_GTEST_FILE_REGEX.match(line) if m: if 'include/' + m.group(1) == GTEST_SPI_H_SEED: - # It's '#include '. This file is not - # #included by , so we need to process it. + # It's '#include "gtest/gtest-spi.h"'. This file is not + # #included by "gtest/gtest.h", so we need to process it. ProcessFile(GTEST_SPI_H_SEED) else: - # It's '#include ' where foo is not gtest-spi. - # We treat it as '#include ', as all other + # It's '#include "gtest/foo.h"' where foo is not gtest-spi. + # We treat it as '#include "gtest/gtest.h"', as all other # gtest headers are being fused into gtest.h and cannot be # #included directly. - # There is no need to #include more than once. + # There is no need to #include "gtest/gtest.h" more than once. if not GTEST_H_SEED in processed_files: processed_files.add(GTEST_H_SEED) - output_file.write('#include <%s>\n' % (GTEST_H_OUTPUT,)) + output_file.write('#include "%s"\n' % (GTEST_H_OUTPUT,)) else: m = INCLUDE_SRC_FILE_REGEX.match(line) if m: -- cgit v1.2.3