|
18 | 18 | GYB_EXEC = WORKSPACE_DIR + '/swift/utils/gyb'
|
19 | 19 | LIT_EXEC = WORKSPACE_DIR + '/llvm/utils/lit/lit.py'
|
20 | 20 |
|
| 21 | +### Generate Xcode project |
| 22 | + |
| 23 | +def xcode_gen(config): |
| 24 | + print('** Generate SwiftSyntax as an Xcode project **') |
| 25 | + os.chdir(PACKAGE_DIR) |
| 26 | + swiftpm_call = ['swift', 'package', 'generate-xcodeproj'] |
| 27 | + if config: |
| 28 | + swiftpm_call.extend(['--xcconfig-overrides', config]) |
| 29 | + check_call(swiftpm_call) |
| 30 | + |
21 | 31 | ### Generic helper functions
|
22 | 32 |
|
23 | 33 | def printerr(message):
|
@@ -169,7 +179,6 @@ def get_swiftpm_invocation(spm_exec, build_dir, parser_header_dir,
|
169 | 179 | swiftpm_call.extend(['-Xswiftc', '-enforce-exclusivity=unchecked'])
|
170 | 180 | return swiftpm_call
|
171 | 181 |
|
172 |
| - |
173 | 182 | def build_swiftsyntax(swift_build_exec, swiftc_exec, build_dir,
|
174 | 183 | parser_header_dir, parser_lib_dir,
|
175 | 184 | build_test_util, release,
|
@@ -406,6 +415,14 @@ def main():
|
406 | 415 | help='''
|
407 | 416 | Install the build artifact to a specified toolchain directory.
|
408 | 417 | ''')
|
| 418 | + basic_group.add_argument('--generate-xcodeproj', action='store_true', |
| 419 | + help=''' |
| 420 | + Generate an Xcode project for SwiftSyntax. |
| 421 | + ''') |
| 422 | + basic_group.add_argument('--xcconfig-path', |
| 423 | + help=''' |
| 424 | + The path to an xcconfig file for generating Xcode projct. |
| 425 | + ''') |
409 | 426 | basic_group.add_argument('--dylib-dir',
|
410 | 427 | help='''
|
411 | 428 | The directory to where the .dylib should be installed.
|
@@ -488,6 +505,10 @@ def main():
|
488 | 505 | printerr(e.output)
|
489 | 506 | sys.exit(1)
|
490 | 507 |
|
| 508 | + if args.generate_xcodeproj: |
| 509 | + xcode_gen(config=args.xcconfig_path) |
| 510 | + sys.exit(0) |
| 511 | + |
491 | 512 | try:
|
492 | 513 | build_swiftsyntax(swift_build_exec=args.swift_build_exec,
|
493 | 514 | swiftc_exec=args.swiftc_exec,
|
|
0 commit comments