Trouble compiling with swift-DEVELOPMENT-SNAPSHOT-2020-01-31-a-osx

I downloaded the swift-DEVELOPMENT-SNAPSHOT-2020-01-31-a-osx.pkg from Swift.org. Installed that to $HOME/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2020-01-31-a.xctoolchain.

Then did

$ export PATH=$HOME/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2020-01-31-a.xctoolchain/usr/bin:"${PATH}"
Apple Swift version 5.2-dev (Swift a0fbeb9179)
Target: x86_64-apple-darwin18.7.0
$ git clone https://github.com/apple/sourcekit-lsp.git
$ cd sourcekit-lsp
$ git checkout swift-DEVELOPMENT-SNAPSHOT-2020-01-31-a
$ swift package resolve
$ swift build
$HOME/sourcekit-lsp/Sources/SKSwiftPMWorkspace/SwiftPMWorkspace.swift:94:25: error: type 'Triple' has no member 'hostTriple'
    let triple = Triple.hostTriple

I think I'm clearly missing a step but I cannot see what it is. Any suggestions?

Seems like the dependencies are more advanced than the Package.swift says.

diff --git a/Package.swift b/Package.swift
index 8cce059..b1813f7 100644
--- a/Package.swift
+++ b/Package.swift
@@ -200,7 +200,7 @@ 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")),
+    .package(url: "https://github.com/apple/swift-package-manager.git", .revision("swift-DEVELOPMENT-SNAPSHOT-2020-01-31-a")),
     .package(url: "https://github.com/apple/swift-tools-support-core.git", .branch("master")),
   ]
 } else {

Correct, our nightly tags do not currently attempt to update the Package.swift. If you want to exactly match what our builders do you could checkout all the dependencies to the same tag and use the local sources environment variable.

I’m not sure how practical it would be to have our package bots modify the sources during tagging - it would also have to be done across all the packages we have branch dependencies on, since otherwise eg you could get a conflict for TSC which is also used by swiftpm. @mishal_shah and @Aciid any thoughts?

I'll admit that I don't fully know what is "best practice" here. Not to mention the pre-release nature of the whole thing complicates it slightly. But wouldn't committing a working Package.resolved be the way to resolve this?

When we develop on master, we really do expect latest master of swiftpm, so a resolved file just gets in the way there. When developing you can just do a package update.

For our tags, maybe we could make an exception but it’s slightly complicated because our actual build in CI uses the sources checked out locally so it would have to author the resolved file manually or something. This whole process is definitely smoother for master development than for building a tag right now.

I've been thinking about this for swift-format as well once we get it added to CI. It would be very convenient to have its Package.swift automatically rewritten to point to the same tag of swift-syntax so that all someone has to do is check out the release tag that matches development snapshot of Swift that they downloaded, and then everything just builds/runs correctly.

1 Like
Terms of Service

Privacy Policy

Cookie Policy