diff --git a/Package.swift b/Package.swift index e989267b4dd..b51833dbdee 100644 --- a/Package.swift +++ b/Package.swift @@ -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 @@ -767,7 +769,7 @@ let package = Package( "Build", "XCBuildSupport", "SwiftBuildSupport", - "_InternalTestSupport" + "_InternalTestSupport", ], swiftSettings: [ .unsafeFlags(["-static"]), @@ -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: [ @@ -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), ] @@ -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 @@ -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"), @@ -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"), ] } @@ -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), ] diff --git a/Sources/_InternalTestSupport/SwiftTestingHelpers.swift b/Sources/_InternalTestSupport/SwiftTestingHelpers.swift new file mode 100644 index 00000000000..d196bcaa8a3 --- /dev/null +++ b/Sources/_InternalTestSupport/SwiftTestingHelpers.swift @@ -0,0 +1 @@ +import Testing diff --git a/Utilities/bootstrap b/Utilities/bootstrap index 374849a7050..68951a9325f 100755 --- a/Utilities/bootstrap +++ b/Utilities/bootstrap @@ -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': @@ -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", @@ -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"], ] @@ -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 @@ -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"), ]