Skip to content

Commit f51d8fb

Browse files
committed
Merge branch 'bsneed/warnings_fix'
2 parents abac8c7 + 26dbfed commit f51d8fb

9 files changed

+58
-45
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@
55
/*.xcodeproj
66
xcuserdata/
77
DerivedData/
8+
9+
.vscode/

Package.resolved

+32-14
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,26 @@
66
"repositoryURL": "https://github.com/apple/swift-argument-parser.git",
77
"state": {
88
"branch": null,
9-
"revision": "e394bf350e38cb100b6bc4172834770ede1b7232",
10-
"version": "1.0.3"
9+
"revision": "8f4d2753f0e4778c76d5f05ad16c74f707390531",
10+
"version": "1.2.3"
11+
}
12+
},
13+
{
14+
"package": "swift-asn1",
15+
"repositoryURL": "https://github.com/apple/swift-asn1.git",
16+
"state": {
17+
"branch": null,
18+
"revision": "805deae27a7506dcad043604c00a9dc52d465dcb",
19+
"version": "0.7.0"
20+
}
21+
},
22+
{
23+
"package": "swift-certificates",
24+
"repositoryURL": "https://github.com/apple/swift-certificates.git",
25+
"state": {
26+
"branch": null,
27+
"revision": "35a7df2d9d71c401a47de9be2e3de629a01370c2",
28+
"version": "0.4.1"
1129
}
1230
},
1331
{
@@ -24,34 +42,34 @@
2442
"repositoryURL": "https://github.com/apple/swift-crypto.git",
2543
"state": {
2644
"branch": null,
27-
"revision": "ddb07e896a2a8af79512543b1c7eb9797f8898a5",
28-
"version": "1.1.7"
45+
"revision": "33a20e650c33f6d72d822d558333f2085effa3dc",
46+
"version": "2.5.0"
2947
}
3048
},
3149
{
3250
"package": "swift-driver",
3351
"repositoryURL": "https://github.com/apple/swift-driver.git",
3452
"state": {
35-
"branch": "release/5.7",
36-
"revision": "82b274af66cfbb8f3131677676517b34d01e30fd",
53+
"branch": "release/5.9",
54+
"revision": "1b2b851ae4718caffa5f18fd1861bc0ddd1791a3",
3755
"version": null
3856
}
3957
},
4058
{
4159
"package": "llbuild",
4260
"repositoryURL": "https://github.com/apple/swift-llbuild.git",
4361
"state": {
44-
"branch": "release/5.7",
45-
"revision": "564424db5fdb62dcb5d863bdf7212500ef03a87b",
62+
"branch": "release/5.9",
63+
"revision": "d73a305d6e5a82e4bf3bf1727da3d1376e87efab",
4664
"version": null
4765
}
4866
},
4967
{
5068
"package": "SwiftPM",
5169
"repositoryURL": "https://github.com/apple/swift-package-manager.git",
5270
"state": {
53-
"branch": "release/5.7",
54-
"revision": "c6e40adbfc78acc60ca464ae482b56442f9f34f4",
71+
"branch": "release/5.9",
72+
"revision": "732d5406df67b64d266c5689454cf52aecbb4d57",
5573
"version": null
5674
}
5775
},
@@ -68,8 +86,8 @@
6886
"package": "swift-tools-support-core",
6987
"repositoryURL": "https://github.com/apple/swift-tools-support-core.git",
7088
"state": {
71-
"branch": "release/5.7",
72-
"revision": "286b48b1d73388e1d49b2bb33aabf995838104e3",
89+
"branch": "release/5.9",
90+
"revision": "5665fc7641ce1a971ad06faaa476862b222ef44b",
7391
"version": null
7492
}
7593
},
@@ -78,8 +96,8 @@
7896
"repositoryURL": "https://github.com/jpsim/Yams.git",
7997
"state": {
8098
"branch": null,
81-
"revision": "9ff1cc9327586db4e0c8f46f064b6a82ec1566fa",
82-
"version": "4.0.6"
99+
"revision": "0d9ee7ea8c4ebd4a489ad7a73d5c6cad55d6fed3",
100+
"version": "5.0.6"
83101
}
84102
}
85103
]

Sources/CreateXCFramework/Command.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,14 @@ struct Command: ParsableCommand {
7878
// we've applied the xcconfig to everything, but some dependencies (*cough* swift-nio)
7979
// have build errors, so we remove it from targets we're not building
8080
if self.options.stackEvolution == false {
81-
try project.enableDistribution(targets: productNames, xcconfig: AbsolutePath(package.distributionBuildXcconfig.path).relative(to: AbsolutePath(package.rootDirectory.path)))
81+
try project.enableDistribution(targets: productNames, xcconfig: AbsolutePath(validating: package.distributionBuildXcconfig.path).relative(to: AbsolutePath(validating: package.rootDirectory.path)))
8282
}
8383

8484
// save the project
85-
try project.save(to: generator.projectPath)
85+
try project.save(to: try generator.projectPath())
8686

8787
// start building
88-
let builder = XcodeBuilder(project: project, projectPath: generator.projectPath, package: package, options: self.options)
88+
let builder = XcodeBuilder(project: project, projectPath: try generator.projectPath(), package: package, options: self.options)
8989

9090
// clean first
9191
if self.options.clean {

Sources/CreateXCFramework/PackageInfo.swift

+1-8
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ struct PackageInfo {
8484
self.rootDirectory = Foundation.URL(fileURLWithPath: options.packagePath, isDirectory: true).absoluteURL
8585
self.buildDirectory = self.rootDirectory.appendingPathComponent(options.buildPath, isDirectory: true).absoluteURL
8686

87-
let root = AbsolutePath(self.rootDirectory.path)
87+
let root = try AbsolutePath(validating: self.rootDirectory.path)
8888

8989
self.toolchain = try UserToolchain(destination: try .hostDestination())
9090

@@ -252,13 +252,6 @@ struct PackageInfo {
252252
return target
253253
}
254254

255-
256-
// MARK: - Helpers
257-
258-
private var absoluteRootDirectory: AbsolutePath {
259-
AbsolutePath(self.rootDirectory.path)
260-
}
261-
262255
}
263256

264257

Sources/CreateXCFramework/ProjectGenerator.swift

+8-8
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ struct ProjectGenerator {
2121

2222
let package: PackageInfo
2323

24-
var projectPath: AbsolutePath {
25-
let dir = AbsolutePath(self.package.projectBuildDirectory.path)
24+
func projectPath() throws -> AbsolutePath {
25+
let dir = try AbsolutePath(validating: self.package.projectBuildDirectory.path)
2626
#if swift(>=5.7)
27-
return XcodeProject.makePath(outputDir: dir, projectName: self.package.manifest.displayName)
27+
return try XcodeProject.makePath(outputDir: dir, projectName: self.package.manifest.displayName)
2828
#else
2929
return buildXcodeprojPath(outputDir: dir, projectName: self.package.manifest.displayName)
3030
#endif
@@ -46,14 +46,14 @@ struct ProjectGenerator {
4646
return
4747
}
4848

49-
try makeDirectories(self.projectPath)
49+
try makeDirectories(self.projectPath())
5050

51-
let path = AbsolutePath(self.package.distributionBuildXcconfig.path)
51+
let path = try AbsolutePath(validating: self.package.distributionBuildXcconfig.path)
5252
try open(path) { stream in
5353
if let absolutePath = self.package.overridesXcconfig?.path {
5454
stream (
5555
"""
56-
#include "\(AbsolutePath(absolutePath).relative(to: AbsolutePath(path.dirname)).pathString)"
56+
#include "\(try AbsolutePath(validating: absolutePath).relative(to: AbsolutePath(validating: path.dirname)).pathString)"
5757
5858
"""
5959
)
@@ -72,7 +72,7 @@ struct ProjectGenerator {
7272
/// This is basically a copy of Xcodeproj.generate()
7373
///
7474
func generate () throws -> Xcode.Project {
75-
let path = self.projectPath
75+
let path = try self.projectPath()
7676
try makeDirectories(path)
7777

7878
// Generate the contents of project.xcodeproj (inside the .xcodeproj).
@@ -83,7 +83,7 @@ struct ProjectGenerator {
8383
extraDirs: [],
8484
extraFiles: [],
8585
options: XcodeprojOptions (
86-
xcconfigOverrides: (self.package.overridesXcconfig?.path).flatMap { AbsolutePath($0) },
86+
xcconfigOverrides: (self.package.overridesXcconfig?.path).flatMap { try AbsolutePath(validating: $0) },
8787
useLegacySchemeGenerator: true
8888
),
8989
fileSystem: localFileSystem,

Sources/CreateXCFramework/Zipper.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ struct Zipper {
5858

5959
func checksum (file: Foundation.URL) throws -> Foundation.URL {
6060
#if swift(>=5.7)
61-
let sum = try checksum(forBinaryArtifactAt: AbsolutePath(file.path))
61+
let sum = try checksum(forBinaryArtifactAt: AbsolutePath(validating: file.path))
6262
#elseif swift(>=5.6)
6363
let sum = try self.package.workspace.checksum(forBinaryArtifactAt: AbsolutePath(file.path))
6464
#else

Sources/Xcodeproj/SchemesGenerator.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,12 @@ public final class SchemesGenerator {
208208
209209
"""
210210

211-
let file = AbsolutePath(scheme.filename, relativeTo: schemesDir)
211+
let file = try AbsolutePath(validating: scheme.filename, relativeTo: schemesDir)
212212
try fs.writeFileContents(file, bytes: stream.bytes)
213213
}
214214

215215
private func disableSchemeAutoCreation() throws {
216-
let workspacePath = AbsolutePath("../../project.xcworkspace", relativeTo: schemesDir)
216+
let workspacePath = try AbsolutePath(validating: "../../project.xcworkspace", relativeTo: schemesDir)
217217

218218
// Write the settings file to disable automatic scheme creation.
219219
var stream = BufferedOutputByteStream()
@@ -227,12 +227,12 @@ public final class SchemesGenerator {
227227
</dict>
228228
</plist>
229229
"""
230-
let settingsPlist = AbsolutePath("xcshareddata/WorkspaceSettings.xcsettings", relativeTo: workspacePath)
230+
let settingsPlist = try AbsolutePath(validating: "xcshareddata/WorkspaceSettings.xcsettings", relativeTo: workspacePath)
231231
try fs.createDirectory(settingsPlist.parentDirectory, recursive: true)
232232
try fs.writeFileContents(settingsPlist, bytes: stream.bytes)
233233

234234
// Write workspace contents file.
235-
let contentsFile = AbsolutePath("contents.xcworkspacedata", relativeTo: workspacePath)
235+
let contentsFile = try AbsolutePath(validating: "contents.xcworkspacedata", relativeTo: workspacePath)
236236
stream = BufferedOutputByteStream()
237237
stream <<< """
238238
<?xml version="1.0" encoding="UTF-8"?>

Sources/Xcodeproj/generate.swift

+6-6
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import struct TSCUtility.BuildFlags
2323

2424
public struct XcodeprojOptions {
2525
/// The build flags.
26-
public var flags: BuildFlags
26+
public var flags: PackageModel.BuildFlags
2727

2828
/// If provided, a path to an xcconfig file to be included by the project.
2929
///
@@ -46,7 +46,7 @@ public struct XcodeprojOptions {
4646
public var manifestLoader: ManifestLoader?
4747

4848
public init(
49-
flags: BuildFlags = BuildFlags(),
49+
flags: PackageModel.BuildFlags = PackageModel.BuildFlags(),
5050
xcconfigOverrides: AbsolutePath? = nil,
5151
isCodeCoverageEnabled: Bool? = nil,
5252
useLegacySchemeGenerator: Bool? = nil,
@@ -64,9 +64,9 @@ public struct XcodeprojOptions {
6464

6565
public enum XcodeProject {
6666
// Determine the path of the .xcodeproj wrapper directory.
67-
public static func makePath(outputDir: AbsolutePath, projectName: String) -> AbsolutePath {
67+
public static func makePath(outputDir: AbsolutePath, projectName: String) throws -> AbsolutePath {
6868
let xcodeprojName = "\(projectName).xcodeproj"
69-
return AbsolutePath(xcodeprojName, relativeTo: outputDir)
69+
return try AbsolutePath(validating: xcodeprojName, relativeTo: outputDir)
7070
}
7171

7272
/// Generates an Xcode project and all needed support files. The .xcodeproj
@@ -146,7 +146,7 @@ public enum XcodeProject {
146146
///// For framework targets, generate target.c99Name_Info.plist files in the
147147
///// directory that Xcode project is generated
148148
let name = target.infoPlistFileName
149-
try open(AbsolutePath(name, relativeTo: xcodeprojPath)) { print in
149+
try open(AbsolutePath(validating: name, relativeTo: xcodeprojPath)) { print in
150150
print("""
151151
<?xml version="1.0" encoding="UTF-8"?>
152152
<plist version="1.0">
@@ -246,7 +246,7 @@ public enum XcodeProject {
246246
// -Package so its name doesn't collide with any products or target with
247247
// same name.
248248
let schemeName = "\(graph.rootPackages[0].manifest.displayName)-Package.xcscheme" // TODO: use identity instead?
249-
try open(AbsolutePath(schemeName, relativeTo: schemesDir)) { stream in
249+
try open(AbsolutePath(validating: schemeName, relativeTo: schemesDir)) { stream in
250250
legacySchemeGenerator(
251251
container: schemeContainer,
252252
graph: graph,

Sources/Xcodeproj/pbxproj.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ public func xcodeProject(
429429

430430
// Assign the deployment target if the package is using the newer manifest version.
431431
if package.manifest.toolsVersion >= .v5 {
432-
for supportedPlatform in target.platforms.derived {
432+
for supportedPlatform in target.platforms.declared {
433433
let version = supportedPlatform.version.versionString
434434
switch supportedPlatform.platform {
435435
case .macOS:

0 commit comments

Comments
 (0)