Skip to content
Open
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
42 changes: 41 additions & 1 deletion Sources/XcodeGenKit/PBXProjGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,8 @@ public class PBXProjGenerator {

func addResourcesBuildPhase() {
let resourcesBuildPhaseFiles = getBuildFilesForPhase(.resources) + copyResourcesReferences
if !resourcesBuildPhaseFiles.isEmpty {
let hasSynchronizedRootGroups = sourceFiles.contains { $0.fileReference is PBXFileSystemSynchronizedRootGroup }
if !resourcesBuildPhaseFiles.isEmpty || hasSynchronizedRootGroups {
let resourcesBuildPhase = addObject(PBXResourcesBuildPhase(files: resourcesBuildPhaseFiles))
buildPhases.append(resourcesBuildPhase)
}
Expand Down Expand Up @@ -1458,6 +1459,45 @@ public class PBXProjGenerator {
// add fileSystemSynchronizedGroups
let synchronizedRootGroups = sourceFiles.compactMap { $0.fileReference as? PBXFileSystemSynchronizedRootGroup }
if !synchronizedRootGroups.isEmpty {
for syncedGroup in synchronizedRootGroups {
guard let syncedGroupPath = syncedGroup.path else { continue }
let syncedPath = (project.basePath + Path(syncedGroupPath)).normalize()

if let targetSource = target.sources.first(where: {
let sourcePath = (project.basePath + $0.path).normalize()
return sourcePath == syncedPath
}) {
var membershipExceptions = targetSource.excludes

for infoPlistPath in infoPlistFiles.values {
let infoPlistFullPath = (project.basePath + infoPlistPath).normalize()
if infoPlistFullPath.string.hasPrefix(syncedPath.string + "/") {
if let relativePath = try? infoPlistFullPath.relativePath(from: syncedPath) {
let relativePathString = relativePath.string
if !membershipExceptions.contains(relativePathString) {
membershipExceptions.append(relativePathString)
}
}
}
}

if !membershipExceptions.isEmpty {
let exceptionSet = PBXFileSystemSynchronizedBuildFileExceptionSet(
target: targetObject,
membershipExceptions: membershipExceptions,
publicHeaders: nil,
privateHeaders: nil,
additionalCompilerFlagsByRelativePath: nil,
attributesByRelativePath: nil
)
addObject(exceptionSet)
if syncedGroup.exceptions == nil {
syncedGroup.exceptions = []
}
syncedGroup.exceptions?.append(exceptionSet)
}
}
}
targetObject.fileSystemSynchronizedGroups = synchronizedRootGroups
}
}
Expand Down
Loading