Skip to content

[Build Script Helper] Add an option that indicates the driver is being built for use with a local just-built frontend #537

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
Apr 7, 2021
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
19 changes: 14 additions & 5 deletions Utilities/build-script-helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,12 @@ def build_using_cmake(args, toolchain_bin, build_dir, targets):
base_cmake_flags.append('-DCMAKE_OSX_DEPLOYMENT_TARGET=%s' % macos_deployment_target)

# Target directory for build artifacts
cmake_target_dir = os.path.join(build_dir, target)
# If building for a local compiler build, use the build directory directly
if args.local_compiler_build:
cmake_target_dir = build_dir
else:
cmake_target_dir = os.path.join(build_dir, target)

driver_dir = os.path.join(cmake_target_dir, args.configuration)
dependencies_dir = os.path.join(driver_dir, 'dependencies')

Expand All @@ -426,7 +431,7 @@ def build_using_cmake(args, toolchain_bin, build_dir, targets):
base_cmake_flags, swift_flags)

def build_llbuild_using_cmake(args, target, swiftc_exec, build_dir, base_cmake_flags, swift_flags):
print('Building llbuild for target: %s' % target)
print('Building Swift Driver dependency: llbuild')
llbuild_source_dir = os.path.join(os.path.dirname(args.package_path), 'llbuild')
llbuild_build_dir = os.path.join(build_dir, 'llbuild')
llbuild_api_dir = os.path.join(llbuild_build_dir, '.cmake/api/v1/query')
Expand Down Expand Up @@ -454,15 +459,15 @@ def build_llbuild_using_cmake(args, target, swiftc_exec, build_dir, base_cmake_f
llbuild_source_dir, llbuild_build_dir, 'products/all')

def build_tsc_using_cmake(args, target, swiftc_exec, build_dir, base_cmake_flags, swift_flags):
print('Building TSC for target: %s' % target)
print('Building Swift Driver dependency: TSC')
tsc_source_dir = os.path.join(os.path.dirname(args.package_path), 'swift-tools-support-core')
tsc_build_dir = os.path.join(build_dir, 'swift-tools-support-core')
tsc_swift_flags = swift_flags[:]
cmake_build(args, swiftc_exec, base_cmake_flags, tsc_swift_flags,
tsc_source_dir, tsc_build_dir)

def build_yams_using_cmake(args, target, swiftc_exec, build_dir, base_cmake_flags, swift_flags):
print('Building Yams for target: %s' % target)
print('Building Swift Driver dependency: Yams')
yams_source_dir = os.path.join(os.path.dirname(args.package_path), 'yams')
yams_build_dir = os.path.join(build_dir, 'yams')
yams_cmake_flags = base_cmake_flags + [
Expand All @@ -484,7 +489,7 @@ def build_yams_using_cmake(args, target, swiftc_exec, build_dir, base_cmake_flag
yams_source_dir, yams_build_dir)

def build_argument_parser_using_cmake(args, target, swiftc_exec, build_dir, base_cmake_flags, swift_flags):
print('Building Argument Parser for target: %s' % target)
print('Building Swift Driver dependency: Argument Parser')
parser_source_dir = os.path.join(os.path.dirname(args.package_path), 'swift-argument-parser')
parser_build_dir = os.path.join(build_dir, 'swift-argument-parser')
custom_flags = ['-DBUILD_TESTING=NO', '-DBUILD_EXAMPLES=NO']
Expand Down Expand Up @@ -586,6 +591,7 @@ def add_common_args(parser):
parser.add_argument('--configuration', '-c', default='debug', help='build using configuration (release|debug)')
parser.add_argument('--no-local-deps', action='store_true', help='use normal remote dependencies when building')
parser.add_argument('--verbose', '-v', action='store_true', help='enable verbose output')
parser.add_argument('--local_compiler_build', action='store_true', help='driver is being built for use with a local compiler build')

subparsers = parser.add_subparsers(title='subcommands', dest='action', metavar='action')
clean_parser = subparsers.add_parser('clean', help='clean the package')
Expand Down Expand Up @@ -615,6 +621,9 @@ def add_common_args(parser):
if args.cross_compile_hosts and not all('apple-macos' in target for target in args.cross_compile_hosts):
error('Cross-compilation is currently only supported for the Darwin platform.')

if args.cross_compile_hosts and args.local_compiler_build:
error('Cross-compilation is currently not supported for the local compiler installation')

if args.dispatch_build_dir:
args.dispatch_build_dir = os.path.abspath(args.dispatch_build_dir)

Expand Down