Skip to content

Commit 4626bd3

Browse files
committed
Merge branch 'hotfix/build-without-plus'
2 parents 76fbd44 + 11ba954 commit 4626bd3

File tree

1 file changed

+26
-21
lines changed

1 file changed

+26
-21
lines changed

Core/Package.swift

+26-21
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ let package = Package(
379379

380380
extension [Target.Dependency] {
381381
func pro(_ targetNames: [String]) -> [Target.Dependency] {
382-
if isProIncluded() {
382+
if isProIncluded {
383383
// include the pro package
384384
return self + targetNames.map { Target.Dependency.product(name: $0, package: "Pro") }
385385
}
@@ -389,7 +389,7 @@ extension [Target.Dependency] {
389389

390390
extension [Package.Dependency] {
391391
var pro: [Package.Dependency] {
392-
if isProIncluded() {
392+
if isProIncluded {
393393
// include the pro package
394394
return self + [.package(path: "../Pro")]
395395
}
@@ -399,24 +399,29 @@ extension [Package.Dependency] {
399399

400400
import Foundation
401401

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+
}
420423
}
421-
}
424+
425+
return isProIncluded()
426+
}()
422427

0 commit comments

Comments
 (0)