Skip to content

[Build Script] Pass down a CMake path to swift-driver's build script #33918

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 29, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,21 @@
#
# ----------------------------------------------------------------------------

import os

from . import cmark
from . import foundation
from . import indexstoredb
from . import libcxx
from . import libdispatch
from . import libicu
from . import llbuild
from . import llvm
from . import product
from . import swift
from . import swiftpm
from . import xctest
from .. import shell
from .. import targets


class SwiftDriver(product.Product):
Expand Down Expand Up @@ -51,24 +55,48 @@ def should_clean(self, host_target):
return self.args.clean_swift_driver

def clean(self, host_target):
indexstoredb.run_build_script_helper(
'clean', host_target, self, self.args)
run_build_script_helper('clean', host_target, self, self.args)

def build(self, host_target):
indexstoredb.run_build_script_helper(
'build', host_target, self, self.args)
run_build_script_helper('build', host_target, self, self.args)

def should_test(self, host_target):
return self.args.test_swift_driver

def test(self, host_target):
indexstoredb.run_build_script_helper(
'test', host_target, self, self.args,
self.args.test_sourcekitlsp_sanitize_all)
run_build_script_helper('test', host_target, self, self.args)

def should_install(self, host_target):
return self.args.install_swift_driver

def install(self, host_target):
indexstoredb.run_build_script_helper(
'install', host_target, self, self.args)
run_build_script_helper('install', host_target, self, self.args)


def run_build_script_helper(action, host_target, product, args):
script_path = os.path.join(
product.source_dir, 'Utilities', 'build-script-helper.py')

install_destdir = args.install_destdir
if swiftpm.SwiftPM.has_cross_compile_hosts(args):
install_destdir = swiftpm.SwiftPM.get_install_destdir(args,
host_target,
product.build_dir)
toolchain_path = targets.toolchain_path(install_destdir,
args.install_prefix)
is_release = product.is_release()
configuration = 'release' if is_release else 'debug'
helper_cmd = [
script_path,
action,
'--package-path', product.source_dir,
'--build-path', product.build_dir,
'--configuration', configuration,
'--toolchain', toolchain_path,
'--ninja-bin', product.toolchain.ninja,
'--cmake-bin', product.toolchain.cmake,
]
if args.verbose_build:
helper_cmd.append('--verbose')

shell.call(helper_cmd)