Skip to content

Commit be5a065

Browse files
authored
Add support for SWIFTCI_USE_LOCAL_DEPS in swift-inspect
If the `SWIFTCI_USE_LOCAL_DEPS` environment variable is set, we're building in the Swift.org CI system alongside other projects in the Swift toolchain and we can depend on local versions of our dependencies instead of fetching them remotely.
1 parent 3eea9d6 commit be5a065

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

tools/swift-inspect/Package.swift

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription
5+
import class Foundation.ProcessInfo
56

67
let package = Package(
78
name: "swift-inspect",
89
products: [
910
.library(name: "SwiftInspectClient", type: .dynamic, targets: ["SwiftInspectClient"]),
1011
],
11-
dependencies: [
12-
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.2.2"),
13-
],
1412
targets: [
1513
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
1614
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
@@ -36,3 +34,11 @@ let package = Package(
3634
name: "SymbolicationShims")
3735
]
3836
)
37+
38+
if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
39+
package.dependencies += [
40+
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.2.2"),
41+
]
42+
} else {
43+
package.dependencies += [.package(path: "../../../swift-argument-parser")]
44+
}

utils/build.ps1

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,12 +1530,14 @@ function Install-HostToolchain() {
15301530
function Build-Inspect() {
15311531
$OutDir = Join-Path -Path $HostArch.BinaryCache -ChildPath swift-inspect
15321532

1533-
Build-SPMProject `
1534-
-Src $SourceCache\swift\tools\swift-inspect `
1535-
-Bin $OutDir `
1536-
-Arch $HostArch `
1537-
-Xcc "-I$SDKInstallRoot\usr\include\swift\SwiftRemoteMirror" -Xlinker "$SDKInstallRoot\usr\lib\swift\windows\$($HostArch.LLVMName)\swiftRemoteMirror.lib" `
1538-
-Xcc -Xclang -Xcc -fno-split-cold-code # Workaround https://github.com/llvm/llvm-project/issues/40056
1533+
Isolate-EnvVars {
1534+
$env:SWIFTCI_USE_LOCAL_DEPS=1
1535+
Build-SPMProject `
1536+
-Src $SourceCache\swift\tools\swift-inspect `
1537+
-Bin $OutDir `
1538+
-Arch $HostArch `
1539+
-Xcc "-I$SDKInstallRoot\usr\include\swift\SwiftRemoteMirror" -Xlinker "$SDKInstallRoot\usr\lib\swift\windows\$($HostArch.LLVMName)\swiftRemoteMirror.lib"
1540+
}
15391541
}
15401542

15411543
function Build-Format() {

0 commit comments

Comments
 (0)