Skip to content

Commit e7aa948

Browse files
committed
Fix SR-2517: "File refs are no longer sorted by name in generated Xcode projects"
1 parent 79e22d0 commit e7aa948

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Sources/Xcodeproj/pbxproj().swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ public func pbxproj(srcroot: AbsolutePath, projectRoot: AbsolutePath, xcodeprojP
9393

9494
// Hash of AbsolutePath of a group and reference id's of its children.
9595
// Children can be either a source file or a nested group
96-
var groupsChildren = [AbsolutePath: Set<String>]()
96+
var groupsChildren = [AbsolutePath: OrderedSet<String>]()
9797

9898
// reference id's of immediate children of this module group.
99-
var topLevelRefs = Set<String>()
99+
var topLevelRefs = OrderedSet<String>()
100100

101101
// the contents of the “Project Navigator” group for this module
102102
for fileRef in sourceFileRefs {
@@ -111,7 +111,7 @@ public func pbxproj(srcroot: AbsolutePath, projectRoot: AbsolutePath, xcodeprojP
111111

112112
// This source file is immediate children of module directory, ie., no nested folders
113113
if path.dirname == "." {
114-
topLevelRefs.insert(fileRef.refId)
114+
topLevelRefs.append(fileRef.refId)
115115
continue
116116
}
117117

@@ -132,7 +132,7 @@ public func pbxproj(srcroot: AbsolutePath, projectRoot: AbsolutePath, xcodeprojP
132132
}
133133

134134

135-
topLevelRefs.insert(parentGroupPath.groupReference(srcroot: srcroot))
135+
topLevelRefs.append(parentGroupPath.groupReference(srcroot: srcroot))
136136

137137
// Calculate children for each group.
138138
//
@@ -148,8 +148,8 @@ public func pbxproj(srcroot: AbsolutePath, projectRoot: AbsolutePath, xcodeprojP
148148
// paths[1], will be the child of paths[2], etc.,
149149
var currentChildren = fileRef.refId
150150
for path in paths {
151-
var children = groupsChildren[path] ?? Set<String>()
152-
children.insert(currentChildren)
151+
var children = groupsChildren[path] ?? OrderedSet<String>()
152+
children.append(currentChildren)
153153
groupsChildren[path] = children
154154

155155
currentChildren = path.groupReference(srcroot: srcroot)

0 commit comments

Comments
 (0)