@@ -379,7 +379,7 @@ let package = Package(
379
379
380
380
extension [ Target . Dependency ] {
381
381
func pro( _ targetNames: [ String ] ) -> [ Target . Dependency ] {
382
- if isProIncluded ( ) {
382
+ if isProIncluded {
383
383
// include the pro package
384
384
return self + targetNames. map { Target . Dependency. product ( name: $0, package : " Pro " ) }
385
385
}
@@ -389,7 +389,7 @@ extension [Target.Dependency] {
389
389
390
390
extension [ Package . Dependency ] {
391
391
var pro : [ Package . Dependency ] {
392
- if isProIncluded ( ) {
392
+ if isProIncluded {
393
393
// include the pro package
394
394
return self + [ . package ( path: " ../Pro " ) ]
395
395
}
@@ -399,24 +399,29 @@ extension [Package.Dependency] {
399
399
400
400
import Foundation
401
401
402
- func isProIncluded( file: StaticString = #file) -> Bool {
403
- let filePath = " \( file) "
404
- let fileURL = URL ( fileURLWithPath: filePath)
405
- let rootURL = fileURL
406
- . deletingLastPathComponent ( )
407
- . deletingLastPathComponent ( )
408
- let confURL = rootURL. appendingPathComponent ( " PLUS " )
409
- if !FileManager. default. fileExists ( atPath: confURL. path) {
410
- return false
411
- }
412
- do {
413
- let content = String (
414
- data: try Data ( contentsOf: confURL) ,
415
- encoding: . utf8
416
- )
417
- return content? . hasPrefix ( " YES " ) ?? false
418
- } catch {
419
- return false
402
+ let isProIncluded : Bool = {
403
+ func isProIncluded( file: StaticString = #file) -> Bool {
404
+ let filePath = " \( file) "
405
+ let fileURL = URL ( fileURLWithPath: filePath)
406
+ let rootURL = fileURL
407
+ . deletingLastPathComponent ( )
408
+ . deletingLastPathComponent ( )
409
+ let confURL = rootURL. appendingPathComponent ( " PLUS " )
410
+ if !FileManager. default. fileExists ( atPath: confURL. path) {
411
+ return false
412
+ }
413
+ do {
414
+ let content = String (
415
+ data: try Data ( contentsOf: confURL) ,
416
+ encoding: . utf8
417
+ )
418
+ print ( " " )
419
+ return content? . hasPrefix ( " YES " ) ?? false
420
+ } catch {
421
+ return false
422
+ }
420
423
}
421
- }
424
+
425
+ return isProIncluded ( )
426
+ } ( )
422
427
0 commit comments