From 3a21760a1f11674c0bd4b1bacb8ce51a37548b87 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Fri, 15 Nov 2024 17:14:27 -0800 Subject: [PATCH] build: partially repair cross-repository testing When doing cross-repository testing, we need to ensure that we use the proper set of dependencies. With a change to IndexStoreDB relying on swift-lmdb, we uncovered this latent issue which filtered out the dependency and resulted in undefined symbol references. --- Package.swift | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Package.swift b/Package.swift index 901a64999..38f9b8fd4 100644 --- a/Package.swift +++ b/Package.swift @@ -445,6 +445,9 @@ if buildOnlyTests { if case .byNameItem(name: "SKTestSupport", _) = dependency { return true } + if case .productItem(name: "IndexStoreDB", _, _, _) = dependency { + return true + } return false } return target @@ -509,8 +512,13 @@ var buildOnlyTests: Bool { hasEnvironmentVariable("SOURCEKIT_LSP_BUILD_ONLY_TEST // for building the swift toolchain, such as `update-checkout`, or cross-repo PR tests. var dependencies: [Package.Dependency] { + let relatedDependenciesBranch = "main" + if buildOnlyTests { - return [] + return useLocalDependencies + ? [ .package(path: "../indexstore-db") ] + : [ .package(url: "https://github.com/swiftlang/indexstore-db.git", + branch: relatedDependenciesBranch) ] } else if useLocalDependencies { return [ .package(path: "../indexstore-db"), @@ -521,8 +529,6 @@ var dependencies: [Package.Dependency] { .package(path: "../swift-crypto"), ] } else { - let relatedDependenciesBranch = "main" - return [ .package(url: "https://github.com/swiftlang/indexstore-db.git", branch: relatedDependenciesBranch), .package(url: "https://github.com/swiftlang/swift-package-manager.git", branch: relatedDependenciesBranch),