Releases: krzysztofzablocki/Sourcery
Releases · krzysztofzablocki/Sourcery
0.5.6
New Features
- Added per file code generation
Bug Fixes
- Fixed parsing annotations with complex content
- Fixed inline parser using wrong caching logic
0.5.5
New Features
- Sourcery will no longer write files if content didn't change, this improves behaviour of things depending on modification date like Xcode, Swiftlint.
Internal changes
- Improved support for contained types
Bug Fixes
- Fixes cache handling that got broken in 0.5.4
0.5.4
New Features
- Added inline code generation
- Added
isClosure
property toTypeName
to detect closure types
Bug Fixes
- Fixed parsing of associated values separater by newlines
- Fixed preserving order of inherited types
- Improved support for throwing methods in protocols
- Fixed extracting parameters of methods with closures in their bodies
- Fixed extracting method return types of tuple types
- Improved support for typealises as tuple elements types
- Method parameters with
_
argument label will now havenil
inargumentLabel
property - Improved support for generic methods
Internal changes
- adjusted internal templates and updated generated code
- moved methods parsing related tests in a separate spec
0.5.3
New Features
- Added support for method return types with
throws
andrethrows
- Added a new filter
replace
. Usage:{{ name|replace:"substring","replacement" }}
- replaces occurrences ofsubstring
withreplacement
inname
(case sensitive) - Improved support for inferring types of variables with initial values
- Sourcery is now bundling a set of example templates, you can access them in Templates folder.
- We now use parallel parsing and cache source artifacts. This leads to massive performance improvements:
- e.g. on big codebase of over 300 swift files:
Sourcery 0.5.2
Processing time 8.69941002130508 seconds
Sourcery 0.5.3
First time 4.69904798269272 seconds
Subsequent time: 0.882099032402039 seconds
Bug Fixes
- Method
accessLevel
was not exposed as string so not accessible properly via templates, fixed that. - Fixes on Swift Templates
0.5.2
New Features
- Added support for
ImplicitlyUnwrappedOptional
actualTypeName
property ofMethod.Parameter
,Variable
,Enum.Case.AssociatedValue
,TupleType.Element
now returnstypeName
if type is not a type aliasEnum
now contains type information for its raw value type.rawType
now returnType
object,rawTypeName
returns itsTypeName
- Added
annotated
filter to filter by annotations - Added negative filters counterparts
- Added support for attributes, i.e.
@escaping
- Experimental support for Swift Templates
<% for type in types.classes { %>
extension <%= type.name %>: Equatable {}
<% if type.annotations["showComment"] != nil { %> // <%= type.name %> has Annotations <% } %>
func == (lhs: <%= type.name %>, rhs: <%= type.name %>) -> Bool {
<% for variable in type.variables { %> if lhs.<%= variable.name %> != rhs.<%= variable.name %> { return false }
<% } %>
return true
}
<% } %>
0.5.1
New Features
- Variables with default initializer are now supported, e.g.
var variable = Type(...)
- Added support for special escaped names in enum cases e.g.
default
orfor
- Added support for tuple types and
tuple
filter for variables - Enum associated values now have
localName
andexternalName
properties. - Added
actualTypeName
forTypeName
that is typealias - Added
implements
,inherits
andbased
filters
Bug Fixes
- Using protocols doesn't expose variables using KVC, which meant some of the typeName properties weren't accessible via Templates, we fixed that using Sourcery itself to generate specific functions.
- Fixed parsing typealiases for tuples and closure types
- Fixed parsing associated values of generic types
Internal Changes
- Performed significant refactoring and simplified mutations in parsers
0.5.0
- You can now pass arbitrary values to templates with
--args
argument. - Added
open
access level - Type
inherits
andimplements
now allow you to access full type information, not just name - Type
allVariables
will now include all variables, including those inherited from supertype and known protocols. - Type
allMethods
will now include all methods, including those inherited from supertype and known protocols. - AssociatedValue exposes
unwrappedTypeName
,isOptional
- New Available stencil filters:
static
,instance
,computed
,stored
for Variablesenum
,class
,struct
,protocol
for Typesclass
,initializer
,static
,instance
for Methodscount
for Arrays, this is used when chaining arrays with filters where Stencil wouldn't allow us to do.count
, e.g.{{ variables|instance|count }}
- Now you can avoid inferring unknown protocols as enum raw types by adding conformance in extension (instead of
enum Foo: Equatable {}
doenum Foo {}; extension Foo: Equatable {}
)
Internal changes
- Refactor code around typenames
0.4.9
New Features
- Watch mode now works with folders, reacting to source-code changes and adding templates/source files.
- When using watch mode, status info will be displayed in the generated code so that you don't need to look at console at all.
- You can now access types of enum's associated values
- You can now access type's
methods
andinitializers
0.4.8
New Features
- You can now access
supertype
of a class - Associated values will now automatically use idx as name if no name is provided
Bug Fixes
- Fix dealing with multibyte characters
types.implementing
andtypes.based
should include protocols that are based on other protocols
0.4.7
New Features
- Added
contains
,hasPrefix
,hasPrefix
filters
Bug Fixes
- AccessLevel is now stored as string and accessible to templates