Skip to content

Commit ce5936b

Browse files
committed
Remove path property from Project
1 parent 51d4ef3 commit ce5936b

File tree

5 files changed

+9
-15
lines changed

5 files changed

+9
-15
lines changed

Sources/Commands/SwiftPackageTool.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,12 @@ public class SwiftPackageTool: SwiftTool<PackageToolOptions> {
162162
dstdir = try getPackageRoot()
163163
projectName = graph.rootPackages[0].name
164164
}
165-
let project = try Xcodeproj.generate(
165+
let (_, xcodeProjPath) = try Xcodeproj.generate(
166166
outputDir: dstdir,
167167
projectName: projectName,
168168
graph: graph,
169169
options: options.xcodeprojOptions)
170-
171-
print("generated:", project.path.prettyPath(cwd: originalWorkingDirectory))
170+
print("generated:", xcodeProjPath.prettyPath(cwd: originalWorkingDirectory))
172171

173172
case .describe:
174173
let graph = try loadPackageGraph()

Sources/Xcodeproj/XcodeProjectModel.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,8 @@ public struct Xcode {
6666
var productGroup: Group?
6767
var projectDir: String
6868
var targets: [Target]
69-
public let path: AbsolutePath
7069

71-
init(path: AbsolutePath) {
72-
self.path = path
70+
init() {
7371
self.mainGroup = Group(path: "")
7472
self.buildSettings = BuildSettingsTable()
7573
self.productGroup = nil

Sources/Xcodeproj/generate().swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public func generate(
4848
projectName: String,
4949
graph: PackageGraph,
5050
options: XcodeprojOptions
51-
) throws -> Xcode.Project {
51+
) throws -> (Xcode.Project, AbsolutePath) {
5252
// Note that the output directory might be completely separate from the
5353
// path of the root package (which is where the sources live).
5454

@@ -149,7 +149,7 @@ public func generate(
149149
}
150150
}
151151

152-
return project
152+
return (project, xcodeprojPath)
153153
}
154154

155155
/// Writes the contents to the file specified.

Sources/Xcodeproj/pbxproj().swift

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,13 @@ public func pbxproj(
3434
extraDirs: [AbsolutePath],
3535
options: XcodeprojOptions,
3636
fileSystem: FileSystem = localFileSystem
37-
) throws -> String {
38-
let project = try xcodeProject(
37+
) throws -> Xcode.Project {
38+
return try xcodeProject(
3939
xcodeprojPath: xcodeprojPath,
4040
graph: graph,
4141
extraDirs: extraDirs,
4242
options: options,
4343
fileSystem: fileSystem)
44-
// Serialize the project model we created to a plist, and return
45-
// its string description.
46-
return "// !$*UTF8*$!\n" + project.generatePlist().description
4744
}
4845

4946
/// A set of c99 target names that are invalid for Xcode Framework targets.
@@ -62,7 +59,7 @@ func xcodeProject(
6259
) throws -> Xcode.Project {
6360

6461
// Create the project.
65-
let project = Xcode.Project(path: xcodeprojPath)
62+
let project = Xcode.Project()
6663

6764
// Generates a dummy target to provide autocompletion for the manifest file.
6865
func createPackageDescriptionTarget(for package: ResolvedPackage, manifestFileRef: Xcode.FileReference) {

Tests/XcodeprojTests/GenerateXcodeprojTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class GenerateXcodeprojTests: XCTestCase {
2828
XCTAssertFalse(diagnostics.hasErrors)
2929

3030
let projectName = "DummyProjectName"
31-
let outpath = try Xcodeproj.generate(outputDir: dstdir, projectName: projectName, graph: graph, options: XcodeprojOptions())
31+
let (_, outpath) = try Xcodeproj.generate(outputDir: dstdir, projectName: projectName, graph: graph, options: XcodeprojOptions())
3232

3333
XCTAssertDirectoryExists(outpath)
3434
XCTAssertEqual(outpath, dstdir.appending(component: projectName + ".xcodeproj"))

0 commit comments

Comments
 (0)