From 95f95be29e09c7548deb266df24b07ffeff1849b Mon Sep 17 00:00:00 2001 From: Bartosz Polaczyk Date: Mon, 18 Apr 2022 09:07:36 +0200 Subject: [PATCH] Identify custom DerivedData under sources dir --- .../Dependencies/DependencyProcessor.swift | 4 ++-- .../DependencyProcessorImplTests.swift | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Sources/XCRemoteCache/Dependencies/DependencyProcessor.swift b/Sources/XCRemoteCache/Dependencies/DependencyProcessor.swift index 5f06874..4308f17 100644 --- a/Sources/XCRemoteCache/Dependencies/DependencyProcessor.swift +++ b/Sources/XCRemoteCache/Dependencies/DependencyProcessor.swift @@ -80,6 +80,8 @@ class DependencyProcessorImpl: DependencyProcessor { return Dependency(url: file, type: .xcode) } else if filePath.hasPrefix(intermediatePath) { return Dependency(url: file, type: .intermediate) + } else if filePath.hasPrefix(derivedFilesPath) { + return Dependency(url: file, type: .derivedFile) } else if let bundle = bundlePath, filePath.hasPrefix(bundle) { // If a target produces a bundle, explicitly classify all // of products to distinguish from other targets products @@ -88,8 +90,6 @@ class DependencyProcessorImpl: DependencyProcessor { return Dependency(url: file, type: .product) } else if filePath.hasPrefix(sourcePath) { return Dependency(url: file, type: .source) - } else if filePath.hasPrefix(derivedFilesPath) { - return Dependency(url: file, type: .derivedFile) } else { return Dependency(url: file, type: .unknown) } diff --git a/Tests/XCRemoteCacheTests/Dependencies/DependencyProcessorImplTests.swift b/Tests/XCRemoteCacheTests/Dependencies/DependencyProcessorImplTests.swift index 2325394..a0ef4e2 100644 --- a/Tests/XCRemoteCacheTests/Dependencies/DependencyProcessorImplTests.swift +++ b/Tests/XCRemoteCacheTests/Dependencies/DependencyProcessorImplTests.swift @@ -210,4 +210,21 @@ class DependencyProcessorImplTests: FileXCTestCase { return sourceDir.appendingPathComponent(filename) } + + func testSkipsCustomizedDerivedDirFileUnderSources() { + let derivedFile: URL = "/DerivedFiles/Module-Swift.h" + let processor = DependencyProcessorImpl( + xcode: "/Xcode", + product: "/", + source: "/", + intermediate: "/Intermediate", + derivedFiles: "/DerivedFiles", + bundle: nil + ) + + XCTAssertEqual( + processor.process([derivedFile]), + [] + ) + } }