@@ -569,20 +569,23 @@ class FilesBasedBuildPhaseTaskProducerBase: PhasedTaskProducer {
569
569
}
570
570
571
571
let sourceFiles = ( self . targetContext. configuredTarget? . target as? StandardTarget ) ? . sourcesBuildPhase? . buildFiles. count ?? 0
572
- if scope. evaluate ( BuiltinMacros . ASSETCATALOG_COMPILER_GENERATE_ASSET_SYMBOLS) && ( sourceFiles > 0 ) {
573
- // Process asset catalogs first to workaround issue where generated sources aren't added to main source code group.
574
- // rdar://102834701 (File grouping for 'collection groups' is sensitive to ordering of build phase members)
575
- var assetCatalogBuildFiles = [ ResolvedBuildFile] ( )
576
- var otherBuildFiles = [ ResolvedBuildFile] ( )
577
- for resolvedBuildFile in resolvedBuildFiles {
578
- if resolvedBuildFile. fileTypeSpec. conformsTo ( identifier: " folder.abstractassetcatalog " ) {
579
- assetCatalogBuildFiles. append ( resolvedBuildFile)
580
- }
581
- else {
582
- otherBuildFiles. append ( resolvedBuildFile)
583
- }
572
+ var compileToSwiftFileTypes : [ String ] = [ ]
573
+ for groupingStragegyExtensions in await context. workspaceContext. core. pluginManager. extensions ( of: InputFileGroupingStrategyExtensionPoint . self) {
574
+ compileToSwiftFileTypes. append ( contentsOf: groupingStragegyExtensions. fileTypesCompilingToSwiftSources ( ) )
575
+ }
576
+
577
+ // Reorder resolvedBuildFiles so that file types which compile to Swift appear first in the list and so are processed first.
578
+ // This is needed because generated sources aren't added to the the main source code list.
579
+ // rdar://102834701 (File grouping for 'collection groups' is sensitive to ordering of build phase members)
580
+ var compileToSwiftFiles = [ ResolvedBuildFile] ( )
581
+ var otherBuildFiles = [ ResolvedBuildFile] ( )
582
+ for resolvedBuildFile in resolvedBuildFiles {
583
+ if compileToSwiftFileTypes. contains ( where: { identifier in resolvedBuildFile. fileTypeSpec. conformsTo ( identifier: identifier) } ) {
584
+ compileToSwiftFiles. append ( resolvedBuildFile)
585
+ } else {
586
+ otherBuildFiles. append ( resolvedBuildFile)
584
587
}
585
- resolvedBuildFiles = assetCatalogBuildFiles + otherBuildFiles
588
+ resolvedBuildFiles = compileToSwiftFiles + otherBuildFiles
586
589
}
587
590
588
591
// Allow subclasses to provide additional content
0 commit comments