@@ -120,6 +120,81 @@ class SourceGeneratorTests: XCTestCase {
120120 try expect ( [ syncedFolder] ) == pbxProj. nativeTargets. first? . fileSystemSynchronizedGroups
121121 }
122122
123+ $0. it ( " adds excludes as membership exceptions for synced folder " ) {
124+ let directories = """
125+ Sources:
126+ - a.swift
127+ - b.swift
128+ - Generated:
129+ - c.generated.swift
130+ - d.generated.swift
131+ """
132+ try createDirectories ( directories)
133+
134+ let source = TargetSource ( path: " Sources " , excludes: [ " b.swift " , " Generated/*.generated.swift " ] , type: . syncedFolder)
135+ let target = Target ( name: " Test " , type: . application, platform: . iOS, sources: [ source] )
136+ let project = Project ( basePath: directoryPath, name: " Test " , targets: [ target] )
137+
138+ let pbxProj = try project. generatePbxProj ( )
139+ let syncedFolders = try pbxProj. getMainGroup ( ) . children. compactMap { $0 as? PBXFileSystemSynchronizedRootGroup }
140+ let syncedFolder = try unwrap ( syncedFolders. first)
141+
142+ let exceptionSets = syncedFolder. exceptions? . compactMap { $0 as? PBXFileSystemSynchronizedBuildFileExceptionSet }
143+ let exceptionSet = try unwrap ( exceptionSets? . first)
144+ let exceptions = try unwrap ( exceptionSet. membershipExceptions)
145+
146+ try expect ( exceptions. contains ( " b.swift " ) ) == true
147+ try expect ( exceptions. contains ( " Generated/c.generated.swift " ) ) == true
148+ try expect ( exceptions. contains ( " Generated/d.generated.swift " ) ) == true
149+ try expect ( exceptions. contains ( " a.swift " ) ) == false
150+ }
151+
152+ $0. it ( " auto-excludes Info.plist from synced folder membership " ) {
153+ let directories = """
154+ Sources:
155+ - a.swift
156+ - Info.plist
157+ """
158+ try createDirectories ( directories)
159+
160+ let source = TargetSource ( path: " Sources " , type: . syncedFolder)
161+ let target = Target (
162+ name: " Test " ,
163+ type: . application,
164+ platform: . iOS,
165+ settings: Settings ( dictionary: [ " INFOPLIST_FILE " : " Sources/Info.plist " ] ) ,
166+ sources: [ source]
167+ )
168+ let project = Project ( basePath: directoryPath, name: " Test " , targets: [ target] )
169+
170+ let pbxProj = try project. generatePbxProj ( )
171+ let syncedFolders = try pbxProj. getMainGroup ( ) . children. compactMap { $0 as? PBXFileSystemSynchronizedRootGroup }
172+ let syncedFolder = try unwrap ( syncedFolders. first)
173+
174+ let exceptionSets = syncedFolder. exceptions? . compactMap { $0 as? PBXFileSystemSynchronizedBuildFileExceptionSet }
175+ let exceptionSet = try unwrap ( exceptionSets? . first)
176+ let exceptions = try unwrap ( exceptionSet. membershipExceptions)
177+
178+ try expect ( exceptions. contains ( " Info.plist " ) ) == true
179+ }
180+
181+ $0. it ( " adds empty resources build phase for synced folder " ) {
182+ let directories = """
183+ Sources:
184+ - a.swift
185+ """
186+ try createDirectories ( directories)
187+
188+ let source = TargetSource ( path: " Sources " , type: . syncedFolder)
189+ let target = Target ( name: " Test " , type: . application, platform: . iOS, sources: [ source] )
190+ let project = Project ( basePath: directoryPath, name: " Test " , targets: [ target] )
191+
192+ let pbxProj = try project. generatePbxProj ( )
193+ let nativeTarget = try unwrap ( pbxProj. nativeTargets. first)
194+ let hasResourcesPhase = nativeTarget. buildPhases. contains { $0 is PBXResourcesBuildPhase }
195+ try expect ( hasResourcesPhase) == true
196+ }
197+
123198 $0. it ( " supports frameworks in sources " ) {
124199 let directories = """
125200 Sources:
0 commit comments