示例#1
0
    def compute_host_specific_variables(self):
        """compute_host_specific_variables(args) -> dict

        Compute the host-specific options, organized as a dictionary keyed by
        host of options.
        """

        args = self.args
        args.build_root = self.workspace.build_root

        options = {}
        for host_target in [args.host_target] + args.cross_compile_hosts:
            # Compute the host specific configuration.
            try:
                config = HostSpecificConfiguration(host_target, args)
            except argparse.ArgumentError as e:
                exit_rejecting_arguments(six.text_type(e))

            # Convert into `build-script-impl` style variables.
            options[host_target] = {
                "SWIFT_SDKS": " ".join(sorted(
                    config.sdks_to_configure)),
                "SWIFT_STDLIB_TARGETS": " ".join(
                    config.swift_stdlib_build_targets),
                "SWIFT_BENCHMARK_TARGETS": " ".join(
                    config.swift_benchmark_build_targets),
                "SWIFT_RUN_BENCHMARK_TARGETS": " ".join(
                    config.swift_benchmark_run_targets),
                "SWIFT_TEST_TARGETS": " ".join(
                    config.swift_test_run_targets),
                "SWIFT_FLAGS": config.swift_flags,
                "SWIFT_TARGET_CMAKE_OPTIONS": config.cmake_options,
            }

        return options
示例#2
0
    def _execute_impl(self, pipeline, all_hosts,
                      should_run_epilogue_operations):
        # Build...
        for host_target in all_hosts:
            # FIXME: We should only compute these once.
            try:
                config = HostSpecificConfiguration(host_target.name, self.args)
            except argparse.ArgumentError as e:
                exit_rejecting_arguments(six.text_type(e))
            print("Building the standard library for: {}".format(" ".join(
                config.swift_stdlib_build_targets)))
            if config.swift_test_run_targets and (self.args.test
                                                  or self.args.long_test):
                print("Running Swift tests for: {}".format(" ".join(
                    config.swift_test_run_targets)))
            if config.swift_benchmark_run_targets and self.args.benchmark:
                print("Running Swift benchmarks for: {}".format(" ".join(
                    config.swift_benchmark_run_targets)))

            for product_class in pipeline:
                self._execute_build_action(host_target, product_class)

        # Test...
        for host_target in all_hosts:
            for product_class in pipeline:
                self._execute_test_action(host_target, product_class)

        # Install...
        for host_target in all_hosts:
            for product_class in pipeline:
                self._execute_install_action(host_target, product_class)

        # And then we may be asked to perform several post-processing operations
        # on what we have built. If we are not supposed to do so, bail now.
        if not should_run_epilogue_operations:
            return

        # Core Lipo...
        self._execute_merged_host_lipo_core_action()