Skip to content

Commit

Permalink
chore: Correctly declare dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippeWeidmann committed Oct 22, 2024
1 parent 688a8ff commit 644120d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 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
22 changes: 18 additions & 4 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 @@ -37,18 +52,17 @@ let package = Package(
.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: "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 644120d

Please sign in to comment.