mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2024-11-10 14:51:04 +03:00
39 lines
1.1 KiB
Swift
39 lines
1.1 KiB
Swift
import Foundation
|
|
import JSONUtilities
|
|
import PathKit
|
|
import ProjectSpec
|
|
import XcodeProj
|
|
import Yams
|
|
|
|
public class ProjectGenerator {
|
|
|
|
let project: Project
|
|
|
|
public init(project: Project) {
|
|
self.project = project
|
|
}
|
|
|
|
public func generateXcodeProject() throws -> XcodeProj {
|
|
|
|
// generate PBXProj
|
|
let pbxProjGenerator = PBXProjGenerator(project: project)
|
|
let pbxProj = try pbxProjGenerator.generate()
|
|
|
|
// generate Schemes
|
|
let schemeGenerator = SchemeGenerator(project: project, pbxProj: pbxProj)
|
|
let schemes = try schemeGenerator.generateSchemes()
|
|
|
|
// generate Workspace
|
|
let workspace = try generateWorkspace()
|
|
|
|
let sharedData = XCSharedData(schemes: schemes)
|
|
return XcodeProj(workspace: workspace, pbxproj: pbxProj, sharedData: sharedData)
|
|
}
|
|
|
|
func generateWorkspace() throws -> XCWorkspace {
|
|
let dataElement: XCWorkspaceDataElement = .file(XCWorkspaceDataFileRef(location: .self("")))
|
|
let workspaceData = XCWorkspaceData(children: [dataElement])
|
|
return XCWorkspace(data: workspaceData)
|
|
}
|
|
}
|