Skip to content

Commit 13f6885

Browse files
authored
Merge pull request #32257 from gottesmm/pr-dd4cc86c522d759700beda988e9a24d036c56706
[build-script] Define default llvm_install_components.
2 parents bd6abc9 + 00146f8 commit 13f6885

File tree

4 files changed

+27
-1
lines changed

4 files changed

+27
-1
lines changed

utils/build-script

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,11 @@ class BuildScriptInvocation(object):
752752
os.path.abspath(args.coverage_db)
753753
]
754754

755+
if args.llvm_install_components:
756+
impl_args += [
757+
"--llvm-install-components=%s" % args.llvm_install_components
758+
]
759+
755760
# Compute the set of host-specific variables, which we pass through to
756761
# the build script via environment variables.
757762
host_specific_variables = self.compute_host_specific_variables()

utils/build_swift/build_swift/defaults.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
from __future__ import absolute_import, unicode_literals
1616

17+
import os
1718
import platform
1819

1920
from . import shell
@@ -113,6 +114,19 @@ def _default_swift_lto_link_jobs():
113114
SWIFT_MAX_PARALLEL_LTO_LINK_JOBS = _default_swift_lto_link_jobs()
114115

115116

117+
def llvm_install_components():
118+
"""Convenience function for getting the default llvm install components for
119+
platforms.
120+
"""
121+
components = ['llvm-cov', 'llvm-profdata', 'IndexStore', 'clang',
122+
'clang-resource-headers', 'compiler-rt', 'clangd']
123+
if os.sys.platform == 'darwin':
124+
components.extend(['llvm-dsymutil'])
125+
else:
126+
components.extend(['lld'])
127+
return ';'.join(components)
128+
129+
116130
# Options that can only be "configured" by editing this file.
117131
#
118132
# These options are not exposed as command line options on purpose. If you

utils/build_swift/build_swift/driver_arguments.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,10 @@ def create_argument_parser():
497497
option('--coverage-db', store_path,
498498
help='coverage database to use when prioritizing testing')
499499

500+
option('--llvm-install-components', store,
501+
default=defaults.llvm_install_components(),
502+
help='A semi-colon split list of llvm components to install')
503+
500504
# -------------------------------------------------------------------------
501505
in_group('Host and cross-compilation targets')
502506

utils/build_swift/tests/expected_options.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,8 @@
236236
'validation_test': None,
237237
'verbose_build': False,
238238
'watchos': False,
239-
'watchos_all': False
239+
'watchos_all': False,
240+
'llvm_install_components': defaults.llvm_install_components(),
240241
}
241242

242243

@@ -675,4 +676,6 @@ class BuildScriptImplOption(_BaseOption):
675676
IgnoreOption('--ios-all'),
676677
IgnoreOption('--tvos-all'),
677678
IgnoreOption('--watchos-all'),
679+
680+
StrOption('--llvm-install-components'),
678681
]

0 commit comments

Comments
 (0)