                 .reduce([], +)
         }
         .reduce([], +)
+        )
+    }
+
+    func isIncludedPath(_ path: Path) -> Bool {
+        return !defaultExcludedFiles.contains(where: { path.lastComponent.contains($0)})
+            && !targetSourceExcludePaths.contains(path)
     }
 
     private func getSourceChildren(targetSource: TargetSource, dirPath: Path) throws -> [Path] {
-
-        /*
-         Exclude following if mentioned in TargetSource.excludes.
-         Any path related to source dirPath
-         + Pre-defined Excluded files
-         */
-
-        let sourceExcludeFilePaths: Set<Path> = Set(
-            getSourceExcludes(targetSource: targetSource)
-        )
-
-        func isNotExcludeFilePath(_ path: Path) -> Bool {
-            return !path.lastComponent.contains(".DS_Store")
-                && !sourceExcludeFilePaths.contains(path)
-        }
-
         return try dirPath.children()
             .filter {
                 if $0.isDirectory {
-                    let pathChildren = try $0.children()
-                        .filter(isNotExcludeFilePath(_:))
-
-                    return !pathChildren.isEmpty
+                    let children = try $0.children().filter(isIncludedPath)
+                    return !children.isEmpty
                 } else if $0.isFile {
-                    return isNotExcludeFilePath($0)
+                    return isIncludedPath($0)
                 } else {
                     return false
                 }

        return variantGroup
    }

    private func getSourceExcludes(targetSource: TargetSource) -> [Path] {
        let rootSourcePath = spec.basePath + targetSource.path

        return targetSource.excludes.map {
            Path.glob("\(rootSourcePath)/\($0)")
                .map {
                    guard $0.isDirectory else {


    private let spec: ProjectSpec
    var addObjectClosure: (String, PBXObject) -> String
    var targetSourceExcludePaths: Set<Path> = []
    var defaultExcludedFiles = [
        ".DS_Store"
    ]

    var targetName: String = ""

