Skip to content

Commit 3a69aef

Browse files
committed
Remove Package.resolved and move to HEAD
Always use the latest indexstore-db and swiftpm from the corresponding branch (currently master). This is important for swiftpm, because it does not *guarantee* stable behaviour, so we need to match the version. It also makes sourcekit-lsp behave more like the rest of the swift toolchain projects, who all live on HEAD for their dependencies.
1 parent 4526413 commit 3a69aef

File tree

4 files changed

+35
-41
lines changed

4 files changed

+35
-41
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.DS_Store
22
default.profraw
3+
Package.resolved
34
/.build
45
/Packages
56
/*.xcodeproj

Package.resolved

Lines changed: 0 additions & 34 deletions
This file was deleted.

Package.swift

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ let package = Package(
77
products: [
88
],
99
dependencies: [
10-
.package(url: "https://github.com/apple/swift-package-manager.git", .branch("master")),
11-
.package(url: "https://github.com/apple/indexstore-db.git", .branch("master")),
10+
// See 'Dependencies' below.
1211
],
1312
targets: [
1413
.target(
@@ -82,3 +81,28 @@ let package = Package(
8281
dependencies: ["SKSupport", "SKTestSupport"]),
8382
]
8483
)
84+
85+
// MARK: Dependencies
86+
87+
// When building with the swift build-script, use local dependencies whose contents are controlled
88+
// by the external environment. This allows sourcekit-lsp to take advantage of the automation used
89+
// for building the swift toolchain, such as `update-checkout`, or cross-repo PR tests.
90+
91+
#if os(Linux)
92+
import Glibc
93+
#else
94+
import Darwin.C
95+
#endif
96+
97+
if getenv("SWIFTCI_USE_LOCAL_DEPS") == nil {
98+
// Building standalone.
99+
package.dependencies += [
100+
.package(url: "https://github.com/apple/indexstore-db.git", .branch("master")),
101+
.package(url: "https://github.com/apple/swift-package-manager.git", .branch("master")),
102+
]
103+
} else {
104+
package.dependencies += [
105+
.package(path: "../indexstore-db"),
106+
.package(path: "../swiftpm"),
107+
]
108+
}

Utilities/build-script-helper.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,18 @@ def add_common_args(parser):
6666

6767
swiftpm_args = get_swiftpm_options(args)
6868

69+
env = os.environ
70+
# Set the toolchain used in tests at runtime
71+
env['SOURCEKIT_TOOLCHAIN_PATH'] = args.toolchain
72+
# Use local dependencies (i.e. checked out next sourcekit-lsp).
73+
env['SWIFTCI_USE_LOCAL_DEPS'] = "1"
74+
6975
if args.action == 'build':
70-
swiftpm('build', swift_exec, swiftpm_args)
76+
swiftpm('build', swift_exec, swiftpm_args, env)
7177
elif args.action == 'test':
72-
# Set the toolchain used in tests at runtime
73-
env = os.environ
74-
env['SOURCEKIT_TOOLCHAIN_PATH'] = args.toolchain
7578
swiftpm('test', swift_exec, swiftpm_args, env)
7679
else:
7780
assert False, 'unknown action \'{}\''.format(args.action)
7881

7982
if __name__ == '__main__':
80-
main()
83+
main()

0 commit comments

Comments
 (0)