mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2026-03-18 20:02:25 +00:00
Synced folders (#1541)
* update xcodeproj to 8.27.7 * add syncedFolder source type * drop xcode 15 support * Rely on fileReference instead of adding new synchronizedRootGroup (#1557) * fix: don't include untracked children in cache --------- Co-authored-by: Kirill Yakimovich <kirill.yakimovich@gmail.com>
This commit is contained in:
co-authored by
Kirill Yakimovich
parent
53cb43cb66
commit
c32aa4cc94
@@ -1454,6 +1454,12 @@ public class PBXProjGenerator {
|
||||
if !target.isLegacy {
|
||||
targetObject.productType = target.type
|
||||
}
|
||||
|
||||
// add fileSystemSynchronizedGroups
|
||||
let synchronizedRootGroups = sourceFiles.compactMap { $0.fileReference as? PBXFileSystemSynchronizedRootGroup }
|
||||
if !synchronizedRootGroups.isEmpty {
|
||||
targetObject.fileSystemSynchronizedGroups = synchronizedRootGroups
|
||||
}
|
||||
}
|
||||
|
||||
private func makePlatformFilter(for filter: Dependency.PlatformFilter) -> String? {
|
||||
|
||||
@@ -687,6 +687,32 @@ class SourceGenerator {
|
||||
|
||||
sourceFiles += groupSourceFiles
|
||||
sourceReference = group
|
||||
case .syncedFolder:
|
||||
|
||||
let relativePath = (try? path.relativePath(from: project.basePath)) ?? path
|
||||
|
||||
let syncedRootGroup = PBXFileSystemSynchronizedRootGroup(
|
||||
sourceTree: .group,
|
||||
path: relativePath.string,
|
||||
name: targetSource.name,
|
||||
explicitFileTypes: [:],
|
||||
exceptions: [],
|
||||
explicitFolders: []
|
||||
)
|
||||
addObject(syncedRootGroup)
|
||||
sourceReference = syncedRootGroup
|
||||
|
||||
// TODO: adjust if hasCustomParent == true
|
||||
rootGroups.insert(syncedRootGroup)
|
||||
|
||||
let sourceFile = generateSourceFile(
|
||||
targetType: targetType,
|
||||
targetSource: targetSource,
|
||||
path: path,
|
||||
fileReference: syncedRootGroup,
|
||||
buildPhases: buildPhases
|
||||
)
|
||||
sourceFiles.append(sourceFile)
|
||||
}
|
||||
|
||||
if hasCustomParent {
|
||||
@@ -703,7 +729,17 @@ class SourceGenerator {
|
||||
///
|
||||
/// While `TargetSource` declares `type`, its optional and in the event that the value is not defined then we must resolve a sensible default based on the path of the source.
|
||||
private func resolvedTargetSourceType(for targetSource: TargetSource, at path: Path) -> SourceType {
|
||||
return targetSource.type ?? (path.isFile || path.extension != nil ? .file : .group)
|
||||
if let chosenType = targetSource.type {
|
||||
return chosenType
|
||||
} else {
|
||||
if path.isFile || path.extension != nil {
|
||||
return .file
|
||||
} else if let sourceType = project.options.defaultSourceDirectoryType {
|
||||
return sourceType
|
||||
} else {
|
||||
return .group
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func createParentGroups(_ parentGroups: [String], for fileElement: PBXFileElement) {
|
||||
|
||||
@@ -16,7 +16,7 @@ extension Project {
|
||||
}
|
||||
|
||||
var objectVersion: UInt {
|
||||
54
|
||||
70
|
||||
}
|
||||
|
||||
var minimizedProjectReferenceProxies: Int {
|
||||
|
||||
@@ -38,6 +38,8 @@ extension PBXProj {
|
||||
string += "\n 🌎 " + variantGroup.nameOrPath
|
||||
} else if let versionGroup = child as? XCVersionGroup {
|
||||
string += "\n 🔢 " + versionGroup.nameOrPath
|
||||
} else if let syncedFolder = child as? PBXFileSystemSynchronizedRootGroup {
|
||||
string += "\n 📁 " + syncedFolder.nameOrPath
|
||||
}
|
||||
}
|
||||
return string
|
||||
|
||||
Reference in New Issue
Block a user