Skip to content

Commit

Permalink
Merge pull request #21 from apple/master
Browse files Browse the repository at this point in the history
[pull] swiftwasm from apple:master
  • Loading branch information
pull[bot] authored Jan 25, 2020
2 parents 39433b8 + e26b216 commit 7ffd4e2
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 2 deletions.
6 changes: 5 additions & 1 deletion utils/build-script
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ class BuildScriptInvocation(object):

targets_needing_toolchain = [
'build_indexstoredb',
'build_pythonkit',
'build_sourcekitlsp',
'build_toolchainbenchmarks',
'tsan_libdispatch_test',
Expand Down Expand Up @@ -188,7 +189,8 @@ class BuildScriptInvocation(object):
# Infer if ninja is required
ninja_required = (
args.cmake_generator == 'Ninja' or args.build_foundation or
args.build_sourcekitlsp or args.build_indexstoredb)
args.build_pythonkit or args.build_sourcekitlsp or
args.build_indexstoredb)
if ninja_required and toolchain.ninja is None:
args.build_ninja = True

Expand Down Expand Up @@ -770,6 +772,8 @@ class BuildScriptInvocation(object):
product_classes.append(products.SwiftEvolve)
if self.args.build_indexstoredb:
product_classes.append(products.IndexStoreDB)
if self.args.build_pythonkit:
product_classes.append(products.PythonKit)
if self.args.build_sourcekitlsp:
product_classes.append(products.SourceKitLSP)
if self.args.build_toolchainbenchmarks:
Expand Down
9 changes: 9 additions & 0 deletions utils/build_swift/build_swift/driver_arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ def _apply_default_arguments(args):
args.build_libdispatch = False
args.build_libicu = False
args.build_playgroundsupport = False
args.build_pythonkit = False

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

option('--pythonkit', store_true('build_pythonkit'),
help='build PythonKit')

option('--build-ninja', toggle_true,
help='build the Ninja tool')

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

option('--test-pythonkit', toggle_true('test_pythonkit'),
help='skip testing PythonKit')

# -------------------------------------------------------------------------
in_group('Run build')

Expand Down
6 changes: 6 additions & 0 deletions utils/build_swift/tests/expected_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
'build_ninja': False,
'build_osx': True,
'build_playgroundsupport': False,
'build_pythonkit': False,
'build_runtime_with_host_compiler': False,
'build_stdlib_deployment_targets': ['all'],
'build_subdir': None,
Expand All @@ -94,6 +95,7 @@
'install_swiftpm': False,
'install_swiftsyntax': False,
'swiftsyntax_verify_generated_files': False,
'install_pythonkit': False,
'install_sourcekitlsp': False,
'install_skstresstester': False,
'install_swiftevolve': False,
Expand Down Expand Up @@ -207,6 +209,7 @@
'test_optimized': None,
'test_osx': False,
'test_paths': [],
'test_pythonkit': False,
'test_tvos': False,
'test_tvos_host': False,
'test_tvos_simulator': False,
Expand Down Expand Up @@ -446,6 +449,9 @@ class BuildScriptImplOption(_BaseOption):
SetTrueOption('--maccatalyst', dest='maccatalyst'),
SetTrueOption('--maccatalyst-ios-tests', dest='maccatalyst_ios_tests'),
SetTrueOption('--playgroundsupport', dest='build_playgroundsupport'),
SetTrueOption('--pythonkit', dest='build_pythonkit'),
SetTrueOption('--install-pythonkit', dest='install_pythonkit'),
SetTrueOption('--test-pythonkit', dest='test_pythonkit'),
SetTrueOption('--skip-build'),
SetTrueOption('--swiftpm', dest='build_swiftpm'),
SetTrueOption('--swiftsyntax', dest='build_swiftsyntax'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from .lldb import LLDB
from .llvm import LLVM
from .ninja import Ninja
from .pythonkit import PythonKit
from .skstresstester import SKStressTester
from .sourcekitlsp import SourceKitLSP
from .swift import Swift
Expand All @@ -41,6 +42,7 @@
'LLDB',
'LLVM',
'Ninja',
'PythonKit',
'Swift',
'SwiftPM',
'XCTest',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# swift_build_support/products/pythonkit.py ---------------------*- python -*-
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
# See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
#
# ----------------------------------------------------------------------------

from . import product
from .. import shell


class PythonKit(product.Product):
@classmethod
def product_source_name(cls):
return "PythonKit"

@classmethod
def is_build_script_impl_product(cls):
return False

def should_build(self, host_target):
return True

def build(self, host_target):
shell.call([
self.toolchain.cmake,
'-G', 'Ninja',
'-D', 'BUILD_SHARED_LIBS=YES',
'-D', 'CMAKE_INSTALL_PREFIX={}/usr'.format(
self.args.install_destdir),
'-D', 'CMAKE_MAKE_PROGRAM={}'.format(self.toolchain.ninja),
'-D', 'CMAKE_Swift_COMPILER={}'.format(self.toolchain.swiftc),
'-B', self.build_dir,
'-S', self.source_dir,
])
shell.call([
self.toolchain.cmake,
'--build', self.build_dir,
])

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

def test(self, host_target):
pass

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

def install(self, host_target):
shell.call([
self.toolchain.cmake,
'--build', self.build_dir,
'--target', 'install',
])
1 change: 1 addition & 0 deletions utils/swift_build_support/swift_build_support/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def _getter(self):
_register("llvm_cov", "llvm-cov")
_register("lipo", "lipo")
_register("libtool", "libtool")
_register("swiftc", "swiftc")


class Darwin(Toolchain):
Expand Down
6 changes: 5 additions & 1 deletion utils/update_checkout/update-checkout-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
"remote": { "id": "KitWare/CMake" },
"platforms": [ "Linux" ]
},
"pythonkit": {
"remote": { "id": "pvieito/PythonKit" }
},
"indexstore-db": {
"remote": { "id": "apple/indexstore-db" } },
"sourcekit-lsp": {
Expand Down Expand Up @@ -90,7 +93,8 @@
"cmake": "v3.15.1",
"indexstore-db": "master",
"sourcekit-lsp": "master",
"swift-format": "master"
"swift-format": "master",
"pythonkit": "master"
}
},
"next" : {
Expand Down

0 comments on commit 7ffd4e2

Please sign in to comment.