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.swift_lines_of_code,
self.app_gen_options.objc_lines_of_code, self.app_gen_options.loc_json_file_path)
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 workspace & clean')
derived_data_path = join(tempfile.gettempdir(), 'ub_mockapp_derived_data')
shutil.rmtree(derived_data_path, ignore_errors=True)
makedir(derived_data_path)
if self.project_generator_type == "cocoapods":
subprocess.check_call([self.pod_binary, 'install'], cwd=self.mock_output_dir)
if self.full_clean:
self.xcode_manager.clean_caches()
logging.info('Start build')
start = time.time()
with open(build_log_path, 'w') as build_log_file:
if self.project_generator_type == "buck":
subprocess.check_call([self.buck_binary, 'build', '//...'], cwd=self.mock_output_dir)
elif self.project_generator_type == "bazel":
subprocess.check_call(
[self.bazel_binary, 'build', '//...', '--incompatible_require_linker_input_cc_api=false'],
cwd=self.mock_output_dir,
stdout=build_log_file,
stderr=build_log_file)
elif self.project_generator_type == "cocoapods":
subprocess.check_call([
'xcodebuild', 'build', '-scheme', 'AppContainer-App', '-sdk', 'iphonesimulator', '-project',
self.mock_pods_app_project, '-derivedDataPath', derived_data_path
],
stdout=build_log_file,
stderr=build_log_file)
end = time.time()
total_time = int(end - start)
else:
logging.info('Skipping build & project generation')
# 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()