Skip to content

Commit e96b4c1

Browse files
committed
Introduce ability to add top level files
1 parent b78f787 commit e96b4c1

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Sources/Xcodeproj/pbxproj().swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,18 @@ func xcodeProject(
176176
// of its manifest file.
177177
let manifestFileRef = project.mainGroup.addFileReference(path: "Package.swift", fileType: "sourcecode.swift")
178178
createPackageDescriptionTarget(for: graph.rootPackages[0], manifestFileRef: manifestFileRef)
179+
180+
// Add root level files to the project.
181+
func shouldIgnore(_ path: AbsolutePath) -> Bool {
182+
return path.basename.hasPrefix(".")
183+
|| project.mainGroup.subitems.contains { $0.path == path.basename }
184+
}
185+
for content in try fileSystem.getDirectoryContents(sourceRootDir) {
186+
let absolutePath = AbsolutePath(content, relativeTo: sourceRootDir)
187+
if fileSystem.isFile(absolutePath) && !shouldIgnore(absolutePath) {
188+
project.mainGroup.addFileReference(path: content)
189+
}
190+
}
179191

180192
// Add a group for the overriding .xcconfig file, if we have one.
181193
let xcconfigOverridesFileRef: Xcode.FileReference?

0 commit comments

Comments
 (0)