mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2026-03-18 20:02:25 +00:00
Fix folder source PBXFileReference path regression with createIntermediateGroups (#1605)
Skip makePathRelative for folder-type sources since they use sourceTree .sourceRoot and need the full project-relative path preserved. The call was inadvertently added for all source types in #1596 but only synced folders (.syncedFolder) need it. Fixes #1603
This commit is contained in:
@@ -780,7 +780,9 @@ class SourceGenerator {
|
||||
try makePathRelative(for: sourceReference, at: path)
|
||||
} else if createIntermediateGroups {
|
||||
createIntermediaGroups(for: sourceReference, at: sourcePath)
|
||||
try makePathRelative(for: sourceReference, at: sourcePath)
|
||||
if type != .folder {
|
||||
try makePathRelative(for: sourceReference, at: sourcePath)
|
||||
}
|
||||
}
|
||||
|
||||
return sourceFiles
|
||||
|
||||
@@ -968,6 +968,29 @@ class SourceGeneratorTests: XCTestCase {
|
||||
try pbxProj.expectFileMissing(paths: ["Sources", "A", "a.swift"])
|
||||
}
|
||||
|
||||
$0.it("generates folder references with createIntermediateGroups") {
|
||||
let directories = """
|
||||
Sources:
|
||||
A:
|
||||
- a.resource
|
||||
- b.resource
|
||||
"""
|
||||
try createDirectories(directories)
|
||||
|
||||
let target = Target(name: "Test", type: .application, platform: .iOS, sources: [
|
||||
TargetSource(path: "Sources/A", type: .folder),
|
||||
])
|
||||
let project = Project(
|
||||
basePath: directoryPath,
|
||||
name: "Test",
|
||||
targets: [target],
|
||||
options: .init(createIntermediateGroups: true)
|
||||
)
|
||||
|
||||
let pbxProj = try project.generatePbxProj()
|
||||
try pbxProj.expectFile(paths: ["Sources", "Sources/A"], names: ["Sources", "A"], buildPhase: .resources)
|
||||
}
|
||||
|
||||
$0.it("adds files to correct build phase") {
|
||||
let directories = """
|
||||
A:
|
||||
|
||||
Reference in New Issue
Block a user