Skip to content

Commit

Permalink
factorize package.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
bioche committed Sep 26, 2021
1 parent f78108d commit 53b76c3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 80 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/.swiftpm/xcode/package.xcworkspace/xcuserdata/bioche.xcuserdatad/UserInterfaceState.xcuserstate
/.swiftpm/xcode/xcuserdata/bioche.xcuserdatad/xcschemes/xcschememanagement.plist

This file was deleted.

77 changes: 21 additions & 56 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,34 @@

import PackageDescription

#if swift(>=5.5)
let realmVersion = "10.15.1"

let package = Package(
name: "RealmBinaries",
platforms: [.iOS("13.4")],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "Realm",
targets: ["Realm"]),
.library(
name: "RealmSwift",
targets: ["RealmSwift"])
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
// .binaryTarget(
// name: "Realm",
// path: "Realm.xcframework"
// ),
// .binaryTarget(
// name: "RealmSwift",
// path: "RealmSwift.xcframework"
// ),
func buildTargets() -> [Target] {
let baseURL = "https://github.com/bioche/RealmBinaries/releases/download/\(realmVersion)"

#if swift(>=5.5)
let xcodeVersion = "13"
let realmChecksum = "389e2b498c1a7fba317be118f784114fac561b25a0ba1bb83673d87fc16360e2"
let realmSwiftChecksum = "fe8d5c19dd007970a4b1ded7bab78751b631959ceebec576aa0e064fc232393c"
#else
let xcodeVersion = "12_5_1"
let realmChecksum = "f32a21da217bfcd962528d33ba70971b1aede6f46db4d5ae16384292de20e0c5"
let realmSwiftChecksum = "0b7e58617887ef77dff7e74802e7809cb4ffd4444a5e0ca85b8cb3cdba063ebf"
#endif

return [
.binaryTarget(
name: "Realm",
url: "https://github.com/bioche/RealmBinaries/releases/download/10.15.1/realm_13.zip",
checksum: "389e2b498c1a7fba317be118f784114fac561b25a0ba1bb83673d87fc16360e2"
url: "\(baseURL)/Realm_\(xcodeVersion).xcframework.zip",
checksum: realmChecksum
),
.binaryTarget(
name: "RealmSwift",
url: "https://github.com/bioche/RealmBinaries/releases/download/10.15.1/realmSwift_13.zip",
checksum: "fe8d5c19dd007970a4b1ded7bab78751b631959ceebec576aa0e064fc232393c"
url: "\(baseURL)/RealmSwift_\(xcodeVersion).xcframework.zip",
checksum: realmSwiftChecksum
)
]
)

#else
}

let package = Package(
name: "RealmBinaries",
Expand All @@ -55,29 +44,5 @@ let package = Package(
name: "RealmSwift",
targets: ["RealmSwift"])
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
// .binaryTarget(
// name: "Realm",
// path: "12.5.1/Realm.xcframework"
// ),
// .binaryTarget(
// name: "RealmSwift",
// path: "12.5.1/RealmSwift.xcframework"
// ),
.binaryTarget(
name: "Realm",
url: "https://github.com/bioche/RealmBinaries/releases/download/10.15.1/realm_12_5_1.zip",
checksum: "f32a21da217bfcd962528d33ba70971b1aede6f46db4d5ae16384292de20e0c5"
),
.binaryTarget(
name: "RealmSwift",
url: "https://github.com/bioche/RealmBinaries/releases/download/10.15.1/realmSwift_12_5_1.zip",
checksum: "0b7e58617887ef77dff7e74802e7809cb4ffd4444a5e0ca85b8cb3cdba063ebf"
)
]
targets: buildTargets()
)


#endif

0 comments on commit 53b76c3

Please sign in to comment.