Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/XcodeGenKit/SourceGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ class SourceGenerator {
sourceReference = group
case .syncedFolder:

let relativePath = (try? path.relativePath(from: project.basePath)) ?? path
let relativePath = (try? path.relativePath(from: basePath)) ?? path
let resolvedExplicitFolders = resolveExplicitFolders(targetSource: targetSource)

let syncedRootGroup: PBXFileSystemSynchronizedRootGroup
Expand Down
21 changes: 21 additions & 0 deletions Tests/XcodeGenKitTests/SourceGeneratorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,27 @@ class SourceGeneratorTests: XCTestCase {
try expect([syncedFolder]) == pbxProj.nativeTargets.first?.fileSystemSynchronizedGroups
}

$0.it("generates synced folder with different projectDirectory") {
let directories = """
SubDir:
Sources:
- a.swift
"""
try createDirectories(directories)

let target = Target(name: "Test", type: .application, platform: .iOS, sources: [.init(path: "Sources", type: .syncedFolder)])
let project = Project(basePath: directoryPath + "SubDir", name: "Test", targets: [target])

let generator = PBXProjGenerator(project: project, projectDirectory: directoryPath)
let pbxProj = try generator.generate()

let syncedFolders = try pbxProj.getMainGroup().children.compactMap { $0 as? PBXFileSystemSynchronizedRootGroup }
let syncedFolder = try unwrap(syncedFolders.first)

try expect(syncedFolder.path) == "SubDir/Sources"
try expect([syncedFolder]) == pbxProj.nativeTargets.first?.fileSystemSynchronizedGroups
}

$0.it("generates synced folder with explicitFolders") {
let directories = """
Sources:
Expand Down