nimblehq / nimble-crypto-ios

This is an sample Crypto market prices ap built with SwiftUI and modularization architecture. The application data is making use of the free APIs provided by Coingecko.
MIT License
33 stars 8 forks source link

[Chore] Update SourceryPlugin to clear previously-generated codes before generating new ones #76

Closed Thieurom closed 1 year ago

Thieurom commented 1 year ago

Why

Usually, when we config Sourcery templates to place all the generated codes in a single file (AutoMockable.generated.swift), when running Sourcery just overwrites it with all the newly-generated codes.

However, in our use case, we config Sourcery to place each type per file. It leads to occur build errors in some cases. For e.g. when a developer switches from a branch that has a type to be mocked (say protocol MyUseCaseProtocol {}) to another branch that does not contain it. At that point, the previously-generated codes're still there, which in this case MyUseCaseProtocol.swift. But they won't build because it depends on a type that doesn't exist anymore.

We need to update the SourceryPlugin to clear previously-generated codes before generating new ones

Who Benefits?

Developers.