Skip to content

Commit

Permalink
Merge branch 'hotfix/build-without-plus'
Browse files Browse the repository at this point in the history
  • Loading branch information
intitni committed Oct 3, 2023
2 parents 76fbd44 + 11ba954 commit 4626bd3
Showing 1 changed file with 26 additions and 21 deletions.
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()
}()

0 comments on commit 4626bd3

Please sign in to comment.