in uberpoet/multisuite.py [0:0]
def build_app_type(self, gen_type, wmo_enabled):
xcode_version, xcode_build_id = XcodeManager.get_current_xcode_version()
xcode_name = '{}_'.format(xcode_version.replace('.', '_'))
build_log_path = join(self.log_dir, '{}{}_mockapp_build_log.txt'.format(xcode_name, gen_type))
gen_info = '{} (wmo_enabled: {}, xcode_version: {} {})'.format(gen_type, wmo_enabled, xcode_version,
xcode_build_id)
logging.info('##### Generating %s', gen_info)
self.project_generator.use_wmo = wmo_enabled
commandlineutil.del_old_output_dir(self.mock_output_dir)
logging.info('Generating mock app')
app_node, node_list = commandlineutil.gen_graph(gen_type, self.app_gen_options)
self.project_generator.gen_app(app_node, node_list, self.app_gen_options.lines_of_code)
swift_loc = commandlineutil.count_loc(self.mock_output_dir)
logging.info('App type "%s" generated %d loc', gen_type, swift_loc)
# Build App
total_time = 0
if self.run_xcodebuild:
logging.info('Generate xcode workspace & clean')
derived_data_path = join(tempfile.gettempdir(), 'ub_mockapp_derived_data')
shutil.rmtree(derived_data_path, ignore_errors=True)
makedir(derived_data_path)
subprocess.check_call([self.buck_binary, 'project', self.app_buck_path, '-d'])
if self.full_clean:
self.xcode_manager.clean_caches()
logging.info('Start xcodebuild')
start = time.time()
with open(build_log_path, 'w') as build_log_file:
subprocess.check_call([
'xcodebuild', 'build', '-scheme', 'MockApp', '-sdk', 'iphonesimulator', '-workspace',
self.mock_app_workspace, '-derivedDataPath', derived_data_path
],
stdout=build_log_file,
stderr=build_log_file)
end = time.time()
total_time = int(end - start)
else:
logging.info('Skipping xcodebuild & buck project')
# Log Results
build_end = str(datetime.datetime.now())
log_statement = '{} w/ {} (loc: {}) modules took {} s\n'.format(gen_info, len(node_list), swift_loc, total_time)
logging.info(log_statement)
self.build_time_file.write(log_statement)
self.build_time_file.flush()
full_xcode_version = xcode_version + " " + xcode_build_id
self.build_time_csv_file.write('{}, {}, {}, {}, {}, {}, {}\n'.format(
build_end, gen_type, full_xcode_version, wmo_enabled, total_time, len(node_list), swift_loc))
self.build_time_csv_file.flush()