Skip to content

[DO NOT MERGE]: Trying local swift-testing reps #8535

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ let swiftPMProduct = (
]
)

let usePackageDependencies = ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil

#if os(Windows)
let includeDynamicLibrary: Bool = false
let systemSQLitePkgConfig: String? = nil
Expand Down Expand Up @@ -767,7 +769,7 @@ let package = Package(
"Build",
"XCBuildSupport",
"SwiftBuildSupport",
"_InternalTestSupport"
"_InternalTestSupport",
],
swiftSettings: [
.unsafeFlags(["-static"]),
Expand All @@ -787,6 +789,7 @@ let package = Package(
"SourceControl",
.product(name: "TSCTestSupport", package: "swift-tools-support-core"),
.product(name: "OrderedCollections", package: "swift-collections"),
.product(name: "Testing", package: "swift-testing"),
"Workspace",
],
swiftSettings: [
Expand Down Expand Up @@ -1044,7 +1047,7 @@ func swiftSyntaxDependencies(_ names: [String]) -> [Target.Dependency] {
let relatedDependenciesBranch = "main"

if ProcessInfo.processInfo.environment["SWIFTPM_LLBUILD_FWK"] == nil {
if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
if usePackageDependencies {
package.dependencies += [
.package(url: "https://github.com/swiftlang/swift-llbuild.git", branch: relatedDependenciesBranch),
]
Expand All @@ -1060,7 +1063,7 @@ if ProcessInfo.processInfo.environment["SWIFTPM_LLBUILD_FWK"] == nil {
]
}

if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
if usePackageDependencies {
package.dependencies += [
.package(url: "https://github.com/swiftlang/swift-tools-support-core.git", branch: relatedDependenciesBranch),
// The 'swift-argument-parser' version declared here must match that
Expand All @@ -1070,6 +1073,7 @@ if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
.package(url: "https://github.com/swiftlang/swift-driver.git", branch: relatedDependenciesBranch),
.package(url: "https://github.com/apple/swift-crypto.git", .upToNextMinor(from: "3.0.0")),
.package(url: "https://github.com/swiftlang/swift-syntax.git", branch: relatedDependenciesBranch),
.package(url: "https://github.com/swiftlang/swift-testing.git", branch: relatedDependenciesBranch),
.package(url: "https://github.com/apple/swift-system.git", from: "1.1.1"),
.package(url: "https://github.com/apple/swift-collections.git", "1.0.1" ..< "1.2.0"),
.package(url: "https://github.com/apple/swift-certificates.git", "1.0.1" ..< "1.6.0"),
Expand All @@ -1087,6 +1091,7 @@ if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
.package(path: "../swift-system"),
.package(path: "../swift-collections"),
.package(path: "../swift-certificates"),
.package(path: "../swift-testing"),
.package(path: "../swift-toolchain-sqlite"),
]
}
Expand All @@ -1111,7 +1116,7 @@ if ProcessInfo.processInfo.environment["SWIFTPM_SWBUILD_FRAMEWORK"] == nil &&
.product(name: "SWBBuildService", package: "swift-build"),
]

if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
if usePackageDependencies {
package.dependencies += [
.package(url: "https://github.com/swiftlang/swift-build.git", branch: relatedDependenciesBranch),
]
Expand Down
1 change: 1 addition & 0 deletions Sources/_InternalTestSupport/SwiftTestingHelpers.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import Testing
13 changes: 8 additions & 5 deletions Utilities/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ def parse_global_args(args):
args.source_dirs["swift-certificates"] = os.path.join(args.project_root, "..", "swift-certificates")
args.source_dirs["swift-asn1"] = os.path.join(args.project_root, "..", "swift-asn1")
args.source_dirs["swift-syntax"] = os.path.join(args.project_root, "..", "swift-syntax")
args.source_dirs["swift-testing"] = os.path.join(args.project_root, "..", "swift-testing")
args.source_root = os.path.join(args.project_root, "Sources")

if platform.system() == 'Darwin':
Expand Down Expand Up @@ -422,21 +423,20 @@ def build(args):
# tsc depends on swift-system so they must be built first.
build_dependency(args, "swift-system")
# swift-driver depends on tsc and swift-argument-parser so they must be built first.
tsc_cmake_flags = [
"-DSwiftSystem_DIR=" + os.path.join(args.build_dirs["swift-system"], "cmake/modules"),
]
build_dependency(args, "tsc", tsc_cmake_flags)
swift_system_cmake_flags = "-DSwiftSystem_DIR=" + os.path.join(args.build_dirs["swift-system"], "cmake/modules")
build_dependency(args, "tsc", [swift_system_cmake_flags])
build_dependency(args, "swift-argument-parser", ["-DBUILD_TESTING=NO", "-DBUILD_EXAMPLES=NO"])

swift_driver_cmake_flags = [
get_llbuild_cmake_arg(args),
"-DSwiftSystem_DIR=" + os.path.join(args.build_dirs["swift-system"], "cmake/modules"),
swift_system_cmake_flags,
"-DTSC_DIR=" + os.path.join(args.build_dirs["tsc"], "cmake/modules"),
"-DArgumentParser_DIR=" + os.path.join(args.build_dirs["swift-argument-parser"], "cmake/modules"),
]
build_dependency(args, "swift-driver", swift_driver_cmake_flags)
build_dependency(args, "swift-collections")
build_dependency(args, "swift-asn1")
build_dependency(args, "swift-testing", [swift_system_cmake_flags])
build_dependency(args, "swift-crypto",
["-DSwiftASN1_DIR=" + os.path.join(args.build_dirs["swift-asn1"], "cmake/modules")])
build_dependency(args, "swift-certificates",
Expand Down Expand Up @@ -717,6 +717,7 @@ def build_swiftpm_with_cmake(args):
"-DSwiftCollections_DIR=" + os.path.join(args.build_dirs["swift-collections"], "cmake/modules"),
"-DSwiftCrypto_DIR=" + os.path.join(args.build_dirs["swift-crypto"], "cmake/modules"),
"-DSwiftASN1_DIR=" + os.path.join(args.build_dirs["swift-asn1"], "cmake/modules"),
"-DSwiftTesting_DIR=" + os.path.join(args.build_dirs["swift-testing"], "cmake/modules"),
"-DSwiftCertificates_DIR=" + os.path.join(args.build_dirs["swift-certificates"], "cmake/modules"),
"-DSWIFTPM_PATH_TO_SWIFT_SYNTAX_SOURCE=" + args.source_dirs["swift-syntax"],
]
Expand All @@ -737,6 +738,7 @@ def build_swiftpm_with_cmake(args):
add_rpath_for_cmake_build(args, os.path.join(args.build_dirs["swift-system"], "lib"))
add_rpath_for_cmake_build(args, os.path.join(args.build_dirs["swift-collections"], "lib"))
add_rpath_for_cmake_build(args, os.path.join(args.build_dirs["swift-asn1"], "lib"))
add_rpath_for_cmake_build(args, os.path.join(args.build_dirs["swift-testing"], "lib"))
add_rpath_for_cmake_build(args, os.path.join(args.build_dirs["swift-certificates"], "lib"))

# rpaths for compatibility libraries
Expand Down Expand Up @@ -874,6 +876,7 @@ def get_swiftpm_env_cmd(args):
os.path.join(args.build_dirs["swift-system"], "lib"),
os.path.join(args.build_dirs["swift-collections"], "lib"),
os.path.join(args.build_dirs["swift-asn1"], "lib"),
os.path.join(args.build_dirs["swift-testing"], "lib"),
os.path.join(args.build_dirs["swift-certificates"], "lib"),
]

Expand Down