From b73aca231a544b3bdaae28a40e9b435d06ffc59b Mon Sep 17 00:00:00 2001 From: Peyman Khanjan Date: Sun, 19 Nov 2017 15:17:58 +0000 Subject: [PATCH] Fix TargetSource excludes tests. --- Sources/XcodeGenKit/SourceGenerator.swift | 6 +++--- Tests/XcodeGenKitTests/ProjectGeneratorTests.swift | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Sources/XcodeGenKit/SourceGenerator.swift b/Sources/XcodeGenKit/SourceGenerator.swift index 0e6e0674..293ed9a9 100644 --- a/Sources/XcodeGenKit/SourceGenerator.swift +++ b/Sources/XcodeGenKit/SourceGenerator.swift @@ -160,7 +160,7 @@ class SourceGenerator { private func getSourceChildren(targetSource: TargetSource, dirPath: Path) throws -> [Path] { - func getSourceExcludes(targetSource: TargetSource, dirPath: Path) -> [Path] { + func getSourceExcludes(dirPath: Path) -> [Path] { return targetSource.excludes.map { Path.glob("\(dirPath)/\($0)") .map { @@ -177,7 +177,7 @@ class SourceGenerator { let defaultExcludedFiles = [".DS_Store"].map { dirPath + Path($0) } - let sourcePath = Path(targetSource.path) + let rootSourcePath = spec.basePath + targetSource.path /* Exclude following if mentioned in TargetSource.excludes. @@ -185,7 +185,7 @@ class SourceGenerator { + Pre-defined Excluded files */ - let sourceExcludeFilePaths: Set = Set(getSourceExcludes(targetSource: targetSource, dirPath: sourcePath) + let sourceExcludeFilePaths: Set = Set(getSourceExcludes(dirPath: rootSourcePath) + defaultExcludedFiles) return try dirPath.children() diff --git a/Tests/XcodeGenKitTests/ProjectGeneratorTests.swift b/Tests/XcodeGenKitTests/ProjectGeneratorTests.swift index 1751a2e1..d7aab883 100644 --- a/Tests/XcodeGenKitTests/ProjectGeneratorTests.swift +++ b/Tests/XcodeGenKitTests/ProjectGeneratorTests.swift @@ -431,10 +431,10 @@ func projectGeneratorTests() { try project.expectFile(paths: ["Sources", "E", "e.jpg"], buildPhase: .resources) try project.expectFile(paths: ["Sources", "E", "e.m"], buildPhase: .sources) try project.expectFile(paths: ["Sources", "E", "e.h"]) - try project.expectFileMissing(paths: ["Sources/B", "b.swift"]) - try project.expectFileMissing(paths: ["Sources/C", "c.h"]) - try project.expectFileMissing(paths: ["Sources/E/F", "f.swift"]) - try project.expectFileMissing(paths: ["Sources/G/H", "h.swift"]) + try project.expectFileMissing(paths: ["Sources", "B", "b.swift"]) + try project.expectFileMissing(paths: ["Sources", "C", "c.h"]) + try project.expectFileMissing(paths: ["Sources", "E", "F", "f.swift"]) + try project.expectFileMissing(paths: ["Sources", "G", "H", "h.swift"]) } $0.it("generates file sources") {