Merge pull request #356 from yonaskolb/sorting

Change group sorting
This commit is contained in:
Yonas Kolb
2018-07-24 23:34:15 +10:00
committed by GitHub
7 changed files with 104 additions and 21 deletions
@@ -559,10 +559,8 @@
G_8340618952527 /* Configs */,
G_3234630030493 /* FileGroup */,
G_4661500274312 /* Framework */,
G_1952740716080 /* Frameworks */,
G_8268950006174 /* iMessage */,
G_1646573205915 /* iMessage MessagesExtension */,
G_8620238527590 /* Products */,
G_7189434949822 /* Resources */,
G_6651250437419 /* StandaloneFiles */,
G_3997550084026 /* StaticLibrary_ObjC */,
@@ -571,6 +569,8 @@
FR_232605427418 /* Mintfile */,
FR_257073931060 /* ResourceFolder */,
FR_775316160345 /* SomeFile */,
G_1952740716080 /* Frameworks */,
G_8620238527590 /* Products */,
);
indentWidth = 2;
sourceTree = "<group>";
+1
View File
@@ -8,6 +8,7 @@ options:
transitivelyLinkDependencies: true
deploymentTarget:
watchOS: 4.0
groupSortPosition: top
fileGroups:
- Configs
- FileGroup
@@ -459,6 +459,57 @@ class SourceGeneratorTests: XCTestCase {
try expect(sourcesBuildPhase.files.count) == 1
}
$0.it("derived directories are sorted last") {
let directories = """
A:
- file.swift
P:
- file.swift
S:
- file.swift
"""
try createDirectories(directories)
let target = Target(name: "Test", type: .application, platform: .iOS, sources: ["A", "P", "S"], dependencies: [Dependency(type: .carthage, reference: "Alamofire")])
let project = Project(basePath: directoryPath, name: "Test", targets: [target])
let pbxProj = try project.generatePbxProj()
let groups = try pbxProj.getMainGroup().children.compactMap { pbxProj.objects.getFileElement(reference: $0)?.nameOrPath }
try expect(groups) == ["A", "P", "S", "Frameworks", "Products"]
}
$0.it("sorts files") {
let directories = """
Sources:
- file3.swift
- file.swift
- 10file.a
- 1file.a
- file2.swift
- group2:
- file.swift
- group:
- file.swift
"""
try createDirectories(directories)
let target = Target(name: "Test", type: .application, platform: .iOS, sources: ["Sources"], dependencies: [Dependency(type: .carthage, reference: "Alamofire")])
let project = Project(basePath: directoryPath, name: "Test", targets: [target])
let pbxProj = try project.generatePbxProj()
let group = pbxProj.objects.group(named: "Sources", inGroup: try pbxProj.getMainGroup())!.object
let names = group.children.compactMap { pbxProj.objects.getFileElement(reference: $0)?.nameOrPath }
try expect(names) == [
"1file.a",
"10file.a",
"file.swift",
"file2.swift",
"file3.swift",
"group",
"group2",
]
}
}
}
}