Skip to content

Remove Package.resolved and move to depending on HEAD #91

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

Merged
merged 4 commits into from
Mar 7, 2019
Merged
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.DS_Store
default.profraw
Package.resolved
/.build
/Packages
/*.xcodeproj
Expand Down
34 changes: 0 additions & 34 deletions Package.resolved

This file was deleted.

28 changes: 26 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ let package = Package(
products: [
],
dependencies: [
.package(url: "https://github.com/apple/swift-package-manager.git", .branch("master")),
.package(url: "https://github.com/apple/indexstore-db.git", .branch("master")),
// See 'Dependencies' below.
],
targets: [
.target(
Expand Down Expand Up @@ -82,3 +81,28 @@ let package = Package(
dependencies: ["SKSupport", "SKTestSupport"]),
]
)

// MARK: Dependencies

// When building with the swift build-script, use local dependencies whose contents are controlled
// by the external environment. This allows sourcekit-lsp to take advantage of the automation used
// for building the swift toolchain, such as `update-checkout`, or cross-repo PR tests.

#if os(Linux)
import Glibc
#else
import Darwin.C
#endif

if getenv("SWIFTCI_USE_LOCAL_DEPS") == nil {
// Building standalone.
package.dependencies += [
.package(url: "https://github.com/apple/indexstore-db.git", .branch("master")),
.package(url: "https://github.com/apple/swift-package-manager.git", .branch("master")),
]
} else {
package.dependencies += [
.package(path: "../indexstore-db"),
.package(path: "../swiftpm"),
]
}
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ SourceKit-LSP is an implementation of the [Language Server Protocol](https://mic

SourceKit-LSP is under heavy development! The best way to try it out is to build it from source. You will also need a Swift development toolchain and an editor that supports LSP.

1. Install the `swift-DEVELOPMENT-SNAPSHOT-2019-02-14-a` toolchain snapshot from https://swift.org/download/#snapshots. Set the environment variable `SOURCEKIT_TOOLCHAIN_PATH` to the absolute path to the toolchain or otherwise configure your editor to use this toolchain. See [Toolchains](#toolchains) for more information.
1. Install the latest master toolchain snapshot from https://swift.org/download/#snapshots. Set the environment variable `SOURCEKIT_TOOLCHAIN_PATH` to the absolute path to the toolchain or otherwise configure your editor to use this toolchain. See [Toolchains](#toolchains) for more information.

2. Build the language server executable `sourcekit-lsp` using `swift build`. See [Building](#building-sourcekit-lsp) for more information.

Expand All @@ -23,11 +23,14 @@ SourceKit-LSP is built using the [Swift Package Manager](https://github.com/appl
For a standard debug build:

```sh
$ swift package update
$ swift build
```

After building, the server will be located at `.build/debug/sourcekit-lsp`, or a similar path, if you passed any custom options to `swift build`. Editors will generally need to be provided with this path in order to run the newly built server - see [Editors](Editors) for more information about configuration.

SourceKit-LSP is designed to build against the latest SwiftPM, so if you run into any issue make sure you have the most up-to-date dependencies by running `swift package update`.

### Building on Linux

The C++ code in the index requires `libdispatch`, but unlike Swift code, it cannot find it automatically on Linux. You can work around this by adding a search path manually.
Expand Down Expand Up @@ -73,7 +76,7 @@ SourceKit-LSP depends on tools such as `sourcekitd` and `clangd`, which it loads

### Recommended Toolchain

Use the `swift-DEVELOPMENT-SNAPSHOT-2019-02-14-a` toolchain snapshot from https://swift.org/download/#snapshots. SourceKit-LSP is still early in its development and we are actively adding functionality to the toolchain to support it.
Use the latest master toolchain snapshot from https://swift.org/download/#snapshots. SourceKit-LSP is still early in its development and we are actively adding functionality to the toolchain to support it.

### Selecting the Toolchain

Expand Down
13 changes: 8 additions & 5 deletions Utilities/build-script-helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,18 @@ def add_common_args(parser):

swiftpm_args = get_swiftpm_options(args)

env = os.environ
# Set the toolchain used in tests at runtime
env['SOURCEKIT_TOOLCHAIN_PATH'] = args.toolchain
# Use local dependencies (i.e. checked out next sourcekit-lsp).
env['SWIFTCI_USE_LOCAL_DEPS'] = "1"

if args.action == 'build':
swiftpm('build', swift_exec, swiftpm_args)
swiftpm('build', swift_exec, swiftpm_args, env)
elif args.action == 'test':
# Set the toolchain used in tests at runtime
env = os.environ
env['SOURCEKIT_TOOLCHAIN_PATH'] = args.toolchain
swiftpm('test', swift_exec, swiftpm_args, env)
else:
assert False, 'unknown action \'{}\''.format(args.action)

if __name__ == '__main__':
main()
main()