def build_ninja(self): if not os.path.exists(self.workspace.source_dir("ninja")): fatal_error("can't find source directory for ninja " "(tried %s)" % (self.workspace.source_dir("ninja"))) ninja_build = products.Ninja.new_builder( args=self.args, toolchain=self.toolchain, workspace=self.workspace, host=StdlibDeploymentTarget.get_target_for_name( self.args.host_target)) ninja_build.build() self.toolchain.ninja = ninja_build.ninja_bin_path
def execute(self): """Execute the invocation with the configured arguments.""" # Convert to a build-script-impl invocation. (self.impl_env, self.impl_args) = self.convert_to_impl_arguments() # If using the legacy implementation, delegate all behavior to # `build-script-impl`. if self.args.legacy_impl: # Execute the underlying build script implementation. shell.call_without_sleeping([BUILD_SCRIPT_IMPL_PATH] + self.impl_args, env=self.impl_env, echo=True) return # Otherwise, we compute and execute the individual actions ourselves. # Compute the list of hosts to operate on. all_host_names = [self.args.host_target ] + self.args.cross_compile_hosts all_hosts = [ StdlibDeploymentTarget.get_target_for_name(name) for name in all_host_names ] # Compute the list of lists of product classes to operate on. # # FIXME: This should really be per-host, but the current structure # matches that of `build-script-impl`. (product_pipelines, last_impl_index) = self.compute_product_pipelines() # Execute each "product pipeline". for index in range(len(product_pipelines)): perform_epilogue_opts = last_impl_index == index pipeline = product_pipelines[index] # Skip empty pipelines. if len(pipeline) == 0: if perform_epilogue_opts: self._execute_merged_host_lipo_core_action() continue is_impl = pipeline[0].is_build_script_impl_product() if is_impl: self._execute_impl(pipeline, all_hosts, perform_epilogue_opts) else: assert (index != last_impl_index) # Once we have performed our last impl pipeline, we no longer # support cross compilation. # # This just maintains current behavior. if index > last_impl_index: self._execute(pipeline, [self.args.host_target]) else: self._execute(pipeline, all_host_names) # And then perform the rest of the non-core epilogue actions. # Extract symbols... for host_target in all_hosts: self._execute_extract_symbols_action(host_target) # Package... for host_target in all_hosts: self._execute_package_action(host_target) # Lipo... self._execute_merged_host_lipo_action()