| OLD | NEW |
| 1 #!/usr/bin/python2.4 | 1 #!/usr/bin/python2.4 |
| 2 # Copyright 2008, Google Inc. | 2 # Copyright 2008, Google Inc. |
| 3 # All rights reserved. | 3 # All rights reserved. |
| 4 # | 4 # |
| 5 # Redistribution and use in source and binary forms, with or without | 5 # Redistribution and use in source and binary forms, with or without |
| 6 # modification, are permitted provided that the following conditions are | 6 # modification, are permitted provided that the following conditions are |
| 7 # met: | 7 # met: |
| 8 # | 8 # |
| 9 # * Redistributions of source code must retain the above copyright | 9 # * Redistributions of source code must retain the above copyright |
| 10 # notice, this list of conditions and the following disclaimer. | 10 # notice, this list of conditions and the following disclaimer. |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 else: | 103 else: |
| 104 # ConcatSource is disabled, so pass through the list of source nodes. | 104 # ConcatSource is disabled, so pass through the list of source nodes. |
| 105 return source | 105 return source |
| 106 | 106 |
| 107 | 107 |
| 108 def generate(env): | 108 def generate(env): |
| 109 # NOTE: SCons requires the use of this name, which fails gpylint. | 109 # NOTE: SCons requires the use of this name, which fails gpylint. |
| 110 """SCons entry point for this tool.""" | 110 """SCons entry point for this tool.""" |
| 111 | 111 |
| 112 # Add the builder | 112 # Add the builder |
| 113 action = SCons.Script.Action(ConcatSourceBuilder, | 113 action = SCons.Script.Action(ConcatSourceBuilder, '$CONCAT_SOURCE_COMSTR', |
| 114 varlist = ['CONCAT_SOURCE_SUFFIXES']) | 114 varlist = ['CONCAT_SOURCE_SUFFIXES']) |
| 115 builder = SCons.Script.Builder(action = action, suffix = '$CXXFILESUFFIX') | 115 builder = SCons.Script.Builder(action = action, suffix = '$CXXFILESUFFIX') |
| 116 env.Append(BUILDERS={'ConcatSourceBuilder': builder}) | 116 env.Append(BUILDERS={'ConcatSourceBuilder': builder}) |
| 117 | 117 |
| 118 # Suffixes of sources we can concatenate. Files not in this list will be | 118 env.SetDefault( |
| 119 # passed through untouched. (Note that on Mac, Objective C/C++ files | 119 CONCAT_SOURCE_COMSTR = 'Creating ConcatSource $TARGET from $SOURCES', |
| 120 # cannot be concatenated with regular C/C++ files.) | 120 # Suffixes of sources we can concatenate. Files not in this list will be |
| 121 # TODO(rspangler): Probably shouldn't mix C, C++ either... | 121 # passed through untouched. (Note that on Mac, Objective C/C++ files |
| 122 env['CONCAT_SOURCE_SUFFIXES'] = ['.c', '.C', '.cxx', '.cpp', '.c++', '.cc', | 122 # cannot be concatenated with regular C/C++ files.) |
| 123 '.h', '.H', '.hxx', '.hpp', '.hh'] | 123 # TODO(rspangler): Probably shouldn't mix C, C++ either... |
| 124 CONCAT_SOURCE_SUFFIXES = ['.c', '.C', '.cxx', '.cpp', '.c++', '.cc', |
| 125 '.h', '.H', '.hxx', '.hpp', '.hh'], |
| 126 ) |
| 124 | 127 |
| 125 # Add a psuedo-builder method which can look at the environment to determine | 128 # Add a psuedo-builder method which can look at the environment to determine |
| 126 # whether to call the ConcatSource builder or not | 129 # whether to call the ConcatSource builder or not |
| 127 env.AddMethod(ConcatSourcePseudoBuilder, 'ConcatSource') | 130 env.AddMethod(ConcatSourcePseudoBuilder, 'ConcatSource') |
| OLD | NEW |