-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Build and install swift-testing in toolchains #74582
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
56d800d
Add swift-testing to update-checkout
stmontgomery 2992806
Build script changes to begin building and installing swift-testing i…
stmontgomery 8b03414
Add swift-testing to Linux presets too
stmontgomery 17158a8
Improve description of new build-script flags
stmontgomery c867901
Fix header comment
stmontgomery 7f0900c
Temporarily disable some SwiftPM tests. I believe they are failing du…
stmontgomery File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
utils/swift_build_support/swift_build_support/products/swift_testing.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,67 @@ | ||||||||
# swift_build_support/products/swift_testing.py -----------------*- python -*- | ||||||||
# | ||||||||
# This source file is part of the Swift.org open source project | ||||||||
# | ||||||||
# Copyright (c) 2024 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 | ||||||||
# | ||||||||
# ---------------------------------------------------------------------------- | ||||||||
|
||||||||
import os | ||||||||
|
||||||||
from . import cmake_product | ||||||||
from . import swift | ||||||||
from . import swiftsyntax | ||||||||
|
||||||||
class SwiftTesting(cmake_product.CMakeProduct): | ||||||||
@classmethod | ||||||||
def is_build_script_impl_product(cls): | ||||||||
return False | ||||||||
|
||||||||
@classmethod | ||||||||
def is_before_build_script_impl_product(cls): | ||||||||
return False | ||||||||
|
||||||||
@classmethod | ||||||||
def product_source_name(cls): | ||||||||
return "swift-testing" | ||||||||
|
||||||||
@classmethod | ||||||||
def get_dependencies(cls): | ||||||||
return [swift.Swift, | ||||||||
swiftsyntax.SwiftSyntax] | ||||||||
Comment on lines
+34
to
+35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no need to wait for SwiftSyntax -- in the build we are using the swift syntax libraries that we build in the Swift compiler for plugins
Suggested change
|
||||||||
|
||||||||
def should_build(self, host_target): | ||||||||
return True | ||||||||
|
||||||||
def build(self, host_target): | ||||||||
self.cmake_options.define('BUILD_SHARED_LIBS', 'YES') | ||||||||
|
||||||||
# Use empty CMake install prefix, since the `DESTDIR` env var is set by | ||||||||
# `install_with_cmake` later which already has the same prefix. | ||||||||
self.cmake_options.define('CMAKE_INSTALL_PREFIX', '') | ||||||||
|
||||||||
build_root = os.path.dirname(self.build_dir) | ||||||||
swift_build_dir = os.path.join( | ||||||||
'..', build_root, '%s-%s' % ('swift', host_target)) | ||||||||
swift_cmake_dir = os.path.join(swift_build_dir, 'cmake', 'modules') | ||||||||
self.cmake_options.define('SwiftSyntax_DIR:PATH', swift_cmake_dir) | ||||||||
|
||||||||
self.build_with_cmake([], self.args.build_variant, [], | ||||||||
prefer_native_toolchain=True) | ||||||||
|
||||||||
def should_test(self, host_target): | ||||||||
# TODO | ||||||||
return False | ||||||||
|
||||||||
def should_install(self, host_target): | ||||||||
return self.args.install_swift_testing | ||||||||
|
||||||||
def install(self, host_target): | ||||||||
install_destdir = self.host_install_destdir(host_target) | ||||||||
install_prefix = install_destdir + self.args.install_prefix | ||||||||
|
||||||||
self.install_with_cmake(['install'], install_prefix) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch!