Skip to content

Commit 7ffd4e2

Browse files
authored
Merge pull request #21 from apple/master
[pull] swiftwasm from apple:master
2 parents 39433b8 + e26b216 commit 7ffd4e2

File tree

7 files changed

+88
-2
lines changed

7 files changed

+88
-2
lines changed

utils/build-script

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ class BuildScriptInvocation(object):
138138

139139
targets_needing_toolchain = [
140140
'build_indexstoredb',
141+
'build_pythonkit',
141142
'build_sourcekitlsp',
142143
'build_toolchainbenchmarks',
143144
'tsan_libdispatch_test',
@@ -188,7 +189,8 @@ class BuildScriptInvocation(object):
188189
# Infer if ninja is required
189190
ninja_required = (
190191
args.cmake_generator == 'Ninja' or args.build_foundation or
191-
args.build_sourcekitlsp or args.build_indexstoredb)
192+
args.build_pythonkit or args.build_sourcekitlsp or
193+
args.build_indexstoredb)
192194
if ninja_required and toolchain.ninja is None:
193195
args.build_ninja = True
194196

@@ -770,6 +772,8 @@ class BuildScriptInvocation(object):
770772
product_classes.append(products.SwiftEvolve)
771773
if self.args.build_indexstoredb:
772774
product_classes.append(products.IndexStoreDB)
775+
if self.args.build_pythonkit:
776+
product_classes.append(products.PythonKit)
773777
if self.args.build_sourcekitlsp:
774778
product_classes.append(products.SourceKitLSP)
775779
if self.args.build_toolchainbenchmarks:

utils/build_swift/build_swift/driver_arguments.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ def _apply_default_arguments(args):
153153
args.build_libdispatch = False
154154
args.build_libicu = False
155155
args.build_playgroundsupport = False
156+
args.build_pythonkit = False
156157

157158
# --skip-{ios,tvos,watchos} or --skip-build-{ios,tvos,watchos} are
158159
# merely shorthands for --skip-build-{**os}-{device,simulator}
@@ -611,6 +612,8 @@ def create_argument_parser():
611612
toggle_true('swiftsyntax_verify_generated_files'),
612613
help='set to verify that the generated files in the source tree '
613614
'match the ones that would be generated from current master')
615+
option(['--install-pythonkit'], toggle_true('install_pythonkit'),
616+
help='install PythonKit')
614617
option(['--install-sourcekit-lsp'], toggle_true('install_sourcekitlsp'),
615618
help='install SourceKitLSP')
616619
option(['--install-skstresstester'], toggle_true('install_skstresstester'),
@@ -637,6 +640,9 @@ def create_argument_parser():
637640
option('--playgroundsupport', store_true('build_playgroundsupport'),
638641
help='build PlaygroundSupport')
639642

643+
option('--pythonkit', store_true('build_pythonkit'),
644+
help='build PythonKit')
645+
640646
option('--build-ninja', toggle_true,
641647
help='build the Ninja tool')
642648

@@ -886,6 +892,9 @@ def create_argument_parser():
886892
option('--skip-test-cygwin', toggle_false('test_cygwin'),
887893
help='skip testing Swift stdlibs for Cygwin')
888894

895+
option('--test-pythonkit', toggle_true('test_pythonkit'),
896+
help='skip testing PythonKit')
897+
889898
# -------------------------------------------------------------------------
890899
in_group('Run build')
891900

utils/build_swift/tests/expected_options.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
'build_ninja': False,
7777
'build_osx': True,
7878
'build_playgroundsupport': False,
79+
'build_pythonkit': False,
7980
'build_runtime_with_host_compiler': False,
8081
'build_stdlib_deployment_targets': ['all'],
8182
'build_subdir': None,
@@ -94,6 +95,7 @@
9495
'install_swiftpm': False,
9596
'install_swiftsyntax': False,
9697
'swiftsyntax_verify_generated_files': False,
98+
'install_pythonkit': False,
9799
'install_sourcekitlsp': False,
98100
'install_skstresstester': False,
99101
'install_swiftevolve': False,
@@ -207,6 +209,7 @@
207209
'test_optimized': None,
208210
'test_osx': False,
209211
'test_paths': [],
212+
'test_pythonkit': False,
210213
'test_tvos': False,
211214
'test_tvos_host': False,
212215
'test_tvos_simulator': False,
@@ -446,6 +449,9 @@ class BuildScriptImplOption(_BaseOption):
446449
SetTrueOption('--maccatalyst', dest='maccatalyst'),
447450
SetTrueOption('--maccatalyst-ios-tests', dest='maccatalyst_ios_tests'),
448451
SetTrueOption('--playgroundsupport', dest='build_playgroundsupport'),
452+
SetTrueOption('--pythonkit', dest='build_pythonkit'),
453+
SetTrueOption('--install-pythonkit', dest='install_pythonkit'),
454+
SetTrueOption('--test-pythonkit', dest='test_pythonkit'),
449455
SetTrueOption('--skip-build'),
450456
SetTrueOption('--swiftpm', dest='build_swiftpm'),
451457
SetTrueOption('--swiftsyntax', dest='build_swiftsyntax'),

utils/swift_build_support/swift_build_support/products/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from .lldb import LLDB
2222
from .llvm import LLVM
2323
from .ninja import Ninja
24+
from .pythonkit import PythonKit
2425
from .skstresstester import SKStressTester
2526
from .sourcekitlsp import SourceKitLSP
2627
from .swift import Swift
@@ -41,6 +42,7 @@
4142
'LLDB',
4243
'LLVM',
4344
'Ninja',
45+
'PythonKit',
4446
'Swift',
4547
'SwiftPM',
4648
'XCTest',
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# swift_build_support/products/pythonkit.py ---------------------*- python -*-
2+
#
3+
# This source file is part of the Swift.org open source project
4+
#
5+
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
6+
# Licensed under Apache License v2.0 with Runtime Library Exception
7+
#
8+
# See https://swift.org/LICENSE.txt for license information
9+
# See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
#
11+
# ----------------------------------------------------------------------------
12+
13+
from . import product
14+
from .. import shell
15+
16+
17+
class PythonKit(product.Product):
18+
@classmethod
19+
def product_source_name(cls):
20+
return "PythonKit"
21+
22+
@classmethod
23+
def is_build_script_impl_product(cls):
24+
return False
25+
26+
def should_build(self, host_target):
27+
return True
28+
29+
def build(self, host_target):
30+
shell.call([
31+
self.toolchain.cmake,
32+
'-G', 'Ninja',
33+
'-D', 'BUILD_SHARED_LIBS=YES',
34+
'-D', 'CMAKE_INSTALL_PREFIX={}/usr'.format(
35+
self.args.install_destdir),
36+
'-D', 'CMAKE_MAKE_PROGRAM={}'.format(self.toolchain.ninja),
37+
'-D', 'CMAKE_Swift_COMPILER={}'.format(self.toolchain.swiftc),
38+
'-B', self.build_dir,
39+
'-S', self.source_dir,
40+
])
41+
shell.call([
42+
self.toolchain.cmake,
43+
'--build', self.build_dir,
44+
])
45+
46+
def should_test(self, host_target):
47+
return self.args.test_pythonkit
48+
49+
def test(self, host_target):
50+
pass
51+
52+
def should_install(self, host_target):
53+
return self.args.install_pythonkit
54+
55+
def install(self, host_target):
56+
shell.call([
57+
self.toolchain.cmake,
58+
'--build', self.build_dir,
59+
'--target', 'install',
60+
])

utils/swift_build_support/swift_build_support/toolchain.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def _getter(self):
6262
_register("llvm_cov", "llvm-cov")
6363
_register("lipo", "lipo")
6464
_register("libtool", "libtool")
65+
_register("swiftc", "swiftc")
6566

6667

6768
class Darwin(Toolchain):

utils/update_checkout/update-checkout-config.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
"remote": { "id": "KitWare/CMake" },
3636
"platforms": [ "Linux" ]
3737
},
38+
"pythonkit": {
39+
"remote": { "id": "pvieito/PythonKit" }
40+
},
3841
"indexstore-db": {
3942
"remote": { "id": "apple/indexstore-db" } },
4043
"sourcekit-lsp": {
@@ -90,7 +93,8 @@
9093
"cmake": "v3.15.1",
9194
"indexstore-db": "master",
9295
"sourcekit-lsp": "master",
93-
"swift-format": "master"
96+
"swift-format": "master",
97+
"pythonkit": "master"
9498
}
9599
},
96100
"next" : {

0 commit comments

Comments
 (0)