-
Notifications
You must be signed in to change notification settings - Fork 0
[GSoC] SwiftPM PR #1
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
base: main
Are you sure you want to change the base?
Changes from 8 commits
06f36e3
36180cc
0e50e43
d2f747e
027bdc5
e117920
195db6c
7a937c7
811f887
29e7e41
b582478
22e5601
d82b0c7
a6eab23
c6192bf
847b584
67e494c
3a7490b
9baf376
934eea4
edd3056
ee778d9
13ac151
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
This source file is part of the Swift.org open source project | ||
|
||
Copyright (c) 2020 Apple Inc. and the Swift project authors | ||
Copyright (c) 2020 - 2021 Apple Inc. and the Swift project authors | ||
Licensed under Apache License v2.0 with Runtime Library Exception | ||
|
||
See http://swift.org/LICENSE.txt for license information | ||
|
@@ -110,3 +110,31 @@ extension FileSystem { | |
return idiomaticConfigDirectory | ||
} | ||
} | ||
|
||
// MARK: - script cache | ||
|
||
extension FileSystem { | ||
/// SwiftPM cache directory under user's caches directory (if exists) | ||
public var swiftScriptCacheDirectory: AbsolutePath { | ||
return self.dotSwiftScriptCachesDirectory | ||
} | ||
|
||
fileprivate var dotSwiftScriptCachesDirectory: AbsolutePath { | ||
return self.dotSwiftPM.appending(component: "scripts") | ||
} | ||
} | ||
|
||
extension FileSystem { | ||
public func getOrCreateSwiftScriptCacheDirectory() throws -> AbsolutePath { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could this instead just call There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ummm... In fact the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That makes sense — I'm not 100% familiar with how the layout is supposed to look here, it just seemed as if there was some code overlap here. |
||
let idiomaticCacheDirectory = self.swiftScriptCacheDirectory | ||
// Create idiomatic if necessary | ||
if !self.exists(idiomaticCacheDirectory) { | ||
try self.createDirectory(idiomaticCacheDirectory, recursive: true) | ||
} | ||
// Create ~/.swiftpm if necessary | ||
if !self.exists(self.dotSwiftPM) { | ||
try self.createDirectory(self.dotSwiftPM, recursive: true) | ||
} | ||
return idiomaticCacheDirectory | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In principle this is correct, but SwiftSyntax is particularly tricky, because of its dependency on the corresponding linker library. In fact I wasn't able to get the
main
branch to work with Xcode 13 Betas at all. But as it happens we have two other intended uses of SwiftSyntax, and so I will be working with someone who knows it better than I do to add it as a dependency in a separate PR. So you can keep this as it is right now, and within not too long we should be able to have this dependency already added through a separate PR.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's weird because I'm building it with Xcode 13 Beta 4/5, on Big Sur.
I think the dependency could be dropped here some day for parsing, but it would help doing things like generating a package.