Skip to content

Releases: krzysztofzablocki/Sourcery

0.5.6

16 Feb 17:07
Compare
Choose a tag to compare

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

08 Feb 19:09
Compare
Choose a tag to compare

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

04 Feb 18:01
Compare
Choose a tag to compare

New Features

  • Added inline code generation
  • Added isClosure property to TypeName 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 have nil in argumentLabel 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

13 Jan 19:28
Compare
Choose a tag to compare

New Features

  • Added support for method return types with throws and rethrows
  • Added a new filter replace. Usage: {{ name|replace:"substring","replacement" }} - replaces occurrences of substring with replacement in name (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

09 Jan 20:53
Compare
Choose a tag to compare

New Features

  • Added support for ImplicitlyUnwrappedOptional
  • actualTypeName property of Method.Parameter, Variable, Enum.Case.AssociatedValue, TupleType.Element now returns typeName if type is not a type alias
  • Enum now contains type information for its raw value type. rawType now return Type object, rawTypeName returns its TypeName
  • 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

05 Jan 20:45
Compare
Choose a tag to compare

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 or for
  • Added support for tuple types and tuple filter for variables
  • Enum associated values now have localName and externalName properties.
  • Added actualTypeName for TypeName that is typealias
  • Added implements, inherits and based 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

30 Dec 16:37
Compare
Choose a tag to compare
  • You can now pass arbitrary values to templates with --args argument.
  • Added open access level
  • Type inherits and implements 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 Variables
    • enum, class, struct, protocol for Types
    • class, initializer, static, instance for Methods
    • count 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 {} do enum Foo {}; extension Foo: Equatable {})

Internal changes

  • Refactor code around typenames

0.4.9

25 Dec 20:01
Compare
Choose a tag to compare

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 and initializers

0.4.8

23 Dec 20:06
Compare
Choose a tag to compare

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 and types.based should include protocols that are based on other protocols

0.4.7

22 Dec 08:11
Compare
Choose a tag to compare

New Features

  • Added contains, hasPrefix, hasPrefix filters

Bug Fixes

  • AccessLevel is now stored as string and accessible to templates