mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2026-03-18 20:02:25 +00:00
d1dd93aac4
* Resolves #173 - Shared breakpoints support * Added breakpoints full documentation * Invalid breakpoint just throw JSONUtilities decoding error. * Use enumeration types instead of String for extensionIDs * Remove a necessary line * Remove unnecessary custom Equatable implementation * Update CHANGELOG.md * Ignore empty breakpoints * Update Docs/ProjectSpec.md Fix a typo Co-Authored-By: Yonas Kolb <yonaskolb@users.noreply.github.com> * Change some properties that should be Int to Int * Create 2 typealiases * Use BreakpointType where it is missing * Remove unused Location * Change some names * Add Breakpoint.Scope * Add Breakpoint.StopOnStyle * Change the type of the raw value to String * Remove some properties that may cause confusing * Require filePah and line when the type is .file * Add tests about decoding breakpoints * Add Breakpoint.Action.ConveyanceType * Add default value for waitUntilDone * Add Breakpoint.Action.SoundName * Add tests about decoding breakpoint actions * Fix some issues in ProjectSpec.md * Improve ProjectSpec.md * Add missing condition * Add breakpoints to project.yml * Use unwarp * Remove the Breakpoint suffix * Refactor BreakpointType * Refactor Breakpoint.Action * Remove unnecessary properties * Adjust the line wrapping style for BreakpointGenerator * Support column breakpoints --------- Co-authored-by: Alex Rupérez <alejandro.ruperez@intelygenz.com> Co-authored-by: Yonas Kolb <yonaskolb@users.noreply.github.com>
57 lines
1.9 KiB
Swift
57 lines
1.9 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(in projectDirectory: Path? = nil, userName: String) throws -> XcodeProj {
|
|
|
|
// generate PBXProj
|
|
let pbxProjGenerator = PBXProjGenerator(project: project,
|
|
projectDirectory: projectDirectory)
|
|
let pbxProj = try pbxProjGenerator.generate()
|
|
|
|
// generate Workspace
|
|
let workspace = try generateWorkspace()
|
|
|
|
// generate Schemes
|
|
let schemeGenerator = SchemeGenerator(project: project, pbxProj: pbxProj)
|
|
let (sharedSchemes, userSchemes, schemeManagement) = try schemeGenerator.generateSchemes()
|
|
|
|
// generate Breakpoints
|
|
let breakpointGenerator = BreakpointGenerator(project: project)
|
|
let xcbreakpointlist = try breakpointGenerator.generateBreakpointList()
|
|
|
|
// generate shared data
|
|
let sharedData = XCSharedData(schemes: sharedSchemes, breakpoints: xcbreakpointlist)
|
|
|
|
// generate user data
|
|
let userData = userSchemes.isEmpty && schemeManagement == nil ? [] : [
|
|
XCUserData(userName: userName, schemes: userSchemes, schemeManagement: schemeManagement)
|
|
]
|
|
|
|
return XcodeProj(
|
|
workspace: workspace,
|
|
pbxproj: pbxProj,
|
|
sharedData: sharedData,
|
|
userData: userData
|
|
)
|
|
}
|
|
|
|
func generateWorkspace() throws -> XCWorkspace {
|
|
let selfReference = XCWorkspaceDataFileRef(location: .current(""))
|
|
let dataElement = XCWorkspaceDataElement.file(selfReference)
|
|
let workspaceData = XCWorkspaceData(children: [dataElement])
|
|
return XCWorkspace(data: workspaceData)
|
|
}
|
|
}
|