@@ -33,7 +33,6 @@ import enum SwiftBuild.ProjectModel
33
33
34
34
/// Extension to create PIF **products** for a given package.
35
35
extension PackagePIFProjectBuilder {
36
-
37
36
// MARK: - Main Module Products
38
37
39
38
mutating func makeMainModuleProduct( _ product: PackageGraph . ResolvedProduct ) throws {
@@ -86,7 +85,7 @@ extension PackagePIFProjectBuilder {
86
85
log (
87
86
. debug,
88
87
" Created \( mainModuleTarget. productType) ) ' \( mainModuleTarget. id) ' " +
89
- " with name ' \( mainModuleTarget. name) ' and product name ' \( mainModuleTarget. productName) ' "
88
+ " with name ' \( mainModuleTarget. name) ' and product name ' \( mainModuleTarget. productName) ' "
90
89
)
91
90
}
92
91
@@ -114,14 +113,19 @@ extension PackagePIFProjectBuilder {
114
113
settings [ . PACKAGE_RESOURCE_TARGET_KIND] = " regular "
115
114
settings [ . PRODUCT_NAME] = " $(TARGET_NAME) "
116
115
settings [ . PRODUCT_MODULE_NAME] = product. c99name
117
- settings [ . PRODUCT_BUNDLE_IDENTIFIER] = " \( self . package . identity) . \( product. name) " . spm_mangledToBundleIdentifier ( )
116
+ settings [ . PRODUCT_BUNDLE_IDENTIFIER] = " \( self . package . identity) . \( product. name) "
117
+ . spm_mangledToBundleIdentifier ( )
118
118
settings [ . EXECUTABLE_NAME] = product. name
119
119
settings [ . CLANG_ENABLE_MODULES] = " YES "
120
120
settings [ . SWIFT_PACKAGE_NAME] = mainModule. packageName
121
121
122
122
if mainModule. type == . test {
123
123
// FIXME: we shouldn't always include both the deep and shallow bundle paths here, but for that we'll need rdar://31867023
124
- settings [ . LD_RUNPATH_SEARCH_PATHS] = [ " @loader_path/Frameworks " , " @loader_path/../Frameworks " , " $(inherited) " ]
124
+ settings [ . LD_RUNPATH_SEARCH_PATHS] = [
125
+ " @loader_path/Frameworks " ,
126
+ " @loader_path/../Frameworks " ,
127
+ " $(inherited) " ,
128
+ ]
125
129
settings [ . GENERATE_INFOPLIST_FILE] = " YES "
126
130
settings [ . SKIP_INSTALL] = " NO "
127
131
settings [ . SWIFT_ACTIVE_COMPILATION_CONDITIONS] . lazilyInitialize { [ " $(inherited) " ] }
@@ -179,13 +183,14 @@ extension PackagePIFProjectBuilder {
179
183
// Note that the indexer requires them to have any symbolic links resolved.
180
184
var indexableFileURLs : [ SourceControlURL ] = [ ]
181
185
for sourcePath in mainModule. sourceFileRelativePaths {
182
- let sourceFileRef = self . project. mainGroup [ keyPath: mainTargetSourceFileGroupKeyPath] . addFileReference { id in
183
- FileReference (
184
- id: id,
185
- path: sourcePath. pathString,
186
- pathBase: . groupDir
187
- )
188
- }
186
+ let sourceFileRef = self . project. mainGroup [ keyPath: mainTargetSourceFileGroupKeyPath]
187
+ . addFileReference { id in
188
+ FileReference (
189
+ id: id,
190
+ path: sourcePath. pathString,
191
+ pathBase: . groupDir
192
+ )
193
+ }
189
194
self . project [ keyPath: mainModuleTargetKeyPath] . addSourceFile { id in
190
195
BuildFile ( id: id, fileRef: sourceFileRef)
191
196
}
@@ -199,13 +204,14 @@ extension PackagePIFProjectBuilder {
199
204
200
205
// Add any additional source files emitted by custom build commands.
201
206
for path in generatedSourceFiles {
202
- let sourceFileRef = self . project. mainGroup [ keyPath: mainTargetSourceFileGroupKeyPath] . addFileReference { id in
203
- FileReference (
204
- id: id,
205
- path: path. pathString,
206
- pathBase: . absolute
207
- )
208
- }
207
+ let sourceFileRef = self . project. mainGroup [ keyPath: mainTargetSourceFileGroupKeyPath]
208
+ . addFileReference { id in
209
+ FileReference (
210
+ id: id,
211
+ path: path. pathString,
212
+ pathBase: . absolute
213
+ )
214
+ }
209
215
self . project [ keyPath: mainModuleTargetKeyPath] . addSourceFile { id in
210
216
BuildFile ( id: id, fileRef: sourceFileRef)
211
217
}
@@ -285,7 +291,7 @@ extension PackagePIFProjectBuilder {
285
291
// Add build tool commands to the resource bundle target.
286
292
let mainResourceBundleTargetKeyPath = self . resourceBundleTargetKeyPath ( forModuleName: mainModule. name)
287
293
let resourceBundleTargetKeyPath = mainResourceBundleTargetKeyPath ?? mainModuleTargetKeyPath
288
-
294
+
289
295
addBuildToolCommands (
290
296
module: mainModule,
291
297
sourceModuleTargetKeyPath: mainModuleTargetKeyPath,
@@ -357,7 +363,7 @@ extension PackagePIFProjectBuilder {
357
363
358
364
// Link with a testable version of the macro if appropriate.
359
365
if product. type == . test {
360
- self . project [ keyPath: mainModuleTargetKeyPath] . common. addDependency (
366
+ self . project [ keyPath: mainModuleTargetKeyPath] . common. addDependency (
361
367
on: moduleDependency. pifTargetGUID ( suffix: . testable) ,
362
368
platformFilters: packageConditions
363
369
. toPlatformFilter ( toolsVersion: package . manifest. toolsVersion) ,
@@ -620,7 +626,7 @@ extension PackagePIFProjectBuilder {
620
626
log (
621
627
. debug,
622
628
" Created target ' \( librayTarget. id) ' of type ' \( librayTarget. productType) ' with " +
623
- " name ' \( librayTarget. name) ' and product name ' \( librayTarget. productName) ' "
629
+ " name ' \( librayTarget. name) ' and product name ' \( librayTarget. productName) ' "
624
630
)
625
631
}
626
632
@@ -651,7 +657,10 @@ extension PackagePIFProjectBuilder {
651
657
for module in product. modules where module. underlying. isSourceModule && module. resources. hasContent {
652
658
// FIXME: Find a way to determine whether a module has generated resources
653
659
// here so that we can embed resources into dynamic targets.
654
- self . project [ keyPath: librayUmbrellaTargetKeyPath] . common. addDependency ( on: pifTargetIdForResourceBundle ( module. name) , platformFilters: [ ] )
660
+ self . project [ keyPath: librayUmbrellaTargetKeyPath] . common. addDependency (
661
+ on: pifTargetIdForResourceBundle ( module. name) ,
662
+ platformFilters: [ ]
663
+ )
655
664
656
665
let packageName = self . package . name
657
666
let fileRef = self . project. mainGroup. addFileReference { id in
@@ -663,7 +672,11 @@ extension PackagePIFProjectBuilder {
663
672
}
664
673
log ( . debug, indent: 1 , " Added use of resource bundle ' \( fileRef. path) ' " )
665
674
} else {
666
- log ( . debug, indent: 1 , " Ignored resource bundle ' \( fileRef. path) ' because resource embedding is disabled " )
675
+ log (
676
+ . debug,
677
+ indent: 1 ,
678
+ " Ignored resource bundle ' \( fileRef. path) ' because resource embedding is disabled "
679
+ )
667
680
}
668
681
}
669
682
@@ -708,7 +721,7 @@ extension PackagePIFProjectBuilder {
708
721
// This assertion is temporarily disabled since we may see targets from
709
722
// _other_ packages, but this should be resolved; see rdar://95467710.
710
723
/* assert(moduleDependency.packageName == self.package.name) */
711
-
724
+
712
725
if moduleDependency. type == . systemModule {
713
726
log ( . debug, indent: 1 , " Noted use of system module ' \( moduleDependency. name) ' " )
714
727
return
@@ -920,7 +933,7 @@ extension PackagePIFProjectBuilder {
920
933
name: pluginProduct. name
921
934
)
922
935
}
923
- do {
936
+ do {
924
937
let pluginTarget = self . project [ keyPath: pluginTargetKeyPath]
925
938
log ( . debug, " Created aggregate target ' \( pluginTarget. id) ' with name ' \( pluginTarget. name) ' " )
926
939
}
0 commit comments