- chore(deps): bump nokogiri from 1.16.2 to 1.16.5 by @dependabot in #1331
- Fix typo in Decorator.md by @ahmedk92 in #1339
- chore(deps): bump rexml from 3.2.5 to 3.2.8 by @dependabot in #1332
- Fixed incorrect case prefix parsing by @art-divin in #1341
- Fixed crash when inline function has out of bound indexes by @art-divin in #1342
- Improved concurrency support in SwiftTemplate caching by @art-divin in #1344
- Fix associatedtype generics by @art-divin in #1345
- AutoMockable: fix generating static reset func by @MontakOleg in #1336
- Enabled lookup for generic type information in arrays by @art-divin in #1346
- Fixed typealias resolution breaking resolution of real types. by @fabianmuecke (#1325)
- Disabled type resolving for local method generic parameters by @art-divin (#1327)
- Added hideVersionHeader to configuration arguments by @art-divin (#1328)
- Fixed Issue when Caching of SwiftTemplate Binary Failes by @art-divin (#1323)
- Improved Logging/Error Handling during SwiftTemplate Processing by @art-divin (#1320)
- Set minimum platform for macOS by @art-divin (#1319)
- Remove Sourcery version from header by @dcacenabes in (#1309)
- Enable Single Print when Generating Based on Swifttemplate by @art-divin in (#1308)
- [Bug] Annotations aren't being extracted from initializers by @liamnichols in (#1311)
- Implemented Proper Protocol Composition Type Parsing by @art-divin in (#1314)
- Renamed parenthesis to parentheses by @art-divin in (#1315)
- Switched to Double for CLI argument processing by @art-divin in (#1317)
- Added isDistributed to Actor and Method by @art-divin in (#1318)
- Enable Quotes when parsing arguments in property wrapper parameters by @art-divin in (#1316)
- ClosureParameter isVariadic Support by @art-divin in (#1268)
- Update Usage.md to include --parseDocumentation option by @MarcoEidinger in (#1272)
- Format processing time log message by @MontakOleg in (#1274)
- Fixed swift-package-manager version by @art-divin in (#1280)
- Added isSet to TypeName by @art-divin in (#1281)
- chore(deps): bump nokogiri from 1.15.4 to 1.16.2 by @dependabot in (#1273)
- Implement GenericRequirement support for member type disambiguation by @art-divin in (#1283)
- Add generic requirements to Method by @art-divin in (#1284)
- Recognize subclasses with generics by @art-divin in (#1287)
- Implemented typealias unboxing during type resolution by @art-divin in (#1288)
- Added documentation to typealias by @art-divin in (#1289)
- Fix: Function with completion as parameter that contains itself an optional any parameter produces wrong mock by @paul1893 in (#1290)
- Fix: Function with inout parameter when function has more than one parameter produces wrong mock by @paul1893 in (#1291)
- Substitute underlying type from typealias by @art-divin in (#1292)
- Added support for multiline documentation comments by @art-divin in (#1293)
- Update SwiftSyntax dependency to 510.0.0 by @calda in (#1294)
- Resolved all SwiftSyntax Warnings by @art-divin in (#1295)
- Trailing Annotation Parsing by @art-divin in (#1296)
- Fixed Crash in AnnotationParser by @art-divin in (#1297)
- Disabled Optimization During Generated Code Verification by @art-divin in (#1300)
- Adjusted file structure to accommodate two generated files by @art-divin in (#1299)
- Expand --serialParse flag to also apply to Composer.uniqueTypesAndFunctions by @calda in (#1301)
- Make AutoMockable Generate Compilable Swift Code by @art-divin in (#1304)
- Fix Closure Parameter CVarArg with Existential by @art-divin in (#1305)
- Podspec updates - set correct filepath for Sourcery
- Fixed generated AutoMockable compilation issue due to generated variable names containing & character. Added support for existential any for throwable errors. (#1263)
- Podspec updates - set specific version per supported platform
- Podspec updates
- Add support for inout parameter for AutoMockable protocols (#1261)
- Added generic requirements and generic parameters to Subscript (#1242)
- Added isAsync and throws to Subscript (#1249)
- Initialise Subscript's returnTypeName with TypeSyntax, not String (#1250)
- Swifty generated variable names + fixed generated mocks compilation issues due to method generic parameters (#1252)
- Add support for
typealias
es in EJS templates. (#1208) - Add support for existential to Automockable Protocol with generic types. (#1220)
- Add support for generic parameters and requirements in subscripts. (#1242)
- Throw throwable error after updating mocks's calls counts and received parameters/invocations. (#1224)
- Fix unit tests on Linux (#1225)
- Updated XcodeProj to 8.16.0 (#1228)
- Fixed Unable to mock a protocol with methods that differ in parameter type - Error: "Invalid redeclaration" (#1238)
- Support for variadic arguments as method parameters (#1222)
- Separate EJSTemplate.swift for swift test and for swift build -c release (#1203)
- Added support for Swift Package Manager config (#1184)
- Add support to any keyword for function parameter type to AutoMockable.stencil (#1169)
- Add support to any keyword for function return type to AutoMockable.stencil(#1186)
- Add support for protocol compositions in EJS templates. (#1192)
- Linux Support (experimental) (#1188)
- Add support for opaque type (some keyword) to function parameter type in AutoMockable.stencil (#1197)
- Modifications to included files of Swift Templates are now detected by hashing instead of using the modification date when invalidating the cache (#1161)
- Fixes incorrectly parsed /r/n newline sequences (#1165 and #1138)
- Fixes incorrect parsing of annotations if there are attributes on lines preceeding declaration (#1141)
- Fixes incorrect parsing of trailing inline comments following enum case' rawValue (#1154)
- Fixes incorrect parsing of multibyte enum case identifiers with associated values
- Improves type inference when using contained types for variables (#1091)
- Fixes incorrectly parsed variable names that include property wrapper and comments, closes #1140
- Fixed non-ASCII characters handling in source code parsing #1130
- Improved performance by about 20%
- sourcery:auto inline fragments will appear on the body definition level
- added baseIndentation/base-indentation option that will be taken into as default adjustment when using those fragments
- add support for type methods to AutoMockable
- Reverts part of #1113 due to incomplete implementation breaking type complex resolution
- Files that had to be parsed will be logged if their count is less than 50 (or always in verbose mode)
- Adds support for public protocols in AutoMockable template #1100
- Adds support for async and throwing properties to AutoMockable template #1101
- Adds support for actors and nonisolated methods #1112
- Fixed parsing of extensions and nested types in swiftinterface files #1113
- Update StencilSwiftKit to fix SPM resolving issue when building as a Command Plugin #1023
- Adds new
--cacheBasePath
option toSourceryExecutable
to allow for plugins setting a default cache #1093 - Adds new
--dry
option toSourceryExecutable
to check output without file system modifications #1097 - Changes parser to new SwiftSyntax Parser
- Drops dylib dependency
- Added
deletingLastComponent
filter to turn/Path/Class.swift
into/Path
- Added
directory
computed property toType
- Added a new flag
--serialParse
to support parsing the sources in serial, rather than in parallel (the default), which can address stability issues in SwiftSyntax #1063
- Lower project requirements to allow compilation using Swift 5.5/Xcode 13.x #1049
- Update Stencil to 0.14.2
- Use
swift build
insead ofxcodebuild
when building binary #1057
- Adds
xcframework
key totarget
object in configuration file to enable processing ofswiftinterface
- Fixed issues generating Swift Templates when using Xcode 13.3 #1040
- Modifications to included files of Swift Templates now correctly invalidate the cache - #889
- Swift 5.6 and Xcode 13.3 is now required to build the project
lib_internalSwiftSyntaxParser
is now statically linked enabling better support when installing through SPM and Mint #1037
- Adds
fileName
toType
and exposespath
as well - Adds support for parsing async methods, closures and variables
- correct parsing of rawValue initializer in enum cases, fixes #1010
- Use name or path parameter to parse groups to avoid duplicated group creation, fixes #904, #906
- Added
CLI-Only
subspec toSourcery.podspec
#997 - Added documentation comment parsing for all declarations #1002
- Updates Yams to 4.0.6
- Enables universal binary
- Update dependencies to fix build on Xcode 13 and support Swift 5.5 #989
- Improves performance
- Skips hidden files / directories and doesn't step into packages
- added
after-auto:
generation mode to inline codegen - Fixes unstable ordering of
TypeName.attributes
- Fixing
Type.uniqueMethodFilter(_:_:)
so it compares return types of methods as well.
- Adds support for variadic parameters in functions
- Adds support for parsing property wrappers
- Added
titleCase
filter that turnssomethingNamedLikeThis
intoSomething Named Like This
- correct passing
force-parse
argument to specific file parsers and renames it toforceParse
to align with other naming - corrects
isMutable
regression on protocol variables #964 - Added multiple targets to link
- Fix groups creation
- Fix a test failing on macOS 11.3
- Fix generation of inline:auto annotations in files with other inline annotations.
- Fixes modifier access for things like
isLazy
,isOptional
,isConvienceInitializer
,isFinal
- Fixes
isMutable
on subscripts - Fixes
open
access parsing - Removes symlinks in project, since these can confuse Xcode
- Fixes
inout
being incorrectly parsed for closures
- Updated to Swift / SwiftSyntax 5.4
- Added ability to parse inline code generated by sourcery if annotation ends with argument provided in
--force-parse
option
- Extending AutoMockable template by adding handling of "autoMockableImports" and "autoMockableTestableImports" args.
- Sourcery now supports sourcerytemplates generated by Sourcery Pro
- Adds trim option for Stencil template leading / trailing whitespace and replaces newline tag markers with normal newline after that
- Fixes broken output for files with inline annotations from multiple templates
- Added
allImports
property toType
, which returns all imports existed in all files containing this type and all its super classes/protocols. - Added
basedTypes
property toType
, which contains all Types this type inherits from or implements, including unknown (not scanned) types with extensions defined. - Added inference logic for basic generics from variable initialization block
- Added
newline
andtyped
stencil tags from Sourcery Pro
- Fixed inferring raw value type from inherited types for enums with no cases or with associated values
- Fixed access level of protocol members
- Fixes parsing indirect enum cases correctly even when inline documentation is used
- Fixes TypeName.isClosure to handle composed types correctly
- Fixes issue where Annotations for Protocol Composition types are empty
- Fixes
sourcery:inline:auto
position calculation when the file contains UTF16 characters - Fixes
sourcery:inline:auto
position calculation when the file already contains code generated by Sourcery
- Removes manual parsing of
TypeName
, only explicit parser / configuration is now used - Add support for testing via
SPM
- Updted SwiftLint, Quick and Nible to latest versions
isClosure
/isArray
/isTuple
/isDictionary
should now consistently report correct values, this code broke in few cases in 1.3.2- Trivia (comments etc) will be ignored when parsing attribute description
- Fixes information being lost when extending unknown type more than once
- Multiple configuration files can be now passed through command line arguments
- AutoEquatable will use type.accessLevel for it's function, closes #675
- If you are using
.swifttemplate
in your configuration you might notice performance degradation, this is due to new composer added in1.3.2
that can create memory graph cycles between AST with which our current persistence doesn't deal properly, to workaround this we need to perform additional work for storing copy of parsed AST and compose it later on when running SwiftTemplates. This will be fixed in future release when AST changes are brought in, if you notice too much of a performance drop you can just switch to1.3.1
.
- Configuration file now supports multiple configurations at once
- When resolving extensions inherit their access level for methods/subscripts/variables and sub-types fixes #910
- When resolving Parent.ChildGenericType properly parses generic information
- Faster composing phase
- SwiftSyntax dylib is now bundled with the binary
- Sourcery is now using SwiftSyntax not SourceKit
- Performance is significantly improved
- Memory usage for common case (cached) is drastically lowered
- If you want to use Sourcery as framework you'll need to use SPM integration since SwiftSyntax doesn't have Podspec
- added
logAST
that will cause AST warnings and errors to be logged, defaultfalse
- added
logBenchmarks
that will cause benchmark informations to be logged, defaultfalse
- initializers are now considered as static method not instance
- typealiases and protocol compositions now provide proper
accessLevel
- if a tuple arguments are unnamed their
name
will be automatically set to index - default
accessLevel
when not provided in code is internal everywhere - Added
modifiers
to everything that hadattributes
and split them across, in sync with Swift naming - block annotations will be applied to associated values that are inside them
- extensions of unknown types will not have the definition module name added in their
globalName
property. (You can still access it viamodule
) - if you had some weird formatting around syntax declarations (newlines in-between etc) the AST data should be cleaned up rather than trying to reproduce that style
- Imports are now proper types, with additional information
- Protocol now has
genericRequirements
, it will also inheritassociatedType
from it's parent if it's not present - Single value tuples will be automatically unwrapped when parsing
- Attributes are now of stored in dictionary of arrays
[String: [Attribute]]
since you can have multiple attributes of the same name e.g.@available
- Name when not named will be using index same as associated value do e.g. objc(name) will have
0: name
as argument - spaces will no longer be replaced with
_
Tweaks some warnings into info logs to not generate Xcode warnings
Self
reference is resolved to correct type. Enchancement Request- Sourcery will now attempt to resolve local type names across modules when it can be done without ambiguity. Previously we only supported fully qualified names. Enchancement Request
- Sourcery is now always distributed via SPM, this creates much nicer diffs when using CocoaPods distribution.
- Updates StencilSwiftKit to 2.8.0
- PR Methods, Variables and Subscripts are now uniqued in all accessors:
methods
andallMethods
variables
andallVariables
subscripts
andallSubscripts
- New accessor is introduced that doesn't get rid of duplicates
rawMethods
,rawVariables
,rawSubscripts
s. - The deduping process works by priority order (highest to lowest):
- base declaration
- inheritance
- protocol conformance
- extensions
- updated xcodeproj, Stencil and StencilSwiftKit to newest versions
- Fixes type resolution when using xcode project integration
- Matches the behaviour of
allMethods
toallVariables
by only listing the same method once, even if defined in both base protocol and extended class. You could still walk the inheritance tree if you need to (to get all original methods), but for purpose of majority of codegen this is unneccessary.
- Fixes an issue when a very complicated variable initialization that contained
.init
call to unrelated case would cause the parser to assume the whole codeblock was a type and that could lead to mistakes in processing and even stack overflows
- Updated project and CI to Xcode 12.1
- Updated SourceKitten, Commander.
- Fix multiline method declarations parsing
- Fix an issue, where "types.implementing." did not work due to an additional module name.
- Using tuple for associated values in enum case is deprecated since Swift 5.2. Fix AutoEquatable and AutoHashable templates to avoid the warning (#842)
- Added support for associated types (#539)
- Disallow protocol compositions from being considered as the
rawType
of anenum
(#830) - Add missing documentation for the
ProtocolComposition
type. - Fix incorrectly taking closure optional return value as sign that whole variable is optional (#823)
- Fix incorrectly taking return values with closure as generic type as sign that whole variable is a closure (#845)
- Fix empty error at build time when using SwiftTemplate on Xcode 11.4 and higher (#817)
- Added
optional
filter for variables - Added
json
filter to output raw JSON objects - Added
.defaultValue
toAssociatedValue
- Added support for parsing Protocol Compositions
- Added support for parsing free functions
- Added support for indirect enum cases
- Added support for accessing all typealiases via
typealiases
andtypesaliasesByName
- Added support for parsing global typealiases
- Improved error logging when running with
--watch
option - Updated CI to Xcode 11.4.1
- Fixed expansion of undefined environment variables (now consistent with command line behaviour, where such args are empty strings)
- Fixed a bug in inferring extensions of Dictionary and Array types
- Fixed a bug that was including default values as part of AssociatedValues type names
- Fixed an issue with AutoMockable.stencil template when mocked function's return type was closure
- Fixed missing SourceryRuntime dependency of SourceryFramework (SPM)
- Parallelized combining phase that yields 5-10x speed improvement for New York Times codebase
- Switched cache logic to rely on file modification date instead of content Sha256
- Additional benchmark logs showing how long does each phase take
- update dependencies to fix cocoapods setup when using Swift 5.0 everywhere. Update Quick to 2.1.0, SourceKitten to 0.23.1 and Yams to 2.0.0
- Support automatic linking of files generated by annotations to project target
- Fixes always broken sourcery cache
- Add missing SourceryFramework library product in Package.swift
- Fix ReceivedInvocations's type for the method which have only one parameter in AutoMockable.stencil
- Fix missing folder error that could happen when running a Swift template with existing cache
- Don't add indentation to empty line when using inline generated code.
- Fix issue where errors in Swift Template would not be reported correctly when using Xcode 10.2.
- Fix annotations for enum cases with associated values that wouldn't parses them correctly when commas were used
- Removed dependency on SwiftTryCatch pod in order to avoid Swift Package Manager errors.
- Replaces environment variables inside .yml configurations (like ${PROJECT_NAME}), if a value is set.
- Fixes warning in generated AutoMockable methods that have implicit optional return values
- Support for
optional
methods in ObjC protocols - Support for parsing lazy vars into Variable's attributes.
- Updated Stencil to 0.13.1 and SwiftStencilKit to 2.7.0
- In Swift templates CLI arguments should now be accessed via
argument
instead ofarguments
, to be consistent with Stencil and JS templates. - Now in swift templates you can define types, extensions and use other Swift features that require file scope, without using separate files. All templates code is now placed at the top level of the template executable code, instead of being placed inside an extension of
TemplateContext
type. - Fixed missing generated code annotated with
inline
annotation when corresponding annotation in sources are missing. This generated code will be now present in*.generated.swift
file. - Updated AutoHashable template to use Swift 4.2's
hash(into:)
method fromHashable
, and enable support for inheritance. - Record all method invocations in the
AutoMockable
template. - Replace
swiftc
with the Swift Package Manager to build Swift templates - Swift templates can now be used when using a SPM build of Sourcery.
- You can now pass a json string as a command line arg or annotation and have it parsed into a Dictionary or Array to be used in the template.
- Support for Xcode 10 and Swift 4.2
- You can now include entire Swift files in Swift templates
- You can now use AutoEquatable with annotations
- Content from multiple file annotations will now be concatenated instead of writing only the latest generated content.
For example content generated by two following templates
// sourcery:file:Generated/Foo.swift
line one
// sourcery:end
and
// sourcery:file:Generated/Foo.swift
line two
// sourcery:end
will be written to one file:
line one
line two
- Use AnyObject for class-only protocols
- Fixed parsing associated enum cases in Xcode 10
- Fixed AutoEquatable access level for
==
func - Fixed path of generated files when linked to Xcode project
- Fixed extraction of inline annotations in multi line comments with documentation style
- Fixed compile error when used AutoHashable in NSObject subclass.
- Added support for enums in AutoCodable template
- You can now specify the base path for the Sourcery cache directory with a
cacheBasePath
key in the config file
- Added AutoCodable template
- Fixed parsing protocol method return type followed by declaration with attribute
- Fixed inserting auto-inlined code on the last line of declaration body
- AutoEquatable and AutoHashable templates should not add protocol conformances in extensions
- Migrate to Swift 4.1 and Xcode 9.3
- Autocases template not respecting type access level
- Ensure SPM and CocoaPods dependencies match
- Improve AutoMockable template to handle methods with optional return values
- Fixed crash while compiling swift templates
- Do not fail the build if slather fails
- Updated SourceKitten to 0.20.0
- Fixed parsing protocol methods return type (#579)
- Supports adding new templates files while in watcher mode
- Supports adding new source files while in watcher mode
- Added support for subscripts
- Added
isGeneric
property forMethod
- You can now pass additional arguments one by one, i.e.
--args arg1=value1 --args arg2 --args arg3=value3
- Improved support for generic types. Now you can access basic generic type information with
TypeName.generic
property - added
@objcMembers
attribute - Moved EJS and Swift templates to separate framework targets
- EJS templates now can be used when building Sourcery with SPM
- Added Closures to AutoMockable
- You can now link generated files to projects using config file
- You can now use AutoMockable with annotations
- Updated to latest version of Stencil (commit 9184720)
- Added support for annotation namespaces
- Added
--exclude-sources
and--exclude-templates
CLI options
** Breaking **
- @objc attribute now has a
name
argument that contains Objective-C name of attributed declaration - Type collections
types.based
,types.implementing
andtypes.inheriting
now return non-optional array. If no types found, empty array will be returned. This is a breaking change for template code like this:
<% for type in (types.implementing["SomeProtocol"] ?? []) { %>
The new correct syntax would be:
<% for type in types.implementing["SomeProtocol"] { %>
- Migrate to Swift 4, SwiftPM 4 and Xcode 9.2
selectorName
for methods without parameters now will not contain()
returnTypeName
for initializers will be the type name of defining type, with?
for failable initializers- Improved compile time of AutoHashable template
- Updated StencilSwiftKit and Stencil to 0.10.1
- Fixes FSEvents errors reported in #465 that happen on Sierra
- JS exceptions no more override syntax errors in JS templates
- Accessing unknown property on
types
now results in a better error thanundefined is not an object
in JS templates - Fixed issue in AutoMockable, where generated non-optional variables wouldn't meet protocol's requirements. For this purpose, underlying variable was introduced
- Fixed
inline:auto
not inserting code if Sourcery is run with cache enabled #467 - Fixed parsing @objc attributes on types
- Fixed parsing void return type in methods without spaces between method name and body open curly brace and in protocols
- Fixed AutoMockable template generating throwing method with void return type
- Fixed parsing throwing initializers
- Fixed trying to process files which do not exist
- Automockable will not generate mocks for methods defined in protocol extensions
- Fixed parsing typealiases of generic types
- AutoLenses template will create lenses only for stored properties
- Fixed resolving actual type name for generics with inner types
- Fixed parsing nested types from extensions
- Fixed removing back ticks in types names
- Fixed creating output folder if it does not exist
- Fixed inferring variable types with closures and improved inferring types of enum default values
- Fixed enum cases with empty parentheses not having () associated value
- When installing Sourcery via CocoaPods, the unneeded
file.zip
is not kept inPods/Sourcery/
anymore (freeing ~12MB on each install of Sourcery made via CocoaPods!).
- Added test for count Stencil filter
- Added new reversed Stencil filter
- Added new isEmpty Stencil filter
- Added new sorted and sortedDescending Stencil filters. This can sort arrays by calling e.g.
protocol.allVariables|sorted:"name"
- Added new toArray Stencil filter
- Added a console warning when a yaml is available but any parameter between 'sources', templates', 'forceParse', 'output' are provided
- Add release to Homebrew rake task
- Fixed Swiftlint warnings
- Fixed per file generation if there is long (approx. 150KB) output inside
sourcery:file
annotation - Do not generate default.profraw
- Remove filters in favor of same filters from StencilSwiftKit
- Added support for file paths in
config
parameter - Added
isDeinitializer
property for methods - Improved config file validation and error reporting
- Various improvements for
AutoMockable
template:- support methods with reserved keywords name
- support methods that throws
- improved generated declarations names
- Fixed single file generation not skipping writing the file when there is no generated content
- Updated dependencies for Swift 4
- Update internal ruby dependencies
- Added support in
AutoHashable
for static variables,[Hashable]
array and[Hashable: Hashable]
dictionary - Added
definedInType
property forMethod
andVariable
- Added
extensions
filter for stencil template - Added include support in Swift templates
- Swift templates now can throw errors. You can also throw just string literals.
- Added support for TypeName in string filters (except filters from StencilSwiftKit).
- Fixed linker issue when using Swift templates
- Updated
AutoMockable
to exclude generated code collisions - Fixed parsing of default values for variables that also have a body (e.g. for
didSet
) - Fixed line number display when an error occur while parsing a Swift template
- Fixed
rsync
issue onSourceryRuntime.framework
when using Swift templates - Fixed
auto:inline
for nested types (this concerns the first time the code is inserted)
- Fix link for template in docs
- Fix running Sourcery in the example app
- Add step to update internal boilerplate code during the release
- Add Version.swift to represent CLI tool version
- Fixed regression in parsing templates from config file
- Removed meaningless
isMutating
property forVariable
- Improvements in release script
- Updated boilerplate code to reflect latest changes
- Added
inout
flag forMethodParameter
- Added parsing
mutating
andfinal
attributes with convenienceisMutating
andisFinal
properties - Added support for
include
Stencil tag - Added support for excluded paths
- Fixed inserting generated code inline automatically at wrong position
- Fixed regression in AutoEquatable & AutoHashable template with private computed variables
- Internal release procedure improvements
- Improved
TemplatesTests
scheme running - Fixed swiftlint warnings (version 0.19.0)
- Paths in config file are now relative to config file path by default, absolute paths should start with
/
- Improved logging and error reporting, added
--quiet
CLI option, added runtime errors for using invalid types inimplementing
andinheriting
- Added support for includes in EJS templates (for example:
<%- include('myTemplate.js') %>
) - Add the
lowerFirst
filter for Stencil templates. - Added
isRequired
property forMethod
- Improved parsing of closure types
- Check if Current Project Version match version in podspec in release task
- Improved swift templates performance
- Added
// sourcery:file
annotation for source code
- Fixed detecting computed properties
- Fixed typo in
isConvenienceInitialiser
property - Fixed creating cache folder when cache is disabled
- Fixed parsing multiple enum cases annotations
- Fixed parsing inline annotations when there is an access level or attribute
- Fixed parsing
required
attribute - Fixed typo in
guides/Writing templates.md
- Improved
AutoMockable.stencil
to support protocols withinit
methods - Improved
AutoCases.stencil
to uselet
instead of computedvar
- Updated StencilSwiftKit to 1.0.2 which includes Stencil 0.9.0
- Adding docset to release archive
- Add tests for bundled stencil templates
- Moved to CocoaPods 1.2.1
- Made Array.parallelMap's block non-escaping
- Added some convenience accessors for classic, static and instance methods, and types and contained types grouped by names
- Added support for inline code generation without requiring explicit
// sourcery:inline
comments in the source files. To use, usesourcery:inline:auto
in a template:// sourcery:inline:auto:MyType.TemplateName
- Added
isMutable
property forVariable
- Added support for scanning multiple targets
- Added access level filters and disabled filtering private declarations
- Added support for inline comments for annotations with
/*
and*/
- Added annotations for enum case associated values and method parameters
- Added
isConvenienceInitializer
property forMethod
- Added
defaultValue
for variables and method parameters - Added docs generated with jazzy
- Sourcery now will not create empty files and will remove existing generated files with empty content if CLI flag
prune
is set totrue
(false
by default) - Sourcery now will remove inline annotation comments from generated code.
- Added
rethrows
property toMethod
- Allow duplicated annotations to be agregated into array
- Added ejs-style tags to control whitespaces and new lines in swift templates
- Added CLI option to provide path to config file
- Inserting multiple inline code block in one file
- Suppress warnings when compiling swift templates
- Accessing protocols in Swift templates
- Crash that would happen sometimes when parsing typealiases
- Replaced
TypeReflectionBox
andGenerationContext
types with commonTemplateContext
.
- Added flag to check if
TypeName
is dictionary - Added support for multiple sources and templates paths, sources, templates and output paths now should be provided with
--sources
,--templates
and--output
options - Added support for YAML file configuration
- Added generation of non-swift files using
sourcery:file
annotation
- Fixed observing swift and js templates
- Fixed parsing generic array types
- Fixed using dictionary in annotations
- Added parsing array types
- Added support for JavaScript templates (using EJS)
- Fixed escaping variables with reserved names
- Fixed duplicated methods and variables in
allMethods
andallVariables
- Fixed trimming attributes in type names
- Cache initial file contents, including the inline generated ranges so that they are always up to date
- Added per file code generation
- Fixed parsing annotations with complex content
- Fixed inline parser using wrong caching logic
- Sourcery will no longer write files if content didn't change, this improves behaviour of things depending on modification date like Xcode, Swiftlint.
- Improved support for contained types
- Fixes cache handling that got broken in 0.5.4
- Added inline code generation
- Added
isClosure
property toTypeName
to detect closure types
- 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
- Improved support for contained types
- adjusted internal templates and updated generated code
- moved methods parsing related tests in a separate spec
- 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
- Method
accessLevel
was not exposed as string so not accessible properly via templates, fixed that. - Fixes on Swift Templates
-
Added support for
ImplicitlyUnwrappedOptional
-
actualTypeName
property ofMethod.Parameter
,Variable
,Enum.Case.AssociatedValue
,TupleType.Element
now returnstypeName
if type is not a type alias -
Enum
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
-
Swift Templates are now supported
<% 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
}
<% } %>
- 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
- 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
- Performed significant refactoring and simplified mutations in parsers
- 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 {}
)
- Refactor code around typenames
- 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
- You can now access
supertype
of a class - Associated values will now automatically use idx as name if no name is provided
- Fix dealing with multibyte characters
types.implementing
andtypes.based
should include protocols that are based on other protocols
- TDD Development is now easier thanks to Diffable results, no longer we need to scan wall of text on failures, instead we see exactly what's different.
- Added
contains
,hasPrefix
,hasPrefix
filters
- AccessLevel is now stored as string
- Typealiases parsing could cause crash, implemented a workaround for that until we can find a little more reliable solution
- Swift Package Manager support.
- Enum cases also have annotation support
- Improved handling of global and local typealiases.
- Add upperFirst stencil filter
- Fixes a bug with flattening
inherits
,implements
for protocols implementing other protocols - Improve
rawType
logic for Enums
- Annotations can now be declared also with sections e.g.
sourcery:begin: attribute1, attribute2 = 234
- Adds scanning class variables as static
- Refactored models
- Improved performance of annotation scanning
- Implements inherits, implements, based reflection on each Type
- Flattens inheritance, e.g. Foo implements Decodable, then FooSubclass also implements it
- Stop parsing private variables as they wouldn't be accessible to code-generated code
- improve detecting raw type
- add
isGeneric
property
- Enables support for scanning extensions of unknown type, providing partial metadata via types.based or types.all reflection
- Adds real type reflection into Variable, not only it's name
- Resolves known typealiases
- Fixes a bug that caused Sourcery to drop previous type information when encountering generated code, closes #33
- Fixes bug in escaping path
- Fixes missing protocol variant in kind
- added support for type/variable source annotations
- added property kind to Type, it contains info whether this is struct, class or enum entry
- Automatically skips .swift files that were generated with Sourcery
- improved detecting enums with rawType