Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 26 additions & 21 deletions Core/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ let package = Package(

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

extension [Package.Dependency] {
var pro: [Package.Dependency] {
if isProIncluded() {
if isProIncluded {
// include the pro package
return self + [.package(path: "../Pro")]
}
Expand All @@ -399,24 +399,29 @@ extension [Package.Dependency] {

import Foundation

func isProIncluded(file: StaticString = #file) -> Bool {
let filePath = "\(file)"
let fileURL = URL(fileURLWithPath: filePath)
let rootURL = fileURL
.deletingLastPathComponent()
.deletingLastPathComponent()
let confURL = rootURL.appendingPathComponent("PLUS")
if !FileManager.default.fileExists(atPath: confURL.path) {
return false
}
do {
let content = String(
data: try Data(contentsOf: confURL),
encoding: .utf8
)
return content?.hasPrefix("YES") ?? false
} catch {
return false
let isProIncluded: Bool = {
func isProIncluded(file: StaticString = #file) -> Bool {
let filePath = "\(file)"
let fileURL = URL(fileURLWithPath: filePath)
let rootURL = fileURL
.deletingLastPathComponent()
.deletingLastPathComponent()
let confURL = rootURL.appendingPathComponent("PLUS")
if !FileManager.default.fileExists(atPath: confURL.path) {
return false
}
do {
let content = String(
data: try Data(contentsOf: confURL),
encoding: .utf8
)
print("")
return content?.hasPrefix("YES") ?? false
} catch {
return false
}
}
}

return isProIncluded()
}()