| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import copy | 5 import copy |
| 6 | 6 |
| 7 from slave import recipe_api | 7 from slave import recipe_api |
| 8 | 8 |
| 9 | 9 |
| 10 class iOSApi(recipe_api.RecipeApi): | 10 class iOSApi(recipe_api.RecipeApi): |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 'configuration', | 116 'configuration', |
| 117 'sdk', | 117 'sdk', |
| 118 ): | 118 ): |
| 119 self.__config[key] = parent_config[key] | 119 self.__config[key] = parent_config[key] |
| 120 | 120 |
| 121 # We set some default GYP_DEFINES so developers don't have to set them | 121 # We set some default GYP_DEFINES so developers don't have to set them |
| 122 # manually on every bot. Add them in here. | 122 # manually on every bot. Add them in here. |
| 123 self.__config['GYP_DEFINES']['component'] = 'static_library' | 123 self.__config['GYP_DEFINES']['component'] = 'static_library' |
| 124 self.__config['GYP_DEFINES']['OS'] = 'ios' | 124 self.__config['GYP_DEFINES']['OS'] = 'ios' |
| 125 | 125 |
| 126 # Because build configs are only required to specify "triggered bots" or | 126 # In order to simplify the code that uses the values of self.__config, here |
| 127 # "tests", one of them may not be specified. In order to simplify the code | 127 # we default to empty values of their respective types, so in other places |
| 128 # that uses the values of self.__config, here we default them both to empty | 128 # we can iterate over them without having to check if they are in the dict |
| 129 # values of their respective types, so in other places we can iterate over | 129 # at all. |
| 130 # them without having to check if they are in the dict at all. | |
| 131 self.__config['triggered bots'] = self.__config.get('triggered bots', {}) | 130 self.__config['triggered bots'] = self.__config.get('triggered bots', {}) |
| 132 self.__config['tests'] = self.__config.get('tests', []) | 131 self.__config['tests'] = self.__config.get('tests', []) |
| 132 self.__config['env'] = self.__config.get('env', {}) |
| 133 | 133 |
| 134 # Elements of the "tests" list are dicts. There are two types of elements, | 134 # Elements of the "tests" list are dicts. There are two types of elements, |
| 135 # determined by the presence of one of these mutually exclusive keys: | 135 # determined by the presence of one of these mutually exclusive keys: |
| 136 # "app": This says to run a particular app. | 136 # "app": This says to run a particular app. |
| 137 # "include": This says to include a common set of tests from include_dir. | 137 # "include": This says to include a common set of tests from include_dir. |
| 138 # So now we go through the "tests" list replacing any "include" keys. | 138 # So now we go through the "tests" list replacing any "include" keys. |
| 139 # The value of an "include" key is the name of a set of tests to include, | 139 # The value of an "include" key is the name of a set of tests to include, |
| 140 # which can be found as a .json file in include_dir. Read the contents | 140 # which can be found as a .json file in include_dir. Read the contents |
| 141 # lazily as needed into includes. | 141 # lazily as needed into includes. |
| 142 def read_include(includes): | 142 def read_include(includes): |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 # Add the default GYP_DEFINES. | 217 # Add the default GYP_DEFINES. |
| 218 gyp_defines = [ | 218 gyp_defines = [ |
| 219 '%s=%s' % (k, v) for k, v in self.__config['GYP_DEFINES'].iteritems() | 219 '%s=%s' % (k, v) for k, v in self.__config['GYP_DEFINES'].iteritems() |
| 220 ] | 220 ] |
| 221 | 221 |
| 222 env = { | 222 env = { |
| 223 'GYP_DEFINES': ' '.join(gyp_defines), | 223 'GYP_DEFINES': ' '.join(gyp_defines), |
| 224 'LANDMINES_VERBOSE': '1', | 224 'LANDMINES_VERBOSE': '1', |
| 225 } | 225 } |
| 226 | 226 |
| 227 # Add extra env variables. |
| 228 env.update(self.__config['env']) |
| 229 |
| 227 if self.compiler == 'xcodebuild': | 230 if self.compiler == 'xcodebuild': |
| 228 env['GYP_GENERATORS'] = 'xcode' | 231 env['GYP_GENERATORS'] = 'xcode' |
| 229 env['GYP_GENERATOR_FLAGS'] = 'xcode_project_version=3.2' | 232 env['GYP_GENERATOR_FLAGS'] = 'xcode_project_version=3.2' |
| 230 cwd = self.m.path['checkout'].join('xcodebuild') | 233 cwd = self.m.path['checkout'].join('xcodebuild') |
| 231 cmd = [ | 234 cmd = [ |
| 232 'xcodebuild', | 235 'xcodebuild', |
| 233 '-configuration', self.configuration, | 236 '-configuration', self.configuration, |
| 234 '-project', self.m.path['checkout'].join( | 237 '-project', self.m.path['checkout'].join( |
| 235 'build', | 238 'build', |
| 236 'all.xcodeproj', | 239 'all.xcodeproj', |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 self.configuration, | 429 self.configuration, |
| 427 'iossim', | 430 'iossim', |
| 428 ), | 431 ), |
| 429 'ninja': self.m.path.join( | 432 'ninja': self.m.path.join( |
| 430 'src', | 433 'src', |
| 431 build_dir, | 434 build_dir, |
| 432 '%s-%s' % (self.configuration, platform), | 435 '%s-%s' % (self.configuration, platform), |
| 433 'iossim', | 436 'iossim', |
| 434 ), | 437 ), |
| 435 }[self.compiler] | 438 }[self.compiler] |
| OLD | NEW |