Skip to content

[swiftpm] Update to latest master #80

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 1 commit into from
Feb 2, 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
4 changes: 2 additions & 2 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Sources/SKCore/BuildSetup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//===----------------------------------------------------------------------===//

import Basic
import Utility
import SPMUtility
import SKSupport

/// Build configuration
Expand Down
2 changes: 1 addition & 1 deletion Sources/SKCore/CompilationDatabaseBuildSystem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ extension CompilationDatabaseBuildSystem: BuildSystem {
}

if compdb == nil {
log("could not open compilation database for \(path.asString)", level: .warning)
log("could not open compilation database for \(path)", level: .warning)
}

return compdb
Expand Down
10 changes: 5 additions & 5 deletions Sources/SKCore/FallbackBuildSystem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import LanguageServerProtocol
import Basic
import enum Utility.Platform
import enum SPMUtility.Platform

/// A simple BuildSystem suitable as a fallback when accurate settings are unknown.
public final class FallbackBuildSystem: BuildSystem {
Expand Down Expand Up @@ -53,10 +53,10 @@ public final class FallbackBuildSystem: BuildSystem {
if let sdkpath = sdkpath {
args += [
"-sdk",
sdkpath.asString,
sdkpath.description,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

description is for producing human readable path, please use pathString where you want to guarantee proper string representation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, will do. I was wondering about this when I did it, and I chose description because that's what the SwiftPM change did. I didn't realize that pathString didn't exist at the time of that change. It all makes more sense now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#81

]
}
args.append(path.asString)
args.append(path.description)
return FileBuildSettings(preferredToolchain: nil, compilerArguments: args)
}

Expand All @@ -65,10 +65,10 @@ public final class FallbackBuildSystem: BuildSystem {
if let sdkpath = sdkpath {
args += [
"-isysroot",
sdkpath.asString,
sdkpath.description,
]
}
args.append(path.asString)
args.append(path.description)
return FileBuildSettings(preferredToolchain: nil, compilerArguments: args)
}
}
4 changes: 2 additions & 2 deletions Sources/SKCore/Toolchain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import SKSupport
import Basic
import Utility
import SPMUtility

/// A Toolchain is a collection of related compilers and libraries meant to be used together to
/// build and edit source code.
Expand Down Expand Up @@ -107,7 +107,7 @@ extension Toolchain {
path: path)
} else {
self.init(
identifier: path.asString,
identifier: path.description,
displayName: path.basename,
path: path)
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/SKCore/ToolchainRegistry.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import SKSupport
import Basic
import Utility
import SPMUtility
import Dispatch
import POSIX
import Foundation
Expand Down
2 changes: 1 addition & 1 deletion Sources/SKSupport/BuildConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//

import Utility
import SPMUtility

public enum BuildConfiguration: String {
case debug
Expand Down
2 changes: 1 addition & 1 deletion Sources/SKSupport/LogLevel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//

import Utility
import SPMUtility

#if canImport(os)
import os
Expand Down
2 changes: 1 addition & 1 deletion Sources/SKSupport/Platform.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//

import Utility
import SPMUtility

extension Platform {

Expand Down
32 changes: 16 additions & 16 deletions Sources/SKSwiftPMWorkspace/SwiftPMWorkspace.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import LanguageServerProtocol
import SKCore
import Basic
import Utility
import SPMUtility
import SKSupport
import Build
import PackageModel
Expand Down Expand Up @@ -95,14 +95,14 @@ public final class SwiftPMWorkspace {
var extraSwiftFlags: [String] = []
var extraClangFlags: [String] = []
if let sdk = sdk {
extraSwiftFlags += ["-sdk", sdk.asString]
extraClangFlags += ["-isysroot", sdk.asString]
extraSwiftFlags += ["-sdk", sdk.description]
extraClangFlags += ["-isysroot", sdk.description]
}

if let platformPath = platformPath {
let flags = [
"-F",
platformPath.appending(components: "Developer", "Library", "Frameworks").asString
platformPath.appending(components: "Developer", "Library", "Frameworks").description
]
extraSwiftFlags += flags
extraClangFlags += flags
Expand Down Expand Up @@ -159,7 +159,7 @@ public final class SwiftPMWorkspace {
fileSystem: localFileSystem,
buildSetup: buildSetup)
} catch Error.noManifest(let path) {
log("could not find manifest, or not a SwiftPM package: \(path.asString)", level: .warning)
log("could not find manifest, or not a SwiftPM package: \(path)", level: .warning)
return nil
} catch {
log("failed to create \(SwiftPMWorkspace.self): \(error)", level: .error)
Expand Down Expand Up @@ -277,7 +277,7 @@ extension SwiftPMWorkspace {
/// Retrieve settings for a package manifest (Package.swift).
func settings(forPackageManifest path: AbsolutePath) -> FileBuildSettings? {
for package in packageGraph.packages where path == package.manifest.path {
let compilerArgs = workspace.interpreterFlags(for: package.path) + [path.asString]
let compilerArgs = workspace.interpreterFlags(for: package.path) + [path.description]
return FileBuildSettings(
preferredToolchain: nil,
compilerArguments: compilerArgs
Expand Down Expand Up @@ -311,21 +311,21 @@ extension SwiftPMWorkspace {
"-emit-dependencies",
"-emit-module",
"-emit-module-path",
buildPath.appending(component: "\(td.target.c99name).swiftmodule").asString,
buildPath.appending(component: "\(td.target.c99name).swiftmodule").description
// -output-file-map <path>
]
if td.target.type == .library || td.target.type == .test {
args += ["-parse-as-library"]
}
args += ["-c"]
args += td.target.sources.paths.map { $0.asString }
args += ["-I", buildPath.asString]
args += td.target.sources.paths.map { $0.description }
args += ["-I", buildPath.description]
args += td.compileArguments()

return FileBuildSettings(
preferredToolchain: nil,
compilerArguments: args,
workingDirectory: workspacePath.asString)
workingDirectory: workspacePath.description)
}

/// Retrieve settings for the given C-family language file, which is part of a known target build
Expand All @@ -348,7 +348,7 @@ extension SwiftPMWorkspace {
"-MT",
"dependencies",
"-MF",
compilePath.deps.asString,
compilePath.deps.description,
]
}

Expand All @@ -368,27 +368,27 @@ extension SwiftPMWorkspace {
if let compilePath = compilePath {
args += [
"-c",
compilePath.source.asString,
compilePath.source.description,
"-o",
compilePath.object.asString
compilePath.object.description
]
} else if path.extension == "h" {
args += ["-c"]
if let xflag = language.xflagHeader {
args += ["-x", xflag]
}
args += [path.asString]
args += [path.description]
} else {
args += [
"-c",
path.asString,
path.description,
]
}

return FileBuildSettings(
preferredToolchain: nil,
compilerArguments: args,
workingDirectory: workspacePath.asString)
workingDirectory: workspacePath.description)
}
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/SKTestSupport/TestServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import SKSupport
import SKCore
import Utility
import SPMUtility
import LanguageServerProtocol
import LanguageServerProtocolJSONRPC
import SourceKit
Expand Down
4 changes: 2 additions & 2 deletions Sources/SourceKit/SourceKitServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import SKCore
import SKSupport
import IndexStoreDB
import Basic
import Utility
import SPMUtility
import Dispatch
import Foundation
import SPMLibc
Expand Down Expand Up @@ -172,7 +172,7 @@ public final class SourceKitServer: LanguageServer {
let resp = try service.sendSync(InitializeRequest(
processId: Int(getpid()),
rootPath: nil,
rootURL: (workspace?.rootPath).map { URL(fileURLWithPath: $0.asString) },
rootURL: (workspace?.rootPath).map { URL(fileURLWithPath: $0.description) },
initializationOptions: InitializationOptions(),
capabilities: workspace?.clientCapabilities ?? ClientCapabilities(workspace: nil, textDocument: nil),
trace: .off,
Expand Down
11 changes: 7 additions & 4 deletions Sources/SourceKit/Workspace.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import SKCore
import SKSupport
import IndexStoreDB
import Basic
import Utility
import SPMUtility
import SKSwiftPMWorkspace

/// Represents the configuration and sate of a project or combination of projects being worked on
Expand Down Expand Up @@ -95,9 +95,12 @@ public final class Workspace {
let libPath = toolchainRegistry.default?.libIndexStore
{
do {
let lib = try IndexStoreLibrary(dylibPath: libPath.asString)
self.index = try IndexStoreDB(storePath: storePath.asString, databasePath: dbPath.asString, library: lib)
log("opened IndexStoreDB at \(dbPath.asString) with store path \(storePath.asString)")
let lib = try IndexStoreLibrary(dylibPath: libPath.description)
self.index = try IndexStoreDB(
storePath: storePath.description,
databasePath: dbPath.description,
library: lib)
log("opened IndexStoreDB at \(dbPath) with store path \(storePath)")
} catch {
log("failed to open IndexStoreDB: \(error.localizedDescription)", level: .error)
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/SourceKit/clangd/ClangLanguageServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func makeJSONRPCClangServer(client: MessageHandler, clangd: AbsolutePath, buildS
if #available(OSX 10.13, *) {
process.executableURL = clangd.asURL
} else {
process.launchPath = clangd.asString
process.launchPath = clangd.description
}

process.arguments = [
Expand Down
2 changes: 1 addition & 1 deletion Sources/SourceKit/sourcekitd/SwiftSourceKitFramework.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ final class SwiftSourceKitFramework {

init(dylib path: AbsolutePath) throws {
self.path = path
self.dylib = try dlopen(path.asString, mode: [.lazy, .local, .first, .deepBind])
self.dylib = try dlopen(path.description, mode: [.lazy, .local, .first, .deepBind])

func dlsym_required<T>(_ handle: DLHandle, symbol: String) throws -> T {
guard let sym: T = dlsym(handle, symbol: symbol) else {
Expand Down
2 changes: 1 addition & 1 deletion Sources/sourcekit-lsp/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import SKCore
import SPMLibc
import Dispatch
import Basic
import Utility
import SPMUtility
import Foundation
import sourcekitd // Not needed here, but fixes debugging...

Expand Down
18 changes: 9 additions & 9 deletions Tests/SKCoreTests/FallbackBuildSystemTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ final class FallbackBuildSystemTests: XCTestCase {
let args = settings.compilerArguments
XCTAssertEqual(args, [
"-sdk",
sdk.asString,
source.asString,
sdk.description,
source.description,
])

bs.sdkpath = nil

XCTAssertEqual(bs.settings(for: source.asURL, .swift)?.compilerArguments, [
source.asString,
source.description,
])
}

Expand All @@ -59,14 +59,14 @@ final class FallbackBuildSystemTests: XCTestCase {
let args = settings.compilerArguments
XCTAssertEqual(args, [
"-isysroot",
sdk.asString,
source.asString,
sdk.description,
source.description,
])

bs.sdkpath = nil

XCTAssertEqual(bs.settings(for: source.asURL, .cpp)?.compilerArguments, [
source.asString,
source.description,
])
}

Expand All @@ -75,7 +75,7 @@ final class FallbackBuildSystemTests: XCTestCase {
let bs = FallbackBuildSystem()
bs.sdkpath = nil
XCTAssertEqual(bs.settings(for: source.asURL, .c)?.compilerArguments, [
source.asString,
source.description,
])
}

Expand All @@ -84,7 +84,7 @@ final class FallbackBuildSystemTests: XCTestCase {
let bs = FallbackBuildSystem()
bs.sdkpath = nil
XCTAssertEqual(bs.settings(for: source.asURL, .objective_c)?.compilerArguments, [
source.asString,
source.description,
])
}

Expand All @@ -93,7 +93,7 @@ final class FallbackBuildSystemTests: XCTestCase {
let bs = FallbackBuildSystem()
bs.sdkpath = nil
XCTAssertEqual(bs.settings(for: source.asURL, .objective_cpp)?.compilerArguments, [
source.asString,
source.description,
])
}

Expand Down
Loading