mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2026-03-18 20:02:25 +00:00
06a6616b88
* Improving variable expansion runtime
The current implementation of variable expansion is O(n x m) with n being the
number of strings in the project spec and m being the number of project variables.
This implementation is now O(n).
Also, this effectively deprecates the support for $legacy_variables in favor of the
${new_variables} making this whole patch possible.
* Adding option to disable variable expansion
* Adding performance test for spec loading
* Updating changelog
81 lines
2.3 KiB
Swift
81 lines
2.3 KiB
Swift
import Foundation
|
|
import PathKit
|
|
import ProjectSpec
|
|
import XcodeGenKit
|
|
import XcodeProj
|
|
import XCTest
|
|
|
|
class GeneratedPerformanceTests: XCTestCase {
|
|
|
|
let basePath = Path.temporary + "XcodeGenPeformanceTests"
|
|
|
|
func testLoading() throws {
|
|
let project = try Project.testProject(basePath: basePath)
|
|
let specPath = basePath + "project.yaml"
|
|
try dumpYamlDictionary(project.toJSONDictionary(), path: specPath)
|
|
|
|
measure {
|
|
let spec = try! SpecFile(path: specPath)
|
|
_ = spec.resolvedDictionary(variables: ProcessInfo.processInfo.environment)
|
|
}
|
|
}
|
|
|
|
func testGeneration() throws {
|
|
let project = try Project.testProject(basePath: basePath)
|
|
measure {
|
|
let generator = ProjectGenerator(project: project)
|
|
_ = try! generator.generateXcodeProject()
|
|
}
|
|
}
|
|
|
|
func testWriting() throws {
|
|
let project = try Project.testProject(basePath: basePath)
|
|
let generator = ProjectGenerator(project: project)
|
|
let xcodeProject = try generator.generateXcodeProject()
|
|
measure {
|
|
xcodeProject.pbxproj.invalidateUUIDs()
|
|
try! xcodeProject.write(path: project.defaultProjectPath)
|
|
}
|
|
}
|
|
}
|
|
|
|
let fixturePath = Path(#file).parent().parent() + "Fixtures"
|
|
|
|
class FixturePerformanceTests: XCTestCase {
|
|
|
|
let specPath = fixturePath + "TestProject/project.yml"
|
|
|
|
func testFixtureDecoding() throws {
|
|
measure {
|
|
_ = try! Project(path: specPath)
|
|
}
|
|
}
|
|
|
|
func testCacheFileGeneration() throws {
|
|
let specLoader = SpecLoader(version: "1.2")
|
|
_ = try specLoader.loadProject(path: specPath)
|
|
|
|
measure {
|
|
_ = try! specLoader.generateCacheFile()
|
|
}
|
|
}
|
|
|
|
func testFixtureGeneration() throws {
|
|
let project = try Project(path: specPath)
|
|
measure {
|
|
let generator = ProjectGenerator(project: project)
|
|
_ = try! generator.generateXcodeProject()
|
|
}
|
|
}
|
|
|
|
func testFixtureWriting() throws {
|
|
let project = try Project(path: specPath)
|
|
let generator = ProjectGenerator(project: project)
|
|
let xcodeProject = try generator.generateXcodeProject()
|
|
measure {
|
|
xcodeProject.pbxproj.invalidateUUIDs()
|
|
try! xcodeProject.write(path: project.defaultProjectPath)
|
|
}
|
|
}
|
|
}
|