Skip to content

[SR-7074] Introduce ability to add top level files #1516

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Sources/Xcodeproj/pbxproj().swift
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,18 @@ func xcodeProject(
// of its manifest file.
let manifestFileRef = project.mainGroup.addFileReference(path: "Package.swift", fileType: "sourcecode.swift")
createPackageDescriptionTarget(for: graph.rootPackages[0], manifestFileRef: manifestFileRef)

// Add root level files to the project.
func shouldIgnore(_ path: AbsolutePath) -> Bool {
return path.basename.hasPrefix(".")
Copy link
Contributor Author

@giginet giginet Mar 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is more useful to ignore dotfiles. (like .gitignore or .DS_Store).

How do you think?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like some files to be included like .swiftlint.yml but that might be possible with a different flag such as --include .swiftlint.yml

|| project.mainGroup.subitems.contains { $0.path == path.basename }
}
for content in try fileSystem.getDirectoryContents(sourceRootDir) {
let absolutePath = AbsolutePath(content, relativeTo: sourceRootDir)
if fileSystem.isFile(absolutePath) && !shouldIgnore(absolutePath) {
project.mainGroup.addFileReference(path: content)
}
}

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