I’ve faced with very strange issue during splitting big monolith project on submodules.
I’m trying to build EventTracking framework and add tests to it.
we have a several different servers that need to be configured with different Configurations = .debug(name: "Develop-Debug"), .debug(name: "Stage-Debug")... etc.
We have a separated framework for network management and some additional helpers(named Internal_Framework_With_Helpers and Internal_Networking_Framework accordingly)
Both Project.swift
files for frameworks(Internal_Framework_With_Helpers and Internal_Networking_Framework) also contains whole list of custom configurations.
All projects generates and builds successfully without errors.
BUT when I try to write some test for EventTracking submodule and add @testable
macro to import EventTracking
I’m got error Module ‘EventTracking’ was not compiled for testing
I’ve tried to remove custom configurations from EventTracking submodule’s Project.swift
file and generate project.
In this case I’m NOT got error Module ‘EventTracking’ was not compiled for testing
But my whole project stop building at all and I’m receiving a lot of errors
Here is an my EventTracking submodule Project.swift
file
let project = Project(
name: "EventTracking",
organizationName: "com.organizationName",
options: .options(
automaticSchemesOptions: Project.Options.AutomaticSchemesOptions.enabled(
targetSchemesGrouping: .byNameSuffix(
build: [
"",
"Interface",
"Testing"
],
test: ["Tests"],
run: []
),
codeCoverageEnabled: true,
testingOptions: []
)
),
settings: .settings(
base: [
"OTHER_LDFLAGS": "$(inherited) -ObjC"
],
configurations: [
.debug(name: "Develop-Debug"),
.debug(name: "Stage-Debug"),
.debug(name: "Prod-Debug"),
.debug(name: "Test1-Debug"),
.debug(name: "Test2-Debug"),
.debug(name: "Test3-Debug"),
.debug(name: "Test4-Debug"),
.release(name: "Develop-Release"),
.release(name: "Stage-Release"),
.release(name: "Prod-Release"),
.release(name: "Test1-Release"),
.release(name: "Test2-Release"),
.release(name: "Test3-Release"),
.release(name: "Test4-Release"),
],
defaultSettings: .recommended
),
targets: [
.target(
name: "EventTracking",
destinations: [
.iPhone,
.macWithiPadDesign
],
product: .framework,
bundleId: "com.organizationName.EventTracking",
deploymentTargets: DeploymentTargets.iOS("15.0"),
sources: .paths(
["Sources/**/*.swift"]
),
dependencies: [
TargetDependency.package(
product: "AppsFlyerLib"
),
TargetDependency.project(
target: "Internal_Framework_With_Helpers",
path: .relativeToRoot("Projects/Internal_Framework_With_Helpers")
),
TargetDependency.project(
target: "Internal_Networking_Framework",
path: .relativeToRoot("Projects/Internal_Networking_Framework")
)
],
settings: .settings(
base: [
"DEVELOPMENT_ASSET_PATHS" : [""]
],
configurations: [],
defaultSettings: .recommended
)
),
.target(
name: "EventTrackingTests",
destinations: [
.iPhone,
.macWithiPadDesign
],
product: .unitTests,
bundleId: "com.organizationName.EventTrackingTests",
deploymentTargets: DeploymentTargets.iOS("15.0"),
sources: .paths(
["Tests/**/*.swift"]
),
dependencies: [
TargetDependency.project(
target: "EventTracking",
path: .relativeToRoot("Projects/Data/EventTracking")
),
TargetDependency.project(
target: "Internal_TestingSupport_Framework",
path: .relativeToRoot("Projects/Data/Internal_TestingSupport_Framework")
)
],
settings: .settings(
base: [
"DEVELOPMENT_ASSET_PATHS" : [""]
],
configurations: [],
defaultSettings: .recommended
)
)
],
additionalFiles: [],
resourceSynthesizers: [
.assets(),
.files(extensions: ["json"]),
]
)
Can any one explain me what i’m doing wrong and how I can make my EventTracking submodule testable with custom configurations
Thanks