Identify custom DerivedData under sources dir

This commit is contained in:
Bartosz Polaczyk
2022-04-18 09:07:36 +02:00
parent 4d12800096
commit 95f95be29e
2 changed files with 19 additions and 2 deletions
@@ -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)
}
@@ -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]),
[]
)
}
}