Skip to content

Commit

Permalink
chore: Correctly declare dependencies (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippeWeidmann authored Dec 20, 2024
2 parents e0eca07 + c3fcb72 commit eaf53f3
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Build
run: xcodebuild -scheme InfomaniakCore build -destination "platform=iOS Simulator,name=iPhone 16,OS=latest"
- name: Test
run: xcodebuild -scheme InfomaniakCore-Package test -destination "platform=iOS Simulator,name=iPhone 16,OS=latest"
run: Scripts/prepareForTesting.sh && xcodebuild -scheme InfomaniakCore-Package test -destination "platform=iOS Simulator,name=iPhone 16,OS=latest"

build_and_test_macOS:
name: Build and Test project on macOS
Expand All @@ -35,4 +35,4 @@ jobs:
- name: Build
run: swift build
- name: Test
run: swift test
run: Scripts/prepareForTesting.sh && swift test
20 changes: 10 additions & 10 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/Alamofire/Alamofire",
"state" : {
"revision" : "ea6a94b7dddffd0ca4d0f29252d95310b84dec84",
"version" : "5.10.0"
"revision" : "513364f870f6bfc468f9d2ff0a95caccc10044c5",
"version" : "5.10.2"
}
},
{
Expand Down Expand Up @@ -50,35 +50,35 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/realm/realm-core.git",
"state" : {
"revision" : "c2552e1d36867cb42b28130e894a81fc17081062",
"version" : "14.12.0"
"revision" : "85eeca41654cc9070ad81a21a4b1d153ad467c33",
"version" : "14.13.1"
}
},
{
"identity" : "realm-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/realm/realm-swift",
"state" : {
"revision" : "5221a83dc720823e3017493394d00d49ccf13446",
"version" : "10.52.3"
"revision" : "a3abcdf95a3176f5ad990239920aad4ef86e00de",
"version" : "10.54.2"
}
},
{
"identity" : "sentry-cocoa",
"kind" : "remoteSourceControl",
"location" : "https://github.com/getsentry/sentry-cocoa",
"state" : {
"revision" : "54cc2e3e4fcbf9d4c7708ce00d3b6eee29aecbb1",
"version" : "8.38.0"
"revision" : "110fbe350c057722288b39e757afcb0830695d75",
"version" : "8.42.0"
}
},
{
"identity" : "swift-log",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-log",
"state" : {
"revision" : "9cb486020ebf03bfa5b5df985387a14a98744537",
"version" : "1.6.1"
"revision" : "96a2f8a0fa41e9e09af4585e2724c4e825410b91",
"version" : "1.6.2"
}
},
{
Expand Down
24 changes: 19 additions & 5 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
// swift-tools-version:5.7
// The swift-tools-version declares the minimum version of Swift required to build this package.

import Foundation
import PackageDescription

let resolveDependenciesForTesting = false

let realmDependencies: [Target.Dependency]
if resolveDependenciesForTesting {
realmDependencies = [
.product(name: "RealmSwift", package: "realm-swift")
]
} else {
realmDependencies = [
.product(name: "Realm", package: "realm-swift"),
.product(name: "RealmSwift", package: "realm-swift")
]
}

let package = Package(
name: "InfomaniakCore",
platforms: [
Expand Down Expand Up @@ -36,19 +51,18 @@ let package = Package(
"Alamofire",
.product(name: "InfomaniakDI", package: "ios-dependency-injection"),
.product(name: "InfomaniakLogin", package: "ios-login"),
.product(name: "Sentry", package: "sentry-cocoa"),
.product(name: "RealmSwift", package: "realm-swift"),
.product(name: "Sentry-Dynamic", package: "sentry-cocoa"),
.product(name: "CocoaLumberjackSwift", package: "CocoaLumberjack"),
.product(name: "CocoaLumberjack", package: "CocoaLumberjack"),
.product(name: "OSInfo", package: "OSInfo")
]
),
.target(
name: "InfomaniakCoreDB",
dependencies: [
"InfomaniakCore",
.product(name: "InfomaniakDI", package: "ios-dependency-injection"),
.product(name: "RealmSwift", package: "realm-swift")
]
.product(name: "InfomaniakDI", package: "ios-dependency-injection")
] + realmDependencies
),
.testTarget(
name: "InfomaniakCoreTests",
Expand Down
7 changes: 7 additions & 0 deletions Scripts/prepareForTesting.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

file="Package.swift"

sed -i '' 's/let resolveDependenciesForTesting = false/let resolveDependenciesForTesting = true/' "$file"

echo "$file ready for tests"

0 comments on commit eaf53f3

Please sign in to comment.