Skip to content

Replace Sourcery with swift-mocking for mock generation - #150

Draft
WezSieTato with Copilot wants to merge 3 commits into
masterfrom
copilot/remove-sourcery-dependency
Draft

Replace Sourcery with swift-mocking for mock generation#150
WezSieTato with Copilot wants to merge 3 commits into
masterfrom
copilot/remove-sourcery-dependency

Conversation

Copilot AI commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

Replaces Sourcery code generation with swift-mocking macros for compile-time mock generation. Removes all Sourcery tooling, stencils, and generated files.

Protocol changes

// sourcery: AutoMockable@Mocked(compilationCondition: .debug) on all 5 mockable protocols. Added import Mocking to each.

Test migration

Updated mock API across 8 test files:

// Before (Sourcery)
let mock = VersioningMock()
mock.versionNumber = "1.0.0"
mock.buildNumber = "1"
timeProvider.nowReturnValue = Date.date()

// After (swift-mocking)
let mock = VersioningMock()
mock._versionNumber.getter.implementation = .returns("1.0.0")
mock._buildNumber.getter.implementation = .returns("1")
timeProvider._now.implementation = .returns(Date.date())

Dependency & build changes

  • Added swift-mocking 0.2.2+ to both ScanNowCore and ScanNowCoreTests targets
  • Bumped minimum deployment target from iOS 14 → iOS 16 (required by swift-mocking)

Removed

  • sourcery/AutoMockable.stencil
  • App/Tests/ScanNowCoreTests/generated/AutoMockable.generated.swift
  • App/Tests/ScanNowCoreTests/.sourcery.yml
  • krzysztofzablocki/Sourcery@2.3.0 from Mintfile
  • fastlane-plugin-sourcery from Pluginfile/Gemfile.lock
  • Sourcery steps from Fastfile check_generated_code and generate_code lanes

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • www.swift.org
    • Triggering command: /usr/share/swift/usr/bin/swift-package /usr/share/swift/usr/bin/swift-package resolve (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits March 20, 2026 10:13
- Add swift-mocking dependency to Package.swift
- Replace // sourcery: AutoMockable with @mocked macro on 5 protocols
- Update all test files to use swift-mocking API
- Delete Sourcery stencil, generated mocks, and config
- Remove Sourcery from Mintfile
- Remove Sourcery from Fastfile lanes
- Clean up .swiftlint.yml

Co-authored-by: WezSieTato <4258662+WezSieTato@users.noreply.github.com>
Co-authored-by: WezSieTato <4258662+WezSieTato@users.noreply.github.com>
Copilot AI changed the title [WIP] Replace Sourcery with swift-mocking library for mocking Replace Sourcery with swift-mocking for mock generation Mar 20, 2026
Copilot AI requested a review from WezSieTato March 20, 2026 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants