I am attempting to have some circumstances that may add some dependencies to my app in sure circumstances.
right here is an instance of my Package deal.swift
`
import PackageDescription
let package deal = Package deal(
title: “MyService”,
platforms: [.iOS(.v16), .macOS(.v12)],
merchandise: [
.library(
name: “MyService”,
targets: [“MyService”])
],
dependencies: ifMockableDev(add: mockableProductDependencies) + [
.package(
url: "https://github.com/hmlongco/Factory",
branch: "swift6"
)
],
targets: [
.target(
name: "MyService",
dependencies: ifMockableDev(add: mockableTargetDependencies) + [
.product(name: "Factory", package: "Factory")
],
swiftSettings: [
.define("MOCKING", .when(configuration: .debug)),
.enableExperimentalFeature("StrictConcurrency")
]
),
.testTarget(
title: "MyServiceTests",
dependencies: ifMockableDev(add: mockableTestTargetDependencies) + [
"MyService",
.product(name: "Factory", package: "Factory")
])
]
)
non-public let isMockableDev = Context.surroundings[“MOCKABLE_DEV”].flatMap(Bool.init) ?? true
non-public func ifMockableDev(add listing: [T]) -> [T] { isMockableDev ? listing : [] }
non-public let mockableProductDependencies: [Package.Dependency] = [
.package(url: “https://github.com/Kolos65/Mockable”, exact: “0.0.11”)
]
non-public let mockableTargetDependencies: [Target.Dependency] = [
.product(name: “Mockable”, package: “Mockable”)
]
non-public let mockableTestTargetDependencies: [Target.Dependency] = [
.product(name: “MockableTest”, package: “Mockable”)
]
`
I suspected that MOCKABLE_DEV is just not getting seen within the environement. however even when I simply made it
non-public let isMockableDev = true
nonetheless would not get the Packages in any respect.. what am I lacking right here?