Full Code of krzysztofzablocki/Sourcery for AI

master afb0782ecb5e cached
553 files
4.7 MB
1.3M tokens
74 symbols
1 requests
Download .txt
Showing preview only (5,027K chars total). Download the full file or copy to clipboard to get everything.
Repository: krzysztofzablocki/Sourcery
Branch: master
Commit: afb0782ecb5e
Files: 553
Total size: 4.7 MB

Directory structure:
gitextract_t4znldax/

├── .circleci/
│   └── config.yml
├── .codecov.yml
├── .github/
│   └── workflows/
│       ├── bump_homebrew.yml
│       ├── docker.yml
│       ├── jazzy.yml
│       ├── release_macOS.yml
│       ├── release_ubuntu.yml
│       ├── test_macOS.yml
│       └── test_ubuntu.yml
├── .gitignore
├── .gitmodules
├── .jazzy.yaml
├── .pre-commit-hooks.yaml
├── .ruby-version
├── .sourcery-macOS.yml
├── .sourcery-ubuntu.yml
├── .swift-version
├── .swiftlint.yml
├── .vscode/
│   ├── launch.json
│   └── settings.json
├── ABOUT.md
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── Dangerfile
├── Dockerfile
├── Funding.yml
├── Gemfile
├── LICENSE
├── LINUX.md
├── LinuxMain.swift
├── Package.resolved
├── Package.swift
├── Plugins/
│   └── SourceryCommandPlugin/
│       └── SourceryCommandPlugin.swift
├── README.md
├── RELEASING.md
├── Rakefile
├── Scripts/
│   ├── SwiftLint.sh
│   ├── bootstrap
│   ├── package_content
│   ├── pre-commit.sh
│   └── update-placeholders
├── Sourcery/
│   ├── Configuration.swift
│   ├── Generating/
│   │   └── Templates/
│   │       ├── JavaScript/
│   │       │   └── JavaScriptTemplate.swift
│   │       ├── Stencil/
│   │       │   └── StencilTemplate.swift
│   │       └── Swift/
│   │           └── SwiftTemplate.swift
│   ├── Sourcery.swift
│   ├── Templates/
│   │   ├── Coding.stencil
│   │   ├── Description.stencil
│   │   ├── Diffable.stencil
│   │   ├── Equality.stencil
│   │   ├── JSExport.ejs
│   │   ├── Typed.stencil
│   │   └── TypedSpec.stencil
│   └── Utils/
│       ├── ByteRangeConversion.swift
│       ├── BytesRange + Editing.swift
│       ├── DryOutputModels.swift
│       ├── FolderWatcher.swift
│       ├── NSRange + Editing.swift
│       └── Xcode+Extensions.swift
├── Sourcery-Example/
│   ├── CodeGenerated/
│   │   └── Basic.generated.swift
│   ├── Podfile
│   ├── Sourcery-Example/
│   │   ├── AppDelegate.swift
│   │   ├── Assets.xcassets/
│   │   │   └── AppIcon.appiconset/
│   │   │       └── Contents.json
│   │   ├── Base.lproj/
│   │   │   ├── LaunchScreen.storyboard
│   │   │   └── Main.storyboard
│   │   ├── Info.plist
│   │   └── ViewController.swift
│   ├── Sourcery-Example.xcodeproj/
│   │   ├── project.pbxproj
│   │   └── project.xcworkspace/
│   │       └── contents.xcworkspacedata
│   ├── Sourcery-Example.xcworkspace/
│   │   └── contents.xcworkspacedata
│   └── Templates/
│       └── Basic.stencil
├── Sourcery.podspec
├── SourceryExecutable/
│   ├── Info.plist
│   └── main.swift
├── SourceryFramework/
│   ├── Info.plist
│   ├── SourceryFramework.h
│   └── Sources/
│       ├── Generating/
│       │   ├── Generator.swift
│       │   ├── SourceryTemplate.swift
│       │   └── Template.swift
│       └── Parsing/
│           ├── FileParserType.swift
│           ├── String+TypeInference.swift
│           ├── SwiftSyntax/
│           │   ├── AST/
│           │   │   ├── AccessLevel+SwiftSyntax.swift
│           │   │   ├── Actor+SwiftSyntax.swift
│           │   │   ├── Attribute+SwiftSyntax.swift
│           │   │   ├── Class+SwiftSyntax.swift
│           │   │   ├── Enum+SwiftSyntax.swift
│           │   │   ├── EnumCase+SwiftSyntax.swift
│           │   │   ├── GenericParameter+SwiftSyntax.swift
│           │   │   ├── GenericRequirement+SwiftSyntax.swift
│           │   │   ├── GenericType+SwiftSyntax.swift
│           │   │   ├── Method+SwiftSyntax.swift
│           │   │   ├── MethodParameter+SwiftSyntax.swift
│           │   │   ├── Modifier+SwiftSyntax.swift
│           │   │   ├── Protocol+SwiftSyntax.swift
│           │   │   ├── Signature.swift
│           │   │   ├── Struct+SwiftSyntax.swift
│           │   │   ├── Subscript+SwiftSyntax.swift
│           │   │   ├── Type+SwiftSyntax.swift
│           │   │   ├── TypeName+SwiftSyntax.swift
│           │   │   └── Variable+SwiftSyntax.swift
│           │   ├── FileParserSyntax.swift
│           │   ├── Syntax+Extensions.swift
│           │   └── SyntaxTreeCollector.swift
│           └── Utils/
│               ├── AnnotationsParser.swift
│               ├── Bridges.swift
│               ├── InlineParser.swift
│               ├── StringView.swift
│               └── Verifier.swift
├── SourceryFramework.podspec
├── SourceryJS/
│   ├── Info.plist
│   ├── Resources/
│   │   └── ejs.js
│   ├── SourceryJS.h
│   └── Sources/
│       ├── EJSTemplate+Tests.swift
│       └── EJSTemplate.swift
├── SourceryRuntime/
│   ├── Sources/
│   │   ├── Common/
│   │   │   ├── AST/
│   │   │   │   ├── AccessLevel.swift
│   │   │   │   ├── Actor.swift
│   │   │   │   ├── Annotations.swift
│   │   │   │   ├── Attribute.swift
│   │   │   │   ├── Class.swift
│   │   │   │   ├── Definition.swift
│   │   │   │   ├── Documentation.swift
│   │   │   │   ├── Import.swift
│   │   │   │   ├── Modifier.swift
│   │   │   │   ├── PhantomProtocols.swift
│   │   │   │   ├── Protocol.swift
│   │   │   │   ├── ProtocolComposition.swift
│   │   │   │   ├── Struct.swift
│   │   │   │   ├── TypeName/
│   │   │   │   │   ├── Array.swift
│   │   │   │   │   ├── Dictionary.swift
│   │   │   │   │   ├── Generic.swift
│   │   │   │   │   ├── Set.swift
│   │   │   │   │   └── Typed.swift
│   │   │   │   └── Typealias.swift
│   │   │   ├── Array+Parallel.swift
│   │   │   ├── BytesRange.swift
│   │   │   ├── Composer/
│   │   │   │   ├── Composer.swift
│   │   │   │   └── ParserResultsComposed.swift
│   │   │   ├── Diffable.swift
│   │   │   ├── Extensions.swift
│   │   │   ├── FileParserResult.swift
│   │   │   ├── Log.swift
│   │   │   └── TemplateContext.swift
│   │   ├── Generated/
│   │   │   ├── AutoHashable.generated.swift
│   │   │   ├── Coding.generated.swift
│   │   │   ├── JSExport.generated.swift
│   │   │   └── Typed.generated.swift
│   │   ├── Linux/
│   │   │   ├── AST/
│   │   │   │   ├── AssociatedType_Linux.swift
│   │   │   │   ├── AssociatedValue_Linux.swift
│   │   │   │   ├── ClosureParameter_Linux.swift
│   │   │   │   ├── EnumCase_Linux.swift
│   │   │   │   ├── Enum_Linux.swift
│   │   │   │   ├── GenericParameter_Linux.swift
│   │   │   │   ├── GenericRequirement_Linux.swift
│   │   │   │   ├── MethodParameter_Linux.swift
│   │   │   │   ├── Method_Linux.swift
│   │   │   │   ├── Protocol_Linux.swift
│   │   │   │   ├── Subscript_Linux.swift
│   │   │   │   ├── TypeName/
│   │   │   │   │   ├── Closure_Linux.swift
│   │   │   │   │   ├── GenericTypeParameter_Linux.swift
│   │   │   │   │   ├── Tuple_Linux.swift
│   │   │   │   │   └── TypeName_Linux.swift
│   │   │   │   ├── Type_Linux.swift
│   │   │   │   └── Variable_Linux.swift
│   │   │   ├── DynamicMemberLookup_Linux.swift
│   │   │   ├── NSException_Linux.swift
│   │   │   ├── TypesCollection_Linux.swift
│   │   │   └── Types_Linux.swift
│   │   └── macOS/
│   │       ├── AST/
│   │       │   ├── AssociatedType.swift
│   │       │   ├── AssociatedValue.swift
│   │       │   ├── ClosureParameter.swift
│   │       │   ├── Enum.swift
│   │       │   ├── EnumCase.swift
│   │       │   ├── GenericParameter.swift
│   │       │   ├── GenericRequirement.swift
│   │       │   ├── Method.swift
│   │       │   ├── MethodParameter.swift
│   │       │   ├── Subscript.swift
│   │       │   ├── Type.swift
│   │       │   ├── TypeName/
│   │       │   │   ├── Closure.swift
│   │       │   │   ├── GenericTypeParameter.swift
│   │       │   │   ├── Tuple.swift
│   │       │   │   └── TypeName.swift
│   │       │   └── Variable.swift
│   │       ├── Types.swift
│   │       └── TypesCollection.swift
│   └── Supporting Files/
│       ├── Info.plist
│       └── SourceryRuntime.h
├── SourceryRuntime.podspec
├── SourceryStencil/
│   ├── Info.plist
│   ├── SourceryStencil.h
│   └── Sources/
│       ├── NewLineNode.swift
│       ├── StencilTemplate.swift
│       └── TypedNode.swift
├── SourcerySwift/
│   ├── Info.plist
│   ├── SourcerySwift.h
│   └── Sources/
│       ├── SourceryRuntime.content.generated.swift
│       ├── SourceryRuntime_Linux.content.generated.swift
│       └── SwiftTemplate.swift
├── SourceryTests/
│   ├── ConfigurationSpec.swift
│   ├── Generating/
│   │   ├── JavaScriptTemplateSpecs.swift
│   │   ├── StencilTemplateSpec.swift
│   │   └── SwiftTemplateSpecs.swift
│   ├── GeneratorSpec.swift
│   ├── Helpers/
│   │   ├── Builders.swift
│   │   ├── CustomMatchers.swift
│   │   └── Extensions.swift
│   ├── Info.plist
│   ├── Models/
│   │   ├── ActorSpec.swift
│   │   ├── ArrayTypeSpec.swift
│   │   ├── ClassSpec.swift
│   │   ├── DiffableSpec.swift
│   │   ├── EnumSpec.swift
│   │   ├── MethodSpec.swift
│   │   ├── ProtocolSpec.swift
│   │   ├── StructSpec.swift
│   │   ├── TypeSpec.swift
│   │   ├── TypealiasSpec.swift
│   │   ├── TypedSpec.generated.swift
│   │   └── VariableSpec.swift
│   ├── Output/
│   │   └── DryOutputSpec.swift
│   ├── Parsing/
│   │   ├── ComposerSpec.swift
│   │   ├── FileParserSpec.swift
│   │   ├── FileParser_AssociatedTypeSpec.swift
│   │   ├── FileParser_AttributesModifierSpec.swift
│   │   ├── FileParser_MethodsSpec.swift
│   │   ├── FileParser_ProtocolComposition.swift
│   │   ├── FileParser_SubscriptsSpec.swift
│   │   ├── FileParser_TypeNameSpec.swift
│   │   ├── FileParser_VariableSpec.swift
│   │   └── Helpers/
│   │       ├── AnnotationsParserSpec.swift
│   │       ├── StringViewSpec.swift
│   │       ├── TemplateAnnotationsParserSpec.swift
│   │       ├── TemplatesAnnotationParser_ForceParseInlineCodeSpec.swift
│   │       └── VerifierSpec.swift
│   ├── Sourcery+PerformanceSpec.swift
│   ├── SourcerySpec.swift
│   └── Stub/
│       ├── Configs/
│       │   ├── invalid.yml
│       │   ├── multi.yml
│       │   ├── parent.yml
│       │   └── valid.yml
│       ├── DryRun-Code/
│       │   └── Base.swift
│       ├── Errors/
│       │   └── localized-error.swift
│       ├── JavaScriptTemplates/
│       │   ├── AllTypealiases.ejs
│       │   ├── Equality.ejs
│       │   ├── Function.ejs
│       │   ├── Includes.ejs
│       │   ├── Other.ejs
│       │   ├── ProtocolCompositions.ejs
│       │   ├── SubfolderIncludes.ejs
│       │   ├── Typealiases.ejs
│       │   └── lib/
│       │       ├── One.ejs
│       │       └── Two.ejs
│       ├── Performance-Code/
│       │   ├── Kiosk/
│       │   │   ├── Admin/
│       │   │   │   ├── AdminCardTestingViewController.swift
│       │   │   │   ├── AdminLogViewController.swift
│       │   │   │   ├── AdminPanelViewController.swift
│       │   │   │   ├── AuctionWebViewController.swift
│       │   │   │   ├── ChooseAuctionViewController.swift
│       │   │   │   └── PasswordAlertViewController.swift
│       │   │   ├── App/
│       │   │   │   ├── APIPingManager.swift
│       │   │   │   ├── AppDelegate+GlobalActions.swift
│       │   │   │   ├── AppDelegate.swift
│       │   │   │   ├── AppSetup.swift
│       │   │   │   ├── AppViewController.swift
│       │   │   │   ├── BidderDetailsRetrieval.swift
│       │   │   │   ├── CardHandler.swift
│       │   │   │   ├── Constants.swift
│       │   │   │   ├── GlobalFunctions.swift
│       │   │   │   ├── KioskDateFormatter.h
│       │   │   │   ├── KioskDateFormatter.m
│       │   │   │   ├── Logger.swift
│       │   │   │   ├── MarkdownParser.swift
│       │   │   │   ├── Models/
│       │   │   │   │   ├── Artist.swift
│       │   │   │   │   ├── Artwork.swift
│       │   │   │   │   ├── Bid.swift
│       │   │   │   │   ├── Bidder.swift
│       │   │   │   │   ├── BidderPosition.swift
│       │   │   │   │   ├── BuyersPremium.swift
│       │   │   │   │   ├── Card.swift
│       │   │   │   │   ├── GenericError.swift
│       │   │   │   │   ├── Image.swift
│       │   │   │   │   ├── JSONAble.swift
│       │   │   │   │   ├── Location.swift
│       │   │   │   │   ├── Sale.swift
│       │   │   │   │   ├── SaleArtwork.swift
│       │   │   │   │   ├── SaleArtworkViewModel.swift
│       │   │   │   │   ├── SystemTime.swift
│       │   │   │   │   └── User.swift
│       │   │   │   ├── NSErrorExtensions.swift
│       │   │   │   ├── Networking/
│       │   │   │   │   ├── APIKeys.swift
│       │   │   │   │   ├── ArtsyAPI.swift
│       │   │   │   │   ├── NetworkLogger.swift
│       │   │   │   │   ├── Networking.swift
│       │   │   │   │   ├── UserCredentials.swift
│       │   │   │   │   └── XAppToken.swift
│       │   │   │   ├── OfflineViewController.swift
│       │   │   │   ├── STPCard+Validation.h
│       │   │   │   ├── STPCard+Validation.m
│       │   │   │   ├── StubResponses.h
│       │   │   │   ├── StubResponses.m
│       │   │   │   ├── SwiftExtensions.swift
│       │   │   │   ├── UIStoryboardSegueExtensions.swift
│       │   │   │   ├── UIViewControllerExtensions.swift
│       │   │   │   ├── UIViewSubclassesErrorExtensions.swift
│       │   │   │   └── Views/
│       │   │   │       ├── Button Subclasses/
│       │   │   │       │   └── Button.swift
│       │   │   │       ├── RegisterFlowView.swift
│       │   │   │       ├── SimulatorOnlyView.swift
│       │   │   │       ├── Spinner.swift
│       │   │   │       ├── SwitchView.swift
│       │   │   │       └── Text Fields/
│       │   │   │           ├── CursorView.swift
│       │   │   │           └── TextField.swift
│       │   │   ├── Auction Listings/
│       │   │   │   ├── ListingsCountdownManager.swift
│       │   │   │   ├── ListingsViewController.swift
│       │   │   │   ├── ListingsViewModel.swift
│       │   │   │   ├── MasonryCollectionViewCell.swift
│       │   │   │   ├── TableCollectionViewCell.swift
│       │   │   │   └── WebViewController.swift
│       │   │   ├── Bid Fulfillment/
│       │   │   │   ├── AdminCCBypassNetworkModel.swift
│       │   │   │   ├── BidCheckingNetworkModel.swift
│       │   │   │   ├── BidDetailsPreviewView.swift
│       │   │   │   ├── BidderNetworkModel.swift
│       │   │   │   ├── ConfirmYourBidArtsyLoginViewController.swift
│       │   │   │   ├── ConfirmYourBidEnterYourEmailViewController.swift
│       │   │   │   ├── ConfirmYourBidPINViewController.swift
│       │   │   │   ├── ConfirmYourBidPasswordViewController.swift
│       │   │   │   ├── ConfirmYourBidViewController.swift
│       │   │   │   ├── FulfillmentContainerViewController.swift
│       │   │   │   ├── FulfillmentNavigationController.swift
│       │   │   │   ├── GenericFormValidationViewModel.swift
│       │   │   │   ├── KeypadContainerView.swift
│       │   │   │   ├── KeypadView.swift
│       │   │   │   ├── KeypadViewModel.swift
│       │   │   │   ├── LoadingViewController.swift
│       │   │   │   ├── LoadingViewModel.swift
│       │   │   │   ├── ManualCreditCardInputViewController.swift
│       │   │   │   ├── ManualCreditCardInputViewModel.swift
│       │   │   │   ├── Models/
│       │   │   │   │   ├── BidDetails.swift
│       │   │   │   │   ├── NewUser.swift
│       │   │   │   │   └── RegistrationCoordinator.swift
│       │   │   │   ├── PlaceBidNetworkModel.swift
│       │   │   │   ├── PlaceBidViewController.swift
│       │   │   │   ├── RegisterViewController.swift
│       │   │   │   ├── RegistrationEmailViewController.swift
│       │   │   │   ├── RegistrationMobileViewController.swift
│       │   │   │   ├── RegistrationPasswordViewController.swift
│       │   │   │   ├── RegistrationPasswordViewModel.swift
│       │   │   │   ├── RegistrationPostalZipViewController.swift
│       │   │   │   ├── StripeManager.swift
│       │   │   │   ├── SwipeCreditCardViewController.swift
│       │   │   │   └── YourBiddingDetailsViewController.swift
│       │   │   ├── Help/
│       │   │   │   ├── HelpAnimator.swift
│       │   │   │   └── HelpViewController.swift
│       │   │   ├── HelperFunctions.swift
│       │   │   ├── ListingsCollectionViewCell.swift
│       │   │   ├── Observable+JSONAble.swift
│       │   │   ├── Observable+Logging.swift
│       │   │   ├── Observable+Operators.swift
│       │   │   ├── Sale Artwork Details/
│       │   │   │   ├── ImageTiledDataSource.swift
│       │   │   │   ├── SaleArtworkDetailsViewController.swift
│       │   │   │   ├── SaleArtworkZoomViewController.swift
│       │   │   │   └── WhitespaceGobbler.swift
│       │   │   ├── UIKit+Rx.swift
│       │   │   ├── UILabel+Fonts.swift
│       │   │   ├── UIView+LongPressDisplayMessage.swift
│       │   │   └── UIViewController+Bidding.swift
│       │   └── LICENSE
│       ├── Result/
│       │   ├── AllTypealiases.swift
│       │   ├── Basic+Other+SourceryTemplates.swift
│       │   ├── Basic+Other+SourceryTemplates_Linux.swift
│       │   ├── Basic+Other.swift
│       │   ├── Basic.swift
│       │   ├── BasicFooExcluded.swift
│       │   ├── Function.swift
│       │   ├── Other.swift
│       │   ├── ProtocolCompositions.swift
│       │   └── Typealiases.swift
│       ├── Source/
│       │   ├── Bar.swift
│       │   ├── Foo.swift
│       │   ├── FooBar.swift
│       │   └── TestProject/
│       │       ├── TestProject/
│       │       │   └── Info.plist
│       │       └── TestProject.xcodeproj/
│       │           ├── project.pbxproj
│       │           └── project.xcworkspace/
│       │               └── contents.xcworkspacedata
│       ├── Source_Linux/
│       │   ├── Bar.swift
│       │   ├── Foo.swift
│       │   ├── FooBar.swift
│       │   └── TestProject/
│       │       ├── TestProject/
│       │       │   └── Info.plist
│       │       └── TestProject.xcodeproj/
│       │           ├── project.pbxproj
│       │           └── project.xcworkspace/
│       │               └── contents.xcworkspacedata
│       ├── Stubs.swift
│       ├── SwiftTemplates/
│       │   ├── Equality.swift
│       │   ├── Equality.swifttemplate
│       │   ├── Function.swifttemplate
│       │   ├── IncludeCycle.swifttemplate
│       │   ├── IncludeFile.swifttemplate
│       │   ├── IncludeFileNoExtension.swifttemplate
│       │   ├── Includes.swifttemplate
│       │   ├── IncludesNoExtension.swifttemplate
│       │   ├── Invalid.swifttemplate
│       │   ├── InvalidTag.swifttemplate
│       │   ├── Other.swifttemplate
│       │   ├── Runtime.swifttemplate
│       │   ├── SelfIncludeCycle.swifttemplate
│       │   ├── SubfolderFileIncludes.swifttemplate
│       │   ├── SubfolderIncludes.swifttemplate
│       │   ├── Throws.swifttemplate
│       │   ├── includeCycle/
│       │   │   ├── One.swifttemplate
│       │   │   └── Two.swifttemplate
│       │   └── lib/
│       │       ├── Equality.swift
│       │       ├── One.swifttemplate
│       │       └── Two.swifttemplate
│       └── Templates/
│           ├── Basic.stencil
│           ├── GenerationWays.stencil
│           ├── Include.stencil
│           ├── Other.stencil
│           ├── Partial.stencil
│           ├── SourceryTemplateEJS.sourcerytemplate
│           └── SourceryTemplateStencil.sourcerytemplate
├── SourceryUtils/
│   ├── Sources/
│   │   ├── Path+Extensions.swift
│   │   ├── Sha.swift
│   │   ├── Time.swift
│   │   └── Version.swift
│   └── Supporting Files/
│       ├── Info.plist
│       └── SourceryUtils.h
├── SourceryUtils.podspec
├── Templates/
│   ├── .swiftlint.yml
│   ├── CodableContext/
│   │   ├── CodableContext.h
│   │   └── Info.plist
│   ├── CodableContextTests/
│   │   ├── CodableContextTests.swift
│   │   └── Info.plist
│   ├── Templates/
│   │   ├── AutoCases.stencil
│   │   ├── AutoCodable.swifttemplate
│   │   ├── AutoEquatable.stencil
│   │   ├── AutoHashable.stencil
│   │   ├── AutoLenses.stencil
│   │   ├── AutoMockable.stencil
│   │   ├── Decorator.swifttemplate
│   │   └── LinuxMain.stencil
│   ├── Templates.xcodeproj/
│   │   ├── project.pbxproj
│   │   └── xcshareddata/
│   │       └── xcschemes/
│   │           └── TemplatesTests.xcscheme
│   ├── Tests/
│   │   ├── Context/
│   │   │   ├── AutoCases.swift
│   │   │   ├── AutoCodable.swift
│   │   │   ├── AutoEquatable.swift
│   │   │   ├── AutoHashable.swift
│   │   │   ├── AutoLenses.swift
│   │   │   ├── AutoMockable.swift
│   │   │   └── LinuxMain.swift
│   │   ├── Context_Linux/
│   │   │   ├── AutoCases.swift
│   │   │   ├── AutoEquatable.swift
│   │   │   ├── AutoHashable.swift
│   │   │   ├── AutoLenses.swift
│   │   │   ├── AutoMockable.swift
│   │   │   └── LinuxMain.swift
│   │   ├── Expected/
│   │   │   ├── AutoCases.expected
│   │   │   ├── AutoCodable.expected
│   │   │   ├── AutoEquatable.expected
│   │   │   ├── AutoHashable.expected
│   │   │   ├── AutoLenses.expected
│   │   │   ├── AutoMockable.expected
│   │   │   └── LinuxMain.expected
│   │   ├── Generated/
│   │   │   ├── AutoCases.generated.swift
│   │   │   ├── AutoCodable.generated.swift
│   │   │   ├── AutoEquatable.generated.swift
│   │   │   ├── AutoHashable.generated.swift
│   │   │   ├── AutoLenses.generated.swift
│   │   │   ├── AutoMockable.generated.swift
│   │   │   └── LinuxMain.generated.swift
│   │   ├── Info.plist
│   │   └── TemplatesTests.swift
│   └── artifactbundle.info.json.template
├── TryCatch/
│   ├── Info.plist
│   ├── TryCatch.m
│   └── include/
│       └── TryCatch.h
├── docs/
│   ├── Classes/
│   │   ├── Actor.html
│   │   ├── ArrayType.html
│   │   ├── AssociatedType.html
│   │   ├── AssociatedValue.html
│   │   ├── Attribute.html
│   │   ├── Class.html
│   │   ├── ClosureParameter.html
│   │   ├── ClosureType.html
│   │   ├── DictionaryType.html
│   │   ├── DiffableResult.html
│   │   ├── Enum.html
│   │   ├── EnumCase.html
│   │   ├── GenericParameter.html
│   │   ├── GenericRequirement/
│   │   │   └── Relationship.html
│   │   ├── GenericRequirement.html
│   │   ├── GenericType.html
│   │   ├── GenericTypeParameter.html
│   │   ├── Import.html
│   │   ├── Method.html
│   │   ├── MethodParameter.html
│   │   ├── Modifier.html
│   │   ├── Protocol.html
│   │   ├── ProtocolComposition.html
│   │   ├── SetType.html
│   │   ├── Struct.html
│   │   ├── Subscript.html
│   │   ├── TupleElement.html
│   │   ├── TupleType.html
│   │   ├── Type.html
│   │   ├── TypeName.html
│   │   ├── Types.html
│   │   └── Variable.html
│   ├── Enums/
│   │   └── Composer.html
│   ├── Examples.html
│   ├── Extensions/
│   │   ├── Array.html
│   │   ├── String.html
│   │   ├── StringProtocol.html
│   │   └── Typealias.html
│   ├── Guides.html
│   ├── Other Classes.html
│   ├── Other Enums.html
│   ├── Other Extensions.html
│   ├── Other Protocols.html
│   ├── Other Typealiases.html
│   ├── Protocols/
│   │   ├── Annotated.html
│   │   ├── Definition.html
│   │   ├── Diffable.html
│   │   ├── Documented.html
│   │   └── Typed.html
│   ├── Types.html
│   ├── codable.html
│   ├── css/
│   │   ├── highlight.css
│   │   └── jazzy.css
│   ├── decorator.html
│   ├── diffable.html
│   ├── enum-cases.html
│   ├── equatable.html
│   ├── hashable.html
│   ├── index.html
│   ├── installing.html
│   ├── js/
│   │   ├── jazzy.js
│   │   ├── jazzy.search.js
│   │   └── typeahead.jquery.js
│   ├── lenses.html
│   ├── linuxmain.html
│   ├── mocks.html
│   ├── search.json
│   ├── usage.html
│   └── writing-templates.html
└── guides/
    ├── Codable.md
    ├── Decorator.md
    ├── Diffable.md
    ├── Enum cases.md
    ├── Equatable.md
    ├── Hashable.md
    ├── Installing.md
    ├── Lenses.md
    ├── LinuxMain.md
    ├── Mocks.md
    ├── Usage.md
    └── Writing templates.md

================================================
FILE CONTENTS
================================================

================================================
FILE: .circleci/config.yml
================================================
version: 2

jobs:
  test:
    macos:
      xcode: "14.3.1"
    environment:
      BUNDLE_JOBS: 3
      BUNDLE_RETRY: 3
      BUNDLE_PATH: vendor/bundle
    shell: /bin/bash --login -eo pipefail
    steps:
      - checkout
      - run: sudo defaults write com.apple.dt.Xcode IDEPackageSupportUseBuiltinSCM YES
      - run: rm ~/.ssh/id_rsa || true
      - run: for ip in $(dig @8.8.8.8 bitbucket.org +short); do ssh-keyscan bitbucket.org,$ip; ssh-keyscan $ip; done 2>/dev/null >> ~/.ssh/known_hosts || true 
      - run: for ip in $(dig @8.8.8.8 github.com +short); do ssh-keyscan github.com,$ip; ssh-keyscan $ip; done 2>/dev/null >> ~/.ssh/known_hosts || true
      - run: brew update 1> /dev/null 2> /dev/null
      - run: brew install sourcekitten
      - run: brew install coreutils
      - run: echo "ruby-3.0.6" > ~/.ruby-version
      - run: bundle install
      - run: bundle exec rake validate_docs
      - run: bundle exec danger || true
      - run: set -o pipefail
      - run: bundle exec rake build
      - run: bundle exec rake tests
workflows:
  version: 2
  build-test:
    jobs:
      - test


================================================
FILE: .codecov.yml
================================================
coverage:
  ignore:
    - Sourcery/main.swift
    - Sourcery/CodeGenerated/*
    - Pods/*
  status:
    patch: false
    changes: false
    project:
      default:
        target: 70
comment: false


================================================
FILE: .github/workflows/bump_homebrew.yml
================================================
name: Bump Homebrew formula

on:
  workflow_dispatch:
    inputs:
      tag-name:
        description: 'The git tag name to bump the formula to'
        required: true

jobs:
  homebrew:
    name: Bump Homebrew formula
    runs-on: macos-13
    steps:
      - uses: mislav/bump-homebrew-formula-action@v3
        with:
          formula-name: sourcery
          tag-name: ${{ github.event.inputs.tag-name }}
        env:
          COMMITTER_TOKEN: ${{ secrets.HOMEBREW_COMMITTER_TOKEN }}

================================================
FILE: .github/workflows/docker.yml
================================================
name: Docker

permissions:
  contents: read
  packages: write

on:
  push:
    branches:
      - master
    tags:
      - '*'

# https://docs.docker.com/build/ci/github-actions/multi-platform/#distribute-build-across-multiple-runners
jobs:
  build:
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-24.04
            platform: linux-amd64
          - os: ubuntu-24.04-arm
            platform: linux-arm64
    runs-on: ${{ matrix.os }}
    steps:
    - name: Set lowercase repository name
      run: |
        echo "REPOSITORY_LC=${REPOSITORY,,}" >>${GITHUB_ENV}
      env:
        REPOSITORY: '${{ github.repository }}'

    - name: Set up Docker Buildx
      uses: docker/setup-buildx-action@v3

    - name: Login to GitHub registry
      uses: docker/login-action@v3
      with:
        registry: ghcr.io
        username: ${{ github.actor }}
        password: ${{ secrets.GITHUB_TOKEN }}

    - uses: docker/build-push-action@v6
      id: build
      with:
        tags: ghcr.io/${{ env.REPOSITORY_LC }}
        outputs: type=image,push-by-digest=true,name-canonical=true,push=true

    - name: Export digest
      run: |
        mkdir -p ${{ runner.temp }}/digests
        digest="${{ steps.build.outputs.digest }}"
        touch "${{ runner.temp }}/digests/${digest#sha256:}"
    
    - name: Upload digest
      uses: actions/upload-artifact@v4
      with:
        name: digests-${{ matrix.platform }}
        path: ${{ runner.temp }}/digests/*
        if-no-files-found: error
        retention-days: 1

  merge:
    runs-on: ubuntu-24.04
    needs: build
    steps:
    - name: Set lowercase repository name
      run: |
        echo "REPOSITORY_LC=${REPOSITORY,,}" >>${GITHUB_ENV}
      env:
        REPOSITORY: '${{ github.repository }}'

    - name: Download digests
      uses: actions/download-artifact@v4
      with:
        path: ${{ runner.temp }}/digests
        pattern: digests-*
        merge-multiple: true

    - name: Login to GitHub registry
      uses: docker/login-action@v3
      with:
        username: ${{ github.actor }}
        password: ${{ secrets.GITHUB_TOKEN }}
        registry: ghcr.io

    - name: Set up Docker Buildx
      uses: docker/setup-buildx-action@v3

    - name: Docker meta
      id: meta
      uses: docker/metadata-action@v5
      with:
        images: ghcr.io/${{ env.REPOSITORY_LC }}

    - name: Create manifest list and push
      working-directory: ${{ runner.temp }}/digests
      run: |
        docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
          $(printf 'ghcr.io/${{ env.REPOSITORY_LC }}@sha256:%s ' *)

    - name: Inspect image
      run: |
        docker buildx imagetools inspect ghcr.io/${{ env.REPOSITORY_LC }}:${{ steps.meta.outputs.version }}


================================================
FILE: .github/workflows/jazzy.yml
================================================
# This workflow will build a Swift project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift

name: rake docs

on:
  workflow_call:
  workflow_dispatch:
    inputs:
      ref:
        description: 'Ref to build (branch, tag or SHA)'
        required: false
        default: 'master'
  push:
    branches: [ "master" ]

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
  update_docs:
    runs-on: macos-14
    steps:
    - name: Set Xcode 15.3.0
      run: sudo xcode-select -s /Applications/Xcode_15.3.0.app/Contents/Developer
    - name: Print Current Xcode
      run: xcode-select -p
    - uses: actions/checkout@v3
    - name: Update Docs
      run: |
        brew install coreutils
        brew install sourcekitten
        bundle install
        rake docs
    - uses: EndBug/add-and-commit@v9.1.3
      with:
        add: '.'
        message: 'Update Docs'
        committer_name: GitHub Actions
        committer_email: actions@github.com

 


================================================
FILE: .github/workflows/release_macOS.yml
================================================
name: release macOS

on:
  workflow_dispatch:
    inputs:
      ref:
        description: 'Ref to build (branch, tag or SHA)'
        required: false
        default: 'master'
  push:
    tags:
      - '*'
      
jobs:
  tests:
    uses: ./.github/workflows/test_macOS.yml
  build:
    needs: [tests]
    name: Build Sourcery for macOS
    runs-on: macos-14
    steps:
      - name: Set Xcode 15.3.0
        run: sudo xcode-select -s /Applications/Xcode_15.3.0.app/Contents/Developer
      - name: Print Current Xcode
        run: xcode-select -p
      - uses: actions/checkout@v3
        with:
          ref: ${{ github.event.inputs.ref }}
      - name: Build it
        id: build
        run: |
          brew install coreutils
          brew install sourcekitten
          bundle install
          rake docs

          CLI_DIR="${HOME}/cli/"
          RESOURCES_DIR="${CLI_DIR}Resources/"
          TEMPLATES_DIR="${CLI_DIR}Templates/"
          BUILD_DIR="${HOME}/build/"
          BIN_DIR="${CLI_DIR}bin/"
          ARTIFACT_BUNDLE_PATH="${HOME}/artifactbundle/"
          path_to_sourcery_binary="${BIN_DIR}/sourcery"

          mkdir -p $BIN_DIR
          mkdir -p $RESOURCES_DIR
          mkdir -p $TEMPLATES_DIR
          mkdir -p ${ARTIFACT_BUNDLE_PATH}bin

          cp -r docs/docsets/Sourcery.docset $CLI_DIR
          cp -r "Templates/Templates/" $TEMPLATES_DIR
          cp Resources/daemon.gif $RESOURCES_DIR
          cp Resources/icon-128.png $RESOURCES_DIR
          cp CHANGELOG.md $CLI_DIR
          cp README.md $CLI_DIR
          cp LICENSE $CLI_DIR

          cp -r SourceryJS/Resources/ejs.js $BIN_DIR
          cp -r $CLI_DIR/ "${ARTIFACT_BUNDLE_PATH}sourcery"
          cp Templates/artifactbundle.info.json.template ${ARTIFACT_BUNDLE_PATH}/info.json

          swift build --disable-sandbox -c release --arch arm64 --build-path $BUILD_DIR
          swift build --disable-sandbox -c release --arch x86_64 --build-path $BUILD_DIR
          lipo -create -output $path_to_sourcery_binary ${BUILD_DIR}arm64-apple-macosx/release/sourcery ${BUILD_DIR}x86_64-apple-macosx/release/sourcery
          strip -rSTX ${path_to_sourcery_binary}

          cp $path_to_sourcery_binary "${ARTIFACT_BUNDLE_PATH}sourcery/bin/"

          pushd $CLI_DIR
          TAG=$GITHUB_REF_NAME
          FILENAME="sourcery-$TAG.zip"
          zip -r -X $FILENAME .
          mv $FILENAME "${HOME}/"
          popd

          pushd $ARTIFACT_BUNDLE_PATH
          sed -i '' "s/VERSION/${TAG}/g" ${ARTIFACT_BUNDLE_PATH}/info.json
          ARTIFACTBUNDLENAME=$FILENAME.artifactbundle.zip
          zip -r -X $ARTIFACTBUNDLENAME .
          mv $ARTIFACTBUNDLENAME "${HOME}/"
          popd

          echo "FILENAME=${FILENAME}" >> $GITHUB_OUTPUT
          echo "ARTIFACTBUNDLENAME=${ARTIFACTBUNDLENAME}" >> $GITHUB_OUTPUT
      - name: 'Upload Sourcery Artifact'
        uses: actions/upload-artifact@v4
        with:
          name: ${{ steps.build.outputs.FILENAME }}
          path: "~/${{ steps.build.outputs.FILENAME }}"
          retention-days: 5
      - name: 'Upload Bundle Artifact'
        uses: actions/upload-artifact@v4
        with:
          name: ${{ steps.build.outputs.ARTIFACTBUNDLENAME }}
          path: "~/${{ steps.build.outputs.ARTIFACTBUNDLENAME }}"
          retention-days: 5

================================================
FILE: .github/workflows/release_ubuntu.yml
================================================
name: release ubuntu

on:
  workflow_dispatch:
    inputs:
      ref:
        description: 'Ref to build (branch, tag or SHA)'
        required: false
        default: 'master'
  push:
    tags:
      - '*'

jobs:
  tests:
    uses: ./.github/workflows/test_ubuntu.yml
  build:
    needs: [tests]
    name: Build Sourcery for Ubuntu (latest)
    runs-on: ubuntu-22.04
    outputs:
      filename: ${{ steps.build.outputs.filename }}
    steps:
      - uses: actions/checkout@v3
        with:
          ref: ${{ github.event.inputs.ref }}
      - name: Setup Swift
        uses: swift-actions/setup-swift@v2
        with:
          swift-version: "5.10"
      - name: Build it
        id: build
        run: |
          BUILD_DIR="${HOME}/build/"
          swift build --disable-sandbox -c release --build-path $BUILD_DIR
          mv "${BUILD_DIR}x86_64-unknown-linux-gnu/release/sourcery" "${BUILD_DIR}/sourcery"
          
          UNAME=$(uname -m)
          CODENAME=$(lsb_release -c -s)
          DESCRIPTION=$(lsb_release -d -s | sed "s/ /-/g" | sed "s/./\L&/g")
          SUFFIX=$DESCRIPTION-$CODENAME-$UNAME
          TAG=$GITHUB_REF_NAME
          FILENAME="sourcery-${TAG}-${SUFFIX}.tar.xz"

          pushd $BUILD_DIR
          tar -zcvf $FILENAME sourcery
          mv $FILENAME "${HOME}/"
          popd
          
          echo "FILENAME=${FILENAME}" >> $GITHUB_OUTPUT
      - name: 'Upload Artifact'
        uses: actions/upload-artifact@v4
        with:
          name: ${{ steps.build.outputs.FILENAME }}
          path: "~/${{ steps.build.outputs.FILENAME }}"
          retention-days: 5


================================================
FILE: .github/workflows/test_macOS.yml
================================================
# This workflow will build a Swift project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift

name: test macOS

on:
  workflow_call:
  push:
    branches: [ "master" ]
  pull_request:
    branches: [ "master" ]

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: ${{ github.ref_type != 'tag' }}

jobs:
  macos_build:
    runs-on: macos-14
    steps:
    - name: Set Xcode 15.3.0
      run: sudo xcode-select -s /Applications/Xcode_15.3.0.app/Contents/Developer
    - name: Print Current Xcode
      run: xcode-select -p
    - uses: actions/checkout@v3
    - name: Run tests
      run: swift test

 


================================================
FILE: .github/workflows/test_ubuntu.yml
================================================
# This workflow will build a Swift project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift

name: test ubuntu

on:
  workflow_call:
  push:
    branches: [ "master" ]
  pull_request:
    branches: [ "master" ]

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: ${{ github.ref_type != 'tag' }}

jobs:
  linux_build:
    runs-on: ubuntu-22.04
    steps:
    - name: Setup Swift
      uses: YOCKOW/Action-setup-swift@main
      with:
        swift-version: "5.10"
    - name: Get swift version
      run: swift --version
    - uses: actions/checkout@v3
    - name: Run tests
      run: swift test


================================================
FILE: .gitignore
================================================
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## Bundler
.bundle*

## macOS
.DS_Store

## GitHub Token
.apitoken

## Build generated
build/
cli/
DerivedData/

## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/
*.xcscmblueprint

## Other
*.moved-aside
*.xcuserstate
*.profraw

## Obj-C/Swift specific
*.hmap
*.ipa
*.dSYM.zip
*.dSYM

## Playgrounds
timeline.xctimeline
playground.xcworkspace

# Swift Package Manager
#
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
Packages/
Package.pins
.build/
.swiftpm/

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# Pods/

# Ruby
Vendor/

# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts

Carthage/Build

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md

fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
Sourcery/CodeGenerated/TypedSpec.generated.swift

# jazzy
docs/docsets
docs/undocumented.json

# IDEA based IDEs (AppCode, CLion) configuration
.idea

# Local binary distributions downloads
distributions/

Sourcery.xcodeproj


================================================
FILE: .gitmodules
================================================


================================================
FILE: .jazzy.yaml
================================================
author: Krzysztof Zabłocki
author_url: https://twitter.com/merowing_
module: Sourcery
sourcekitten_sourcefile: docs.json 
github_url: https://github.com/krzysztofzablocki/Sourcery
copyright: 'Copyright © 2016-2021 Pixle. All rights reserved.'
readme: About.md
documentation: guides/*.md
exclude: ["*_Linux.swift"] 

custom_categories:
  - name: Guides
    children:
      - Installing
      - Usage
      - Writing templates

  - name: Examples
    children:
      - Equatable
      - Hashable
      - Enum cases
      - Lenses
      - Mocks
      - Codable
      - Diffable
      - LinuxMain
      - Decorator

  - name: Types
    children:
      - Types 
      - Type
      - Protocol
      - Class
      - Struct
      - Enum
      - EnumCase
      - AssociatedValue
      - AssociatedType
      - Variable 
      - Method
      - MethodParameter
      - Subscript
      - TypeName
      - TupleType
      - TupleElement
      - ArrayType
      - DictionaryType
      - ClosureType
      - GenericType
      - GenericTypeParameter
      - Attribute
      - ProtocolComposition


================================================
FILE: .pre-commit-hooks.yaml
================================================
- id: sourcery
  name: Sourcery
  description: 'Meta-programming for Swift, stop writing boilerplate code.'
  language: swift
  entry: sourcery
  require_serial: true
  pass_filenames: false
  always_run: true


================================================
FILE: .ruby-version
================================================
3.4.1

================================================
FILE: .sourcery-macOS.yml
================================================
sources:
 - SourceryRuntime/Sources/Common
 - SourceryRuntime/Sources/macOS
templates:
 - Sourcery/Templates/Coding.stencil
 - Sourcery/Templates/JSExport.ejs
 - Sourcery/Templates/Typed.stencil
 - Sourcery/Templates/TypedSpec.stencil
output:
 SourceryRuntime/Sources/Generated


================================================
FILE: .sourcery-ubuntu.yml
================================================
sources:
 - SourceryRuntime/Sources/Common
 - SourceryRuntime/Sources/Linux
templates:
 - Sourcery/Templates/Coding.stencil
 - Sourcery/Templates/JSExport.ejs
 - Sourcery/Templates/Typed.stencil
 - Sourcery/Templates/TypedSpec.stencil
output:
 SourceryRuntime/Sources/Generated


================================================
FILE: .swift-version
================================================
5.8


================================================
FILE: .swiftlint.yml
================================================
disabled_rules: # rule identifiers to exclude from running
  - function_parameter_count
  - line_length
  - variable_name
  - cyclomatic_complexity
  - nesting
  - conditional_binding_cascade
  - large_tuple

opt_in_rules: # some rules are only opt-in
  - force_unwrapping
  - force_https
  - empty_count
  - conditional_binding_cascade

included:
  - Sourcery
  - SourceryRuntime
  - SourceryTests
  - Templates/Tests

excluded: # paths to ignore during linting. Takes precedence over `included`.
  - Carthage
  - Pods
  - Packages
  - SourceryTests/Stub
  - Templates/Tests/Generated
  - Templates/Tests/Expected

type_body_length:
  - 700 #warning
  - 1000 #error

file_length:
  - 1000 #warning
  - 1200 #error

function_body_length:
  - 125 #warning
  - 200 #error

type_name:
  min_length: 3 # only warning
  max_length: # warning and error
    warning: 50
    error: 50

custom_rules:
  force_https:
    name: "Force HTTPS over HTTP"
    regex: "((?i)http(?!s))"
    match_kinds: string
    message: "HTTPS should be favored over HTTP"
    severity: warning

  explicit_failure_calls:
    name: "Avoid asserting 'false'"
    regex: '((assert|precondition)\(false)'
    message: "Use assertionFailure() or preconditionFailure() instead."
    severity: warning


================================================
FILE: .vscode/launch.json
================================================
{
    "configurations": [
        {
            "type": "lldb",
            "request": "launch",
            "sourceLanguages": [
                "swift"
            ],
            "name": "Debug sourcery",
            "program": "${workspaceFolder:Sourcery}/.build/debug/sourcery",
            "args": [],
            "cwd": "${workspaceFolder:Sourcery}",
            "preLaunchTask": "swift: Build Debug sourcery"
        },
        {
            "type": "lldb",
            "request": "launch",
            "sourceLanguages": [
                "swift"
            ],
            "name": "Release sourcery",
            "program": "${workspaceFolder:Sourcery}/.build/release/sourcery",
            "args": [],
            "cwd": "${workspaceFolder:Sourcery}",
            "preLaunchTask": "swift: Build Release sourcery"
        }
    ]
}

================================================
FILE: .vscode/settings.json
================================================
{}

================================================
FILE: ABOUT.md
================================================
## What is Sourcery?
_**Sourcery** scans your source code, applies your personal templates and generates Swift code for you, allowing you to use meta-programming techniques to save time and decrease potential mistakes._

Using it offers many benefits:

- Write less repetitive code and make it easy to adhere to [DRY principle](https://en.wikipedia.org/wiki/Don't_repeat_yourself).
- It allows you to create better code, one that would be hard to maintain without it, e.g. [performing automatic property level difference in tests](https://github.com/krzysztofzablocki/Sourcery/blob/master/Sourcery/Templates/Diffable.stencil)
- Limits the risk of introducing human error when refactoring.
- Sourcery **doesn't use runtime tricks**, in fact, it allows you to leverage compiler, even more, creating more safety.
- **Immediate feedback:** Sourcery features built-in daemon support, enabling you to write your templates in real-time side-by-side with generated code.

**Sourcery is so meta that it is used to code-generate its boilerplate code**

## Why?

Swift features very limited runtime and no meta-programming features. Which leads our projects to contain boilerplate code.

Sourcery exists to allow Swift developers to stop doing the same thing over and over again while still maintaining strong typing, preventing bugs and leveraging compiler.

Have you ever?

- Had to write equatable/hashable?
- Had to write NSCoding support?
- Had to implement JSON serialization?
- Wanted to use Lenses?

If you did then you probably found yourself writing repetitive code to deal with those scenarios, does this feel right?

Even worse, if you ever add a new property to a type all of those implementations have to be updated, or you will end up with bugs.
In those scenarios usually **compiler will not generate the error for you**, which leads to error prone code.



================================================
FILE: CHANGELOG.md
================================================
# Sourcery CHANGELOG

## 2.3.0
* Added `withExtendedLifetime` support for better lifetime management in templates (#1419) — @swiftty
* Fix PBXGroup duplication while linking (#1422, #1423) — @markmax12
* Fix deadlock when using EJS templates in watch mode (#1421) — @robertjpayne
* Fix `AutoMockable` Generation for a couple of cases with existential `any` (#1420) — @musiienko
* Ensured compatibility with Xcode 26 (#1428, #1434, #1439) — @bo2themax 
* Update docker workflow to also build ARM64 image (#1436) - @Cyberbeni

## 2.2.7
* Feature/typed throws support by @alexandre-pod in https://github.com/krzysztofzablocki/Sourcery/pull/1401
* Add missing `isGeneric` dynamic member by @tayloraswift in https://github.com/krzysztofzablocki/Sourcery/pull/1408

## 2.2.6 
* Method/Initializer parameter types now resolve to the local type if it exists by @liamnichols in https://github.com/krzysztofzablocki/Sourcery/pull/1347
* Fixed wrong relative path in symbolic link by @pavel-trafimuk in https://github.com/krzysztofzablocki/Sourcery/pull/1350
* chore: add unchecked Sendable conformance to AutoMockable by @nekrich in https://github.com/krzysztofzablocki/Sourcery/pull/1355
* Fixes issue around mutable capture of 'inout' parameter 'buffer' is not allowed in concurrently-executing code by @mapierce in https://github.com/krzysztofzablocki/Sourcery/pull/1363
* chore(deps): bump rexml from 3.2.8 to 3.3.6 by @dependabot in https://github.com/krzysztofzablocki/Sourcery/pull/1360
* Updated swift-syntax package's url (#1354) by @akhmedovgg in https://github.com/krzysztofzablocki/Sourcery/pull/1364
* `Templates/AutoMockable.stencil`: fix stencil to consider nullable closures as escaping by @alexdmotoc in https://github.com/krzysztofzablocki/Sourcery/pull/1358
* Fix AutoMockable for closure with multiple parameters by @MontakOleg in https://github.com/krzysztofzablocki/Sourcery/pull/1373
* fix: AutoEquatable Stencil to use `any` for protocols by @iDevid in https://github.com/krzysztofzablocki/Sourcery/pull/1367
* Add support for child configs by @jimmya in https://github.com/krzysztofzablocki/Sourcery/pull/1338
* Try to fix associated types messing up types unification by @fabianmuecke in https://github.com/krzysztofzablocki/Sourcery/pull/1377
* Added annotations to typealiases and typealiases property to EJS template context. by @fabianmuecke in https://github.com/krzysztofzablocki/Sourcery/pull/1379
* Fix module name for xcframework by @till0xff in https://github.com/krzysztofzablocki/Sourcery/pull/1381
* Fix protocol inheritance by @till0xff in https://github.com/krzysztofzablocki/Sourcery/pull/1383
* Fixed nested type resolution by @till0xff in https://github.com/krzysztofzablocki/Sourcery/pull/1384
* fix: Fixes description of Method's genericParameters by @sergiocampama in https://github.com/krzysztofzablocki/Sourcery/pull/1386
* Ability to use custom header prefix by @ilia3546 in https://github.com/krzysztofzablocki/Sourcery/pull/1389
* Fixed tests under linux by @art-divin in https://github.com/krzysztofzablocki/Sourcery/pull/1390
* chore(deps): bump rexml from 3.3.6 to 3.3.9 by @dependabot in https://github.com/krzysztofzablocki/Sourcery/pull/1376
* Fixing dockerfile by @art-divin in https://github.com/krzysztofzablocki/Sourcery/pull/1391

## 2.2.5
* chore(deps): bump nokogiri from 1.16.2 to 1.16.5 by @dependabot in https://github.com/krzysztofzablocki/Sourcery/pull/1331
* Fix typo in Decorator.md by @ahmedk92 in https://github.com/krzysztofzablocki/Sourcery/pull/1339
* chore(deps): bump rexml from 3.2.5 to 3.2.8 by @dependabot in https://github.com/krzysztofzablocki/Sourcery/pull/1332
* Fixed incorrect case prefix parsing by @art-divin in https://github.com/krzysztofzablocki/Sourcery/pull/1341
* Fixed crash when inline function has out of bound indexes by @art-divin in https://github.com/krzysztofzablocki/Sourcery/pull/1342
* Improved concurrency support in SwiftTemplate caching by @art-divin in https://github.com/krzysztofzablocki/Sourcery/pull/1344
* Fix associatedtype generics by @art-divin in https://github.com/krzysztofzablocki/Sourcery/pull/1345
* AutoMockable: fix generating static reset func by @MontakOleg in https://github.com/krzysztofzablocki/Sourcery/pull/1336
* Enabled lookup for generic type information in arrays by @art-divin in https://github.com/krzysztofzablocki/Sourcery/pull/1346

## 2.2.4
- Fixed typealias resolution breaking resolution of real types. by @fabianmuecke ([#1325](https://github.com/krzysztofzablocki/Sourcery/pull/1325))
- Disabled type resolving for local method generic parameters by @art-divin ([#1327](https://github.com/krzysztofzablocki/Sourcery/pull/1327))
- Added hideVersionHeader to configuration arguments by @art-divin ([#1328](https://github.com/krzysztofzablocki/Sourcery/pull/1328))

## 2.2.3
## Changes
- Fixed Issue when Caching of SwiftTemplate Binary Failes by @art-divin ([#1323](https://github.com/krzysztofzablocki/Sourcery/pull/1323))

## 2.2.2
## Changes
- Improved Logging/Error Handling during SwiftTemplate Processing by @art-divin ([#1320](https://github.com/krzysztofzablocki/Sourcery/pull/1320))

## 2.2.1
## Changes
- Set minimum platform for macOS by @art-divin ([#1319](https://github.com/krzysztofzablocki/Sourcery/pull/1319))

## 2.2.0
## Changes
- Remove Sourcery version from header by @dcacenabes in ([#1309](https://github.com/krzysztofzablocki/Sourcery/pull/1309))
- Enable Single Print when Generating Based on Swifttemplate by @art-divin in ([#1308](https://github.com/krzysztofzablocki/Sourcery/pull/1308))
- [Bug] Annotations aren't being extracted from initializers by @liamnichols in ([#1311](https://github.com/krzysztofzablocki/Sourcery/pull/1311))
- Implemented Proper Protocol Composition Type Parsing by @art-divin in ([#1314](https://github.com/krzysztofzablocki/Sourcery/pull/1314))
- Renamed parenthesis to parentheses by @art-divin in ([#1315](https://github.com/krzysztofzablocki/Sourcery/pull/1315))
- Switched to Double for CLI argument processing by @art-divin in ([#1317](https://github.com/krzysztofzablocki/Sourcery/pull/1317))
- Added isDistributed to Actor and Method by @art-divin in ([#1318](https://github.com/krzysztofzablocki/Sourcery/pull/1318))
- Enable Quotes when parsing arguments in property wrapper parameters by @art-divin in ([#1316](https://github.com/krzysztofzablocki/Sourcery/pull/1316))

## 2.1.8
## Changes
- ClosureParameter isVariadic Support by @art-divin in ([#1268](https://github.com/krzysztofzablocki/Sourcery/pull/1268))
- Update Usage.md to include --parseDocumentation option by @MarcoEidinger in ([#1272](https://github.com/krzysztofzablocki/Sourcery/pull/1272))
- Format processing time log message by @MontakOleg in ([#1274](https://github.com/krzysztofzablocki/Sourcery/pull/1274))
- Fixed swift-package-manager version by @art-divin in ([#1280](https://github.com/krzysztofzablocki/Sourcery/pull/1280))
- Added isSet to TypeName by @art-divin in ([#1281](https://github.com/krzysztofzablocki/Sourcery/pull/1281))
- chore(deps): bump nokogiri from 1.15.4 to 1.16.2 by @dependabot in ([#1273](https://github.com/krzysztofzablocki/Sourcery/pull/1273))
- Implement GenericRequirement support for member type disambiguation by @art-divin in ([#1283](https://github.com/krzysztofzablocki/Sourcery/pull/1283))
- Add generic requirements to Method by @art-divin in ([#1284](https://github.com/krzysztofzablocki/Sourcery/pull/1284))
- Recognize subclasses with generics by @art-divin in ([#1287](https://github.com/krzysztofzablocki/Sourcery/pull/1287))
- Implemented typealias unboxing during type resolution by @art-divin in ([#1288](https://github.com/krzysztofzablocki/Sourcery/pull/1288))
- Added documentation to typealias by @art-divin in ([#1289](https://github.com/krzysztofzablocki/Sourcery/pull/1289))
- Fix: Function with completion as parameter that contains itself an optional any parameter produces wrong mock by @paul1893 in ([#1290](https://github.com/krzysztofzablocki/Sourcery/pull/1290))
- Fix: Function with inout parameter when function has more than one parameter produces wrong mock by @paul1893 in ([#1291](https://github.com/krzysztofzablocki/Sourcery/pull/1291))
- Substitute underlying type from typealias by @art-divin in ([#1292](https://github.com/krzysztofzablocki/Sourcery/pull/1292))
- Added support for multiline documentation comments by @art-divin in ([#1293](https://github.com/krzysztofzablocki/Sourcery/pull/1293))
- Update SwiftSyntax dependency to 510.0.0 by @calda in ([#1294](https://github.com/krzysztofzablocki/Sourcery/pull/1294))
- Resolved all SwiftSyntax Warnings by @art-divin in ([#1295](https://github.com/krzysztofzablocki/Sourcery/pull/1295))
- Trailing Annotation Parsing by @art-divin in ([#1296](https://github.com/krzysztofzablocki/Sourcery/pull/1296))
- Fixed Crash in AnnotationParser by @art-divin in ([#1297](https://github.com/krzysztofzablocki/Sourcery/pull/1297))
- Disabled Optimization During Generated Code Verification by @art-divin in ([#1300](https://github.com/krzysztofzablocki/Sourcery/pull/1300))
- Adjusted file structure to accommodate two generated files by @art-divin in ([#1299](https://github.com/krzysztofzablocki/Sourcery/pull/1299))
- Expand --serialParse flag to also apply to Composer.uniqueTypesAndFunctions by @calda in ([#1301](https://github.com/krzysztofzablocki/Sourcery/pull/1301))
- Make AutoMockable Generate Compilable Swift Code by @art-divin in ([#1304](https://github.com/krzysztofzablocki/Sourcery/pull/1304))
- Fix Closure Parameter CVarArg with Existential by @art-divin in ([#1305](https://github.com/krzysztofzablocki/Sourcery/pull/1305))

## 2.1.7
## Changes
- 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](https://github.com/krzysztofzablocki/Sourcery/pull/1263))

## 2.1.6
## Changes
- Podspec updates - set specific version per supported platform

## 2.1.5
## Changes
- Podspec updates
- Add support for inout parameter for AutoMockable protocols ([#1261](https://github.com/krzysztofzablocki/Sourcery/pull/1261))

## 2.1.4
## Changes
- Added generic requirements and generic parameters to Subscript ([#1242](https://github.com/krzysztofzablocki/Sourcery/issues/1242))
- Added isAsync and throws to Subscript ([#1249](https://github.com/krzysztofzablocki/Sourcery/issues/1249))
- Initialise Subscript's returnTypeName with TypeSyntax, not String ([#1250](https://github.com/krzysztofzablocki/Sourcery/issues/1250))
- Swifty generated variable names + fixed generated mocks compilation issues due to method generic parameters ([#1252](https://github.com/krzysztofzablocki/Sourcery/issues/1252))

## 2.1.3
## Changes
- Add support for `typealias`es in EJS templates. ([#1208](https://github.com/krzysztofzablocki/Sourcery/pull/1208))
- Add support for existential to Automockable Protocol with generic types. ([#1220](https://github.com/krzysztofzablocki/Sourcery/pull/1220))
- Add support for generic parameters and requirements in subscripts.
    ([#1242](https://github.com/krzysztofzablocki/Sourcery/pull/1242))
- Throw throwable error after updating mocks's calls counts and received parameters/invocations.
    ([#1224](https://github.com/krzysztofzablocki/Sourcery/pull/1224))
- Fix unit tests on Linux ([#1225](https://github.com/krzysztofzablocki/Sourcery/pull/1225))
- Updated XcodeProj to 8.16.0 ([#1228](https://github.com/krzysztofzablocki/Sourcery/pull/1228))
- Fixed Unable to mock a protocol with methods that differ in parameter type - Error: "Invalid redeclaration" ([#1238](https://github.com/krzysztofzablocki/Sourcery/issues/1238))
- Support for variadic arguments as method parameters ([#1222](https://github.com/krzysztofzablocki/Sourcery/issues/1222))

## 2.1.2
## Changes
- Bump SPM version to support Swift 5.9 ([#1213](https://github.com/krzysztofzablocki/Sourcery/pull/1213))
- Add Dockerfile ([#1211](https://github.com/krzysztofzablocki/Sourcery/pull/1211))

## 2.1.1
## Changes
- Separate EJSTemplate.swift for swift test and for swift build -c release ([#1203](https://github.com/krzysztofzablocki/Sourcery/pull/1203))

## 2.1.0
## Changes
- Added support for Swift Package Manager config ([#1184](https://github.com/krzysztofzablocki/Sourcery/pull/1184))
- Add support to any keyword for function parameter type to AutoMockable.stencil ([#1169](https://github.com/krzysztofzablocki/Sourcery/pull/1169))
- Add support to any keyword for function return type to AutoMockable.stencil([#1186](https://github.com/krzysztofzablocki/Sourcery/pull/1186))
- Add support for protocol compositions in EJS templates. ([#1192](https://github.com/krzysztofzablocki/Sourcery/pull/1192))
- Linux Support (experimental) ([#1188](https://github.com/krzysztofzablocki/Sourcery/pull/1188))
- Add support for opaque type (some keyword) to function parameter type in AutoMockable.stencil ([#1197](https://github.com/krzysztofzablocki/Sourcery/pull/1197))

## 2.0.3
## Internal Changes
- Modifications to included files of Swift Templates are now detected by hashing instead of using the modification date when invalidating the cache ([#1161](https://github.com/krzysztofzablocki/Sourcery/pull/1161))
- Fixes incorrectly parsed /r/n newline sequences ([#1165](https://github.com/krzysztofzablocki/Sourcery/issues/1165) and [#1138](https://github.com/krzysztofzablocki/Sourcery/issues/1138))
- Fixes incorrect parsing of annotations if there are attributes on lines preceeding declaration ([#1141](https://github.com/krzysztofzablocki/Sourcery/issues/1141))
- Fixes incorrect parsing of trailing inline comments following enum case' rawValue ([#1154](https://github.com/krzysztofzablocki/Sourcery/issues/1154))
- Fixes incorrect parsing of multibyte enum case identifiers with associated values
- Improves type inference when using contained types for variables ([#1091](https://github.com/krzysztofzablocki/Sourcery/issues/1091))

## 2.0.2
- Fixes incorrectly parsed variable names that include property wrapper and comments, closes #1140

## 2.0.1
## Internal Changes
- Fixed non-ASCII characters handling in source code parsing [#1130](https://github.com/krzysztofzablocki/Sourcery/pull/1130)
- Improved performance by about 20%

## Changes
- 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

## 1.9.2
## Internal Changes
- Reverts part of [#1113](https://github.com/krzysztofzablocki/Sourcery/pull/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)

## 1.9.1
## New Features
- Adds support for public protocols in AutoMockable template [#1100](https://github.com/krzysztofzablocki/Sourcery/pull/1100)
- Adds support for async and throwing properties to AutoMockable template [#1101](https://github.com/krzysztofzablocki/Sourcery/pull/1101)
- Adds support for actors and nonisolated methods [#1112](https://github.com/krzysztofzablocki/Sourcery/pull/1112)

## Internal Changes
- Fixed parsing of extensions and nested types in swiftinterface files [#1113](https://github.com/krzysztofzablocki/Sourcery/pull/1113)

## 1.9.0
- Update StencilSwiftKit to fix SPM resolving issue when building as a Command Plugin [#1023](https://github.com/krzysztofzablocki/Sourcery/issues/1023)
- Adds new `--cacheBasePath` option to `SourceryExecutable` to allow for plugins setting a default cache [#1093](https://github.com/krzysztofzablocki/Sourcery/pull/1093)
- Adds new `--dry` option to `SourceryExecutable` to check output without file system modifications [#1097](https://github.com/krzysztofzablocki/Sourcery/pull/1097)
- Changes parser to new [SwiftSyntax Parser](https://github.com/apple/swift-syntax/pull/767)
- Drops dylib dependency

## 1.8.2
## New Features
- Added `deletingLastComponent` filter to turn `/Path/Class.swift` into `/Path`
- Added `directory` computed property to `Type`

## 1.8.1
## New Features
- 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](https://github.com/krzysztofzablocki/Sourcery/pull/1063)

## Internal Changes
- Lower project requirements to allow compilation using Swift 5.5/Xcode 13.x [#1049](https://github.com/krzysztofzablocki/Sourcery/pull/1049)
- Update Stencil to 0.14.2
- Use `swift build` insead of `xcodebuild` when building binary [#1057](https://github.com/krzysztofzablocki/Sourcery/pull/1057)

## 1.8.0
## New Features
- Adds `xcframework` key to `target` object in configuration file to enable processing of `swiftinterface`

## Fixes
- Fixed issues generating Swift Templates when using Xcode 13.3 [#1040](https://github.com/krzysztofzablocki/Sourcery/issues/1040)
- Modifications to included files of Swift Templates now correctly invalidate the cache - [#889](https://github.com/krzysztofzablocki/Sourcery/issues/889)

## Internal Changes
- 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](https://github.com/krzysztofzablocki/Sourcery/pull/1037)

## 1.7.0

## New Features
- Adds `fileName` to `Type` and exposes `path` as well
- Adds support for parsing async methods, closures and variables

## Fixes
- 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

---

## 1.6.1
## New Features
- Added `CLI-Only` subspec to `Sourcery.podspec` [#997](https://github.com/krzysztofzablocki/Sourcery/pull/997)
- Added documentation comment parsing for all declarations [#1002](https://github.com/krzysztofzablocki/Sourcery/pull/1002)
- Updates Yams to 4.0.6
- Enables universal binary

---

## 1.6.0
## Fixes
- Update dependencies to fix build on Xcode 13 and support Swift 5.5 [#989](https://github.com/krzysztofzablocki/Sourcery/issues/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.

## 1.5.0
## Features
- Adds support for variadic parameters in functions
- Adds support for parsing property wrappers
- Added `titleCase` filter that turns `somethingNamedLikeThis` into `Something Named Like This`

## Fixes
- correct passing `force-parse` argument to specific file parsers and renames it to `forceParse` to align with other naming
- corrects `isMutable` regression on protocol variables #964
- Added multiple targets to link
- Fix groups creation

---
## 1.4.2

## Fixes
- 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](https://github.com/krzysztofzablocki/Sourcery/issues/956)

## New Feature
- 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

---
## 1.4.1

## New Feature
- Extending AutoMockable template by adding handling of "autoMockableImports" and "autoMockableTestableImports" args.
- Sourcery now supports [sourcerytemplates generated by Sourcery Pro](https://merowing.info/sourcery-pro/)

## Fixes
- 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

---
## 1.4.0

## Features
- Added `allImports` property to `Type`, which returns all imports existed in all files containing this type and all its super classes/protocols.
- Added `basedTypes` property to `Type`, 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` and `typed` stencil tags from [Sourcery Pro](https://merowing.info/sourcery-pro/)

## Fixes
- 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

## Internal changes
- 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

## 1.3.4
## Fixes
- `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

## 1.3.3
## Fixes
- Fixes information being lost when extending unknown type more than once
- Multiple configuration files can be now passed through command line arguments

## Templates
- AutoEquatable will use type.accessLevel for it's function, closes #675
## Internal changes
- If you are using `.swifttemplate` in your configuration you might notice performance degradation, this is due to new composer added in `1.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 to `1.3.1`.  

## 1.3.2
## New Features
- Configuration file now supports multiple configurations at once

## Fixes
- When resolving extensions inherit their access level for methods/subscripts/variables and sub-types fixes #910
- When resolving Parent.ChildGenericType<Type> properly parses generic information

## Internal changes
- Faster composing phase

## 1.3.1
## Internal changes
- SwiftSyntax dylib is now bundled with the binary

## 1.3.0
## Internal changes
- 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

## Configuration changes
- added `logAST` that will cause AST warnings and errors to be logged, default `false`
- added `logBenchmarks` that will cause benchmark informations to be logged, default `false`

## AST Data Changes
- 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 had `attributes` 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 via `module`)
- 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 inherit `associatedType` from it's parent if it's not present
- Single value tuples will be automatically unwrapped when parsing

### Attributes
- 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 `_`

## 1.2.1

## Internal Changes
Tweaks some warnings into info logs to not generate Xcode warnings

## 1.2.0

### New Features
- `Self` reference is resolved to correct type. [Enchancement Request](https://github.com/krzysztofzablocki/Sourcery/issues/900)
- 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](https://github.com/krzysztofzablocki/Sourcery/issues/899)

## Internal Changes
- Sourcery is now always distributed via SPM, this creates much nicer diffs when using CocoaPods distribution.

## 1.1.1

- Updates StencilSwiftKit to 2.8.0

## 1.1.0

### New Features
- [PR](https://github.com/krzysztofzablocki/Sourcery/pull/897) Methods, Variables and Subscripts are now uniqued in all accessors:
  - `methods` and `allMethods` 
  - `variables` and `allVariables`
  - `subscripts` and `allSubscripts`
  - 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

## 1.0.3

### Internal Changes
- updated xcodeproj, Stencil and StencilSwiftKit to newest versions

### Bug fixes
- [Fixes type resolution when using xcode project integration](https://github.com/krzysztofzablocki/Sourcery/issues/887)
- Matches the behaviour of `allMethods` to `allVariables` 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.

## 1.0.2

### Bug fixes
- 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

## 1.0.1

### Internal Changes

- Updated project and CI to Xcode 12.1
- Updated SourceKitten, Commander.

### Bug fixes

- Fix multiline method declarations parsing
- Fix an issue, where "types.implementing.<protocolName>" 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)

## 1.0.0

### New Features

- Added support for associated types (#539)

### Bug fixes

- Disallow protocol compositions from being considered as the `rawType` of an `enum` (#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)

## 0.18.0

### New Features

- Added `optional` filter for variables
- Added `json` filter to output raw JSON objects
- Added `.defaultValue` to `AssociatedValue`
- Added support for parsing [Protocol Compositions](https://docs.swift.org/swift-book/ReferenceManual/Types.html#ID454)
- Added support for parsing free functions
- Added support for indirect enum cases
- Added support for accessing all typealiases via `typealiases` and `typesaliasesByName`
- Added support for parsing global typealiases

### Internal Changes

- Improved error logging when running with `--watch` option
- Updated CI to Xcode 11.4.1

### Bug fixes

- 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)

## 0.17.0

### Internal Changes

- 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

## 0.16.2

### New Features

- Support automatic linking of files generated by annotations to project target

### Bug fixes

- Fixes always broken sourcery cache
- Add missing SourceryFramework library product in Package.swift

## 0.16.1

### Bug fixes
- 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

### Internal Changes

- Removed dependency on SwiftTryCatch pod in order to avoid Swift Package Manager errors.

## 0.16.0

- 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 of `arguments`, 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 from `Hashable`, 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.

## 0.15.0

### New Features

- 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

## 0.14.0

### New Features

- 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

```

### Internal Changes

- Use AnyObject for class-only protocols

### Bug fixes

- 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.

## 0.13.1

### New Features

- 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

## 0.13.0

### New Features

- Added AutoCodable template

### Bug fixes

- 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

## 0.12.0

### Internal Changes

- Migrate to Swift 4.1 and Xcode 9.3

## 0.11.2

### Bug fixes

- 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

## 0.11.1

### Internal changes

- Do not fail the build if slather fails
- Updated SourceKitten to 0.20.0

### Bug fixes

- Fixed parsing protocol methods return type (#579)

## 0.11.0

### New Features

- 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 for `Method`
- 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` and `types.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:

 ```swift
<% for type in (types.implementing["SomeProtocol"] ?? []) { %>
```

 The new correct syntax would be:

 ```swift
<% for type in types.implementing["SomeProtocol"] { %>
```

### Internal changes

- 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

### Bug fixes

- 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 than `undefined 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

## 0.10.1

* When installing Sourcery via CocoaPods, the unneeded `file.zip` is not kept in `Pods/Sourcery/` anymore _(freeing ~12MB on each install of Sourcery made via CocoaPods!)_.

## 0.10.0

### New Features

- 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

### Internal changes

- 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

## 0.9.0

### New Features

- 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

### Bug fixes

- Fixed single file generation not skipping writing the file when there is no generated content

### Internal changes

- Updated dependencies for Swift 4
- Update internal ruby dependencies

## 0.8.0

### New Features

- Added support in `AutoHashable` for static variables, `[Hashable]` array and `[Hashable: Hashable]` dictionary
- Added `definedInType` property for `Method` and `Variable`
- 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).

### Bug fixes

- 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 on `SourceryRuntime.framework` when using Swift templates
- Fixed `auto:inline` for nested types (this concerns the first time the code is inserted)

### Internal changes

- Fix link for template in docs
- Fix running Sourcery in the example app
- Add step to update internal boilerplate code during the release


## 0.7.2

### Internal changes

- Add Version.swift to represent CLI tool version


## 0.7.1

### Bug fixes

- Fixed regression in parsing templates from config file
- Removed meaningless `isMutating` property for `Variable`

### Internal changes

- Improvements in release script
- Updated boilerplate code to reflect latest changes


## 0.7.0

### New Features

- Added `inout` flag for `MethodParameter`
- Added parsing `mutating` and `final` attributes with convenience `isMutating` and `isFinal` properties
- Added support for `include` Stencil tag
- Added support for excluded paths

### Bug fixes

- Fixed inserting generated code inline automatically at wrong position
- Fixed regression in AutoEquatable & AutoHashable template with private computed variables

### Internal changes

- Internal release procedure improvements
- Improved `TemplatesTests` scheme running
- Fixed swiftlint warnings (version 0.19.0)


## 0.6.1

### New Features

- 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 in `implementing` and `inheriting`
- Added support for includes in EJS templates (for example: `<%- include('myTemplate.js') %>`)
- Add the `lowerFirst` filter for Stencil templates.
- Added `isRequired` property for `Method`
- 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

### Bug fixes

- 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`

### Internal changes

- Improved `AutoMockable.stencil` to support protocols with `init` methods
- Improved `AutoCases.stencil` to use `let` instead of computed `var`
- 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


## 0.6.0

### New Features

- Added some convenience accessors for classic, static and instance methods, and types and contained types grouped by names

## 0.6

### New Features

- Added support for inline code generation without requiring explicit `// sourcery:inline` comments in the source files. To use, use `sourcery:inline:auto` in a template: `// sourcery:inline:auto:MyType.TemplateName`
- Added `isMutable` property for `Variable`
- 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 for `Method`
- 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 to `true` (`false` by default)
- Sourcery now will remove inline annotation comments from generated code.
- Added `rethrows` property to `Method`
- 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

### Bug Fixes

- 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

### Internal changes

- Replaced `TypeReflectionBox` and `GenerationContext` types with common `TemplateContext`.

## 0.5.9

### New Features

- 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

### Bug Fixes

- Fixed observing swift and js templates
- Fixed parsing generic array types
- Fixed using dictionary in annotations

## 0.5.8

### New Features

- Added parsing array types
- Added support for JavaScript templates (using EJS)

### Bug Fixes

- Fixed escaping variables with reserved names
- Fixed duplicated methods and variables in `allMethods` and `allVariables`
- Fixed trimming attributes in type names

## 0.5.7

### Bug Fixes
- Cache initial file contents, including the inline generated ranges so that they are always up to date

## 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 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
- Improved support for contained types

### 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` 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

### 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

- 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
    }
<% } %>
```

### 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` 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
- 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

### 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

### 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

### Internal changes
- 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.

## 0.4.7

### New Features
- Added `contains`, `hasPrefix`, `hasPrefix` filters

### Bug Fixes
- AccessLevel is now stored as string

## 0.4.6

### Bug Fixes
- Typealiases parsing could cause crash, implemented a workaround for that until we can find a little more reliable solution

## 0.4.5

### New Features

* Swift Package Manager support.

## 0.4.4

### New Features

* Enum cases also have annotation support

### Internal changes

* Improved handling of global and local typealiases.

## 0.4.3

### New Features
* Add upperFirst stencil filter

## 0.4.2

### Bug Fixes

* Fixes a bug with flattening `inherits`, `implements` for protocols implementing other protocols
* Improve `rawType` logic for Enums

### New Features

* Annotations can now be declared also with sections e.g. `sourcery:begin: attribute1, attribute2 = 234`
* Adds scanning class variables as static

### Internal changes

* Refactored models
* Improved performance of annotation scanning

## 0.4.1

### New Features

* Implements inherits, implements, based reflection on each Type
* Flattens inheritance, e.g. Foo implements Decodable, then FooSubclass also implements it

### Internal changes

* Stop parsing private variables as they wouldn't be accessible to code-generated code

## 0.4.0

### New Features

* improve detecting raw type
* add `isGeneric` property

## 0.3.9

### New Features

* Enables support for scanning extensions of unknown type, providing partial metadata via types.based or types.all reflection

## 0.3.8
### New Features

* Adds real type reflection into Variable, not only it's name
* Resolves known typealiases

## 0.3.7
### Bug Fixes

* Fixes a bug that caused Sourcery to drop previous type information when encountering generated code, closes #33

## 0.3.6
### Bug Fixes

* Fixes bug in escaping path
* Fixes missing protocol variant in kind


## 0.3.5

### New Features
* 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

### Internal changes

* improved detecting enums with rawType


================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
  address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
  professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at krzysztof.zablocki@pixle.pl. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/


================================================
FILE: CONTRIBUTING.md
================================================
# Contributing to Sourcery

Sourcery is an open source project started by Krzysztof Zabłocki and open to the entire Cocoa community.

I really appreciate your help!

## Filing issues

When filing an issue, make sure to answer these questions:

1. What version of Swift are you using (`swift --version`)?
2. What did you do?
3. What did you expect to see?
4. What did you see instead?

## Contributing code

Before submitting changes, please follow these guidelines:

1. Check the open issues and pull requests for existing discussions.
2. Open an issue to discuss a new feature.
3. Write tests.
4. Make sure your changes pass existing tests.
5. Make sure the entire test suite passes locally and on Circle CI.
6. Open a Pull Request.

Unless otherwise noted, the Sourcery source files are distributed under
the MIT-style [LICENSE](LICENSE).

[Please review our Code of Conduct](https://github.com/krzysztofzablocki/Sourcery/blob/master/CODE_OF_CONDUCT.md)


================================================
FILE: Dangerfile
================================================
# Sometimes it's a README fix, or something like that - which isn't relevant for
# including in a project's CHANGELOG for example
not_declared_trivial = !(github.pr_title.include? "#trivial")
has_app_changes = !git.modified_files.grep(/(Sourcery|Templates)/).empty?

# Make it more obvious that a PR is a work in progress and shouldn't be merged yet
warn("PR is classed as Work in Progress") if github.pr_title.include? "[WIP]"

# Warn when there is a big PR
warn("Big PR") if git.lines_of_code > 500

# Don't let testing shortcuts get into master by accident
fail("fit left in tests") if `grep -rI "fit(" SourceryTests/`.length > 1
fail("fdescribe left in tests") if `grep -rI "fdescribe(" SourceryTests/`.length > 1
fail("fcontext left in tests") if `grep -rI "fcontext(" SourceryTests/`.length > 1

# Changelog entries are required for changes to library files.
no_changelog_entry = !git.modified_files.include?("CHANGELOG.md")
if has_app_changes && no_changelog_entry && not_declared_trivial
  fail("Any changes to library code need a summary in the Changelog.")
end

# New templates must be covered with tests
has_new_stencil_template = !git.added_files.grep(/Templates\/Templates.*\.stencil$/).empty?
has_new_template_test = !git.added_files.grep(/Templates\/Tests\/Generated/).empty? && !git.added_files.grep(/Templates\/Tests\/Context/).empty? && !git.added_files.grep(/Templates\/Tests\/Expected/).empty?
if has_new_stencil_template && !has_new_template_test
  fail("Any new stencil template must be covered with test.")
end


================================================
FILE: Dockerfile
================================================
ARG BUILDER_IMAGE=swift:6.0-jammy
ARG RUNTIME_IMAGE=swift:6.0-jammy-slim

# Builder image
FROM ${BUILDER_IMAGE} AS builder
RUN apt-get update && apt-get install -y \
    build-essential \
    libffi-dev \
    libncurses5-dev \
    libsqlite3-dev \
 && rm -r /var/lib/apt/lists/*
WORKDIR /workdir/
COPY Sourcery Sourcery/
COPY SourceryExecutable SourceryExecutable/
COPY SourceryFramework SourceryFramework/
COPY SourceryJS SourceryJS/
COPY SourceryRuntime SourceryRuntime/
COPY SourceryStencil SourceryStencil/
COPY SourcerySwift SourcerySwift/
COPY SourceryTests SourceryTests/
COPY SourceryUtils SourceryUtils/
COPY Plugins Plugins/
COPY Templates Templates/
COPY Tests Tests/
COPY Package.* ./

RUN swift package --only-use-versions-from-resolved-file resolve
ARG SWIFT_FLAGS="-c release"
RUN swift build $SWIFT_FLAGS --product sourcery
RUN mv `swift build $SWIFT_FLAGS --show-bin-path`/sourcery /usr/bin
RUN sourcery --version

# Runtime image
FROM ${RUNTIME_IMAGE}
LABEL org.opencontainers.image.source https://github.com/krzysztofzablocki/Sourcery
RUN apt-get update && apt-get install -y \
    libcurl4 \
    libsqlite3-0 \
    libxml2 \
 && rm -r /var/lib/apt/lists/*
COPY --from=builder /usr/bin/sourcery /usr/bin

RUN sourcery --version

CMD ["sourcery"]


================================================
FILE: Funding.yml
================================================
github: krzysztofzablocki
custom: https://www.merowing.info/membership


================================================
FILE: Gemfile
================================================
source 'https://rubygems.org'

gem 'cocoapods', '1.14.3'
gem 'danger'
gem 'rake'
gem 'slather'
gem 'xcpretty'
gem 'ffi', '1.15.3'
gem 'json', '2.5.1'
gem 'jazzy', '0.14.0'


================================================
FILE: LICENSE
================================================
MIT License

Copyright (c) 2016-2021 Krzysztof Zabłocki

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


================================================
FILE: LINUX.md
================================================
## Linux Support

Currently (as per 2.1.0 release), Linux Support is **experimental**. This means the following:

1. Running `sourcery` in the root folder of Sourcery project was generating `Equatable.generated.swift` and other autogenerated files with extensions of classes used by `SourceryRuntime`, but they were moved to class definitions due to the abscense of `@objc` attribute on non-Darwin platforms. Thus, `.sourcery.yaml` file was disabled for the moment, until #1198 is resolved.
2. Some unit tests were disabled with `#if canImport(ObjectiveC)`, that is some due to Swift compiler crashes, some due to abscence of `JavaScriptCore`.
3. `FileWatcher` needs to be re-implemented (see [this comment](https://github.com/krzysztofzablocki/Sourcery/pull/1188#issue-1828038476) for a possible fix)


All issues related to Linux will be mentioned in #1198

## Using Sourcery under Linux

Simply add package dependency of Sourcery as described in the [README](README.md).

## Using Sourcery with Docker

You can build Docker container with Sourcery installed using this command:

```console
docker build -t sourcery-image .
```

Then you can run this Docker image passing the arguments you'd like:

```console
docker run sourcery-image sourcery --help
```

## Contributing
### Installation of Linux Environment

I have installed ubuntu VM through [tart](https://github.com/cirruslabs/tart/issues/62#issuecomment-1225956540) and updated to 22.04 according to [this guide](https://www.linuxtechi.com/upgrade-ubuntu-20-04-to-ubuntu-22-04/).

I had to run the following commands prior to being able to run `bundle install` in Sourcery:

1. `sudo apt install libffi-dev`
2. `sudo apt install build-essential`
3. `sudo apt install libsqlite3-dev`
4. `sudo apt-get install libncurses5-dev`

Then, `swiftly` needs to be installed to easily manage Swift installation under Linux. How to install Swiftly is described [in this README](https://github.com/swift-server/swiftly).

### Running Tests Under Linux

To run tests, you can use either Visual Studio Code distribution, or simply `swift test` in Sourcery root directory.

#### Visual Studio Code

To install VS Code, you can follow [the official guide](https://code.visualstudio.com/docs/setup/linux), which mentions the following commands:

```bash
sudo apt-get install wget gpg
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
rm -f packages.microsoft.gpg

# Then update the package cache and install the package using:

sudo apt install apt-transport-https
sudo apt update
sudo apt install code # or code-insiders
```

### Test Discovery Under Linux

Due to a missing feature in Swift Package Manager, tests under Linux are not discovered if the root class, from which tests are inherited, is located "in another Package/Module". Details regarding this [can be found here](https://github.com/apple/swift-package-manager/issues/5573).

And so, if a new `Spec` needs to be added, that Spec file needs to be put into `LinuxMain.swift` similarly to what is there already, mentioning the new class name accordingly.


================================================
FILE: LinuxMain.swift
================================================
import XCTest
import Quick

@testable import SourceryLibTests
@testable import TemplatesTests
@testable import CodableContextTests

@main struct Main {
    static func main() {
        Quick.QCKMain([
            ActorSpec.self,
            AnnotationsParserSpec.self,
            ClassSpec.self,
            ConfigurationSpec.self,
            DiffableSpec.self,
            DryOutputSpec.self,
            EnumSpec.self,
            FileParserAssociatedTypeSpec.self,
            FileParserAttributesSpec.self,
            FileParserMethodsSpec.self,
            FileParserProtocolCompositionSpec.self,
            FileParserSpec.self,
            FileParserSubscriptsSpec.self,
            FileParserVariableSpec.self,
            GeneratorSpec.self,
            MethodSpec.self,
            ParserComposerSpec.self,
            ProtocolSpec.self,
            SourcerySpecTests.self,
            StencilTemplateSpec.self,
            StringViewSpec.self,
            StructSpec.self,
            SwiftTemplateTests.self,
            TemplateAnnotationsParserSpec.self,
            TemplatesAnnotationParserPassInlineCodeSpec.self,
            TypeNameSpec.self,
            TypeSpec.self,
            TypealiasSpec.self,
            TypedSpec.self,
            VariableSpec.self,
            VerifierSpec.self,
            CodableContextTests.self,
            TemplatesTests.self
        ],
        configurations: [],
        testCases: [
            testCase(ActorSpec.allTests),
            testCase(AnnotationsParserSpec.allTests),
            testCase(ClassSpec.allTests),
            testCase(ConfigurationSpec.allTests),
            testCase(DiffableSpec.allTests),
            testCase(DryOutputSpec.allTests),
            testCase(EnumSpec.allTests),
            testCase(FileParserAssociatedTypeSpec.allTests),
            testCase(FileParserAttributesSpec.allTests),
            testCase(FileParserMethodsSpec.allTests),
            testCase(FileParserProtocolCompositionSpec.allTests),
            testCase(FileParserSpec.allTests),
            testCase(FileParserSubscriptsSpec.allTests),
            testCase(FileParserVariableSpec.allTests),
            testCase(GeneratorSpec.allTests),
            testCase(MethodSpec.allTests),
            testCase(ParserComposerSpec.allTests),
            testCase(ProtocolSpec.allTests),
            testCase(SourcerySpecTests.allTests),
            testCase(StencilTemplateSpec.allTests),
            testCase(StringViewSpec.allTests),
            testCase(StructSpec.allTests),
            testCase(SwiftTemplateTests.allTests),
            testCase(TemplateAnnotationsParserSpec.allTests),
            testCase(TemplatesAnnotationParserPassInlineCodeSpec.allTests),
            testCase(TypeNameSpec.allTests),
            testCase(TypeSpec.allTests),
            testCase(TypealiasSpec.allTests),
            testCase(TypedSpec.allTests),
            testCase(VariableSpec.allTests),
            testCase(VerifierSpec.allTests),
            testCase(CodableContextTests.allTests),
            testCase(TemplatesTests.allTests)
        ])
    }
}

================================================
FILE: Package.resolved
================================================
{
  "pins" : [
    {
      "identity" : "aexml",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/tadija/AEXML.git",
      "state" : {
        "revision" : "38f7d00b23ecd891e1ee656fa6aeebd6ba04ecc3",
        "version" : "4.6.1"
      }
    },
    {
      "identity" : "commander",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/kylef/Commander.git",
      "state" : {
        "revision" : "4b6133c3071d521489a80c38fb92d7983f19d438",
        "version" : "0.9.1"
      }
    },
    {
      "identity" : "cwlcatchexception",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/mattgallagher/CwlCatchException.git",
      "state" : {
        "revision" : "07b2ba21d361c223e25e3c1e924288742923f08c",
        "version" : "2.2.1"
      }
    },
    {
      "identity" : "cwlpreconditiontesting",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/mattgallagher/CwlPreconditionTesting.git",
      "state" : {
        "revision" : "0139c665ebb45e6a9fbdb68aabfd7c39f3fe0071",
        "version" : "2.2.2"
      }
    },
    {
      "identity" : "nimble",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/Quick/Nimble.git",
      "state" : {
        "revision" : "e491a6731307bb23783bf664d003be9b2fa59ab5",
        "version" : "9.0.0"
      }
    },
    {
      "identity" : "pathkit",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/kylef/PathKit.git",
      "state" : {
        "revision" : "3bfd2737b700b9a36565a8c94f4ad2b050a5e574",
        "version" : "1.0.1"
      }
    },
    {
      "identity" : "quick",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/Quick/Quick.git",
      "state" : {
        "revision" : "8cce6acd38f965f5baa3167b939f86500314022b",
        "version" : "3.1.2"
      }
    },
    {
      "identity" : "spectre",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/kylef/Spectre.git",
      "state" : {
        "revision" : "26cc5e9ae0947092c7139ef7ba612e34646086c7",
        "version" : "0.10.1"
      }
    },
    {
      "identity" : "stencil",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/art-divin/Stencil.git",
      "state" : {
        "revision" : "03a1dca8923bef5a34c08f5a560fb420326f7244",
        "version" : "0.15.3"
      }
    },
    {
      "identity" : "stencilswiftkit",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/art-divin/StencilSwiftKit.git",
      "state" : {
        "revision" : "6b07f85def6984e7015d65502d41b91f3f8db6d5",
        "version" : "2.10.4"
      }
    },
    {
      "identity" : "swift-argument-parser",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/apple/swift-argument-parser.git",
      "state" : {
        "revision" : "8f4d2753f0e4778c76d5f05ad16c74f707390531",
        "version" : "1.2.3"
      }
    },
    {
      "identity" : "swift-asn1",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/apple/swift-asn1.git",
      "state" : {
        "revision" : "7faebca1ea4f9aaf0cda1cef7c43aecd2311ddf6",
        "version" : "1.3.0"
      }
    },
    {
      "identity" : "swift-certificates",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/apple/swift-certificates.git",
      "state" : {
        "revision" : "01d7664523af5c169f26038f1e5d444ce47ae5ff",
        "version" : "1.0.1"
      }
    },
    {
      "identity" : "swift-collections",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/apple/swift-collections.git",
      "state" : {
        "revision" : "671108c96644956dddcd89dd59c203dcdb36cec7",
        "version" : "1.1.4"
      }
    },
    {
      "identity" : "swift-crypto",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/apple/swift-crypto.git",
      "state" : {
        "revision" : "629f0b679d0fd0a6ae823d7f750b9ab032c00b80",
        "version" : "3.0.0"
      }
    },
    {
      "identity" : "swift-driver",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/art-divin/swift-driver.git",
      "state" : {
        "revision" : "1c07ced84c1dfc1f9c3253dcbaa216fc9c76ee25",
        "version" : "1.0.1"
      }
    },
    {
      "identity" : "swift-llbuild",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/art-divin/swift-llbuild.git",
      "state" : {
        "revision" : "783aec21649a6c47d1a8314db4144bdceb11df30",
        "version" : "1.0.0"
      }
    },
    {
      "identity" : "swift-package-manager",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/art-divin/swift-package-manager.git",
      "state" : {
        "revision" : "7df9321541e544d711dd93f5b97dd4e8bf7e100e",
        "version" : "1.0.8"
      }
    },
    {
      "identity" : "swift-syntax",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/swiftlang/swift-syntax.git",
      "state" : {
        "revision" : "0687f71944021d616d34d922343dcef086855920",
        "version" : "600.0.1"
      }
    },
    {
      "identity" : "swift-system",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/apple/swift-system.git",
      "state" : {
        "revision" : "836bc4557b74fe6d2660218d56e3ce96aff76574",
        "version" : "1.1.1"
      }
    },
    {
      "identity" : "swift-tools-support-core",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/art-divin/swift-tools-support-core.git",
      "state" : {
        "revision" : "930e82e5ae2432c71fe05f440b5d778285270bdb",
        "version" : "1.0.0"
      }
    },
    {
      "identity" : "xcodeproj",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/tuist/xcodeproj",
      "state" : {
        "revision" : "f6c9cb05835086af13f91317f92693848b43ea47",
        "version" : "8.24.6"
      }
    },
    {
      "identity" : "yams",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/jpsim/Yams.git",
      "state" : {
        "revision" : "c7facc5ccb8c5a4577ea8c491aa875762cdee57a",
        "version" : "5.0.3"
      }
    }
  ],
  "version" : 2
}


================================================
FILE: Package.swift
================================================
// swift-tools-version:5.8

import PackageDescription
import Foundation

var sourceryLibDependencies: [Target.Dependency] = [
    "SourceryFramework",
    "SourceryRuntime",
    "SourceryStencil",
    "SourceryJS",
    "SourcerySwift",
    "Commander",
    "PathKit",
    "Yams",
    "StencilSwiftKit",
    .product(name: "SwiftSyntax", package: "swift-syntax"),
    "XcodeProj",
    .product(name: "SwiftPM-auto", package: "swift-package-manager"),
]

// Note: when Swift Linux doesn't bug out on [String: String], add a test back for it
// See https://github.com/krzysztofzablocki/Sourcery/pull/1208#issuecomment-1752185381
#if canImport(ObjectiveC)
sourceryLibDependencies.append("TryCatch")
let templatesTestsResourcesCopy: [Resource] = [
    .copy("Templates"),
    .copy("Tests/Context"),
    .copy("Tests/Expected")
]
#else
sourceryLibDependencies.append(.product(name: "Crypto", package: "swift-crypto"))
let templatesTestsResourcesCopy: [Resource] = [
    .copy("Templates"),
    .copy("Tests/Context_Linux"),
    .copy("Tests/Expected")
]
#endif

// Note: when Swift Linux doesn't bug out on [String: String], add a test back for it
// See https://github.com/krzysztofzablocki/Sourcery/pull/1208#issuecomment-1752185381
#if canImport(ObjectiveC)
let sourceryLibTestsResources: [Resource] = [
    .copy("Stub/Configs"),
    .copy("Stub/Errors"),
    .copy("Stub/JavaScriptTemplates"),
    .copy("Stub/SwiftTemplates"),
    .copy("Stub/Performance-Code"),
    .copy("Stub/DryRun-Code"),
    .copy("Stub/Result"),
    .copy("Stub/Templates"),
    .copy("Stub/Source")
]
#else
let sourceryLibTestsResources: [Resource] = [
    .copy("Stub/Configs"),
    .copy("Stub/Errors"),
    .copy("Stub/JavaScriptTemplates"),
    .copy("Stub/SwiftTemplates"),
    .copy("Stub/Performance-Code"),
    .copy("Stub/DryRun-Code"),
    .copy("Stub/Result"),
    .copy("Stub/Templates"),
    .copy("Stub/Source_Linux")
]
#endif

var targets: [Target] = [
    .executableTarget(
        name: "SourceryExecutable",
        dependencies: ["SourceryLib"],
        path: "SourceryExecutable",
        exclude: [
            "Info.plist"
        ]
    ),
    .target(
        // Xcode doesn't like when a target has the same name as a product but in different case.
        name: "SourceryLib",
        dependencies: sourceryLibDependencies,
        path: "Sourcery",
        exclude: [
            "Templates",
        ]
    ),
    .target(
        name: "SourceryRuntime",
        dependencies: [
            "StencilSwiftKit"
        ],
        path: "SourceryRuntime",
        exclude: [
            "Supporting Files/Info.plist"
        ]
    ),
    .target(
        name: "SourceryFramework",
        dependencies: [
            "PathKit",
            .product(name: "SwiftSyntax", package: "swift-syntax"),
            .product(name: "SwiftParser", package: "swift-syntax"),
            "SourceryUtils",
            "SourceryRuntime"
        ],
        path: "SourceryFramework",
        exclude: [
            "Info.plist"
        ]
    ),
    .target(
        name: "SourceryStencil",
        dependencies: [
            "PathKit",
            "SourceryRuntime",
            "StencilSwiftKit",
        ],
        path: "SourceryStencil",
        exclude: [
            "Info.plist"
        ]
    ),
    .target(
        name: "SourceryJS",
        dependencies: [
            "PathKit"
        ],
        path: "SourceryJS",
        exclude: [
            "Info.plist"
        ],
        resources: [
            .copy("Resources/ejs.js")
        ]
    ),
    .target(
        name: "SourcerySwift",
        dependencies: [
            "PathKit",
            "SourceryRuntime",
            "SourceryUtils"
        ],
        path: "SourcerySwift",
        exclude: [
            "Info.plist"
        ]
    ),
    .target(
        name: "CodableContext",
        path: "Templates/Tests",
        exclude: [
            "Context/AutoCases.swift",
            "Context/AutoEquatable.swift",
            "Context/AutoHashable.swift",
            "Context/AutoLenses.swift",
            "Context/AutoMockable.swift",
            "Context/LinuxMain.swift",
            "Generated/AutoCases.generated.swift",
            "Generated/AutoEquatable.generated.swift",
            "Generated/AutoHashable.generated.swift",
            "Generated/AutoLenses.generated.swift",
            "Generated/AutoMockable.generated.swift",
            "Generated/LinuxMain.generated.swift",
            "Expected",
            "Info.plist",
            "TemplatesTests.swift"
        ],
        sources: [
            "Context/AutoCodable.swift",
            "Generated/AutoCodable.generated.swift"
        ]
    ),
    .testTarget(
        name: "SourceryLibTests",
        dependencies: [
            "SourceryLib",
            "Quick",
            "Nimble"
        ],
        exclude: [
            "Info.plist"
        ],
        resources: sourceryLibTestsResources,
        swiftSettings: [.unsafeFlags(["-enable-testing"])]
    ),
    .testTarget(
        name: "CodableContextTests",
        dependencies: [
            "CodableContext",
            "Quick",
            "Nimble"
        ],
        path: "Templates/CodableContextTests",
        exclude: [
            "Info.plist"
        ],
        swiftSettings: [.unsafeFlags(["-enable-testing"])]
    ),
    .testTarget(
        name: "TemplatesTests",
        dependencies: [
            "Quick",
            "Nimble",
            "PathKit"
        ],
        path: "Templates",
        exclude: [
            "CodableContext",
            "CodableContextTests",
            "Tests/Generated",
            "Tests/Info.plist"
        ],
        sources: [
            // LinuxMain is not compiled as part of the target
            // since there is no way to run script before compilation begins.
            "Tests/TemplatesTests.swift"
        ],
        resources: templatesTestsResourcesCopy,
        swiftSettings: [.unsafeFlags(["-enable-testing"])]
    ),
    .plugin(
        name: "SourceryCommandPlugin",
        capability: .command(
            intent: .custom(
                verb: "sourcery-command",
                description: "Sourcery command plugin for code generation"
            ),
            permissions: [
                .writeToPackageDirectory(reason: "Need permission to write generated files to package directory")
            ]
        ),
        dependencies: ["SourceryExecutable"]
    )
]

#if canImport(ObjectiveC)
let sourceryUtilsDependencies: [Target.Dependency] = ["PathKit"]
targets.append(.target(name: "TryCatch", path: "TryCatch", exclude: ["Info.plist"]))
#else
let sourceryUtilsDependencies: [Target.Dependency] = [
    "PathKit",
    .product(name: "Crypto", package: "swift-crypto")
]
#endif
targets.append(
    .target(
        name: "SourceryUtils",
        dependencies: sourceryUtilsDependencies,
        path: "SourceryUtils",
        exclude: [
            "Supporting Files/Info.plist"
        ]
    )
)

var dependencies: [Package.Dependency] = [
    .package(url: "https://github.com/jpsim/Yams.git", from: "5.0.3"),
    .package(url: "https://github.com/kylef/Commander.git", exact: "0.9.1"),
    // PathKit needs to be exact to avoid a SwiftPM bug where dependency resolution takes a very long time.
    .package(url: "https://github.com/kylef/PathKit.git", exact: "1.0.1"),
    .package(url: "https://github.com/art-divin/StencilSwiftKit.git", exact: "2.10.4"),
    .package(url: "https://github.com/tuist/XcodeProj.git", exact: "8.24.6"),
    .package(url: "https://github.com/swiftlang/swift-syntax.git", from: "600.0.0"),
    .package(url: "https://github.com/Quick/Quick.git", from: "3.0.0"),
    .package(url: "https://github.com/Quick/Nimble.git", from: "9.0.0"),
]

#if compiler(>=6.2)
dependencies.append(.package(url: "https://github.com/swiftlang/swift-package-manager.git", revision: "swift-6.2-RELEASE"))
#else
dependencies.append(.package(url: "https://github.com/art-divin/swift-package-manager.git", exact: "1.0.8"))
#endif

#if !canImport(ObjectiveC)
dependencies.append(.package(url: "https://github.com/apple/swift-crypto.git", from: "3.0.0"))
#endif

let package = Package(
    name: "Sourcery",
    platforms: [
        .macOS(.v13),
    ],
    products: [
        // SPM won't generate .swiftmodule for a target directly used by a product,
        // hence it can't be imported by tests. Executable target can't be imported too.
        .executable(name: "sourcery", targets: ["SourceryExecutable"]),
        .library(name: "SourceryRuntime", targets: ["SourceryRuntime"]),
        .library(name: "SourceryStencil", targets: ["SourceryStencil"]),
        .library(name: "SourceryJS", targets: ["SourceryJS"]),
        .library(name: "SourcerySwift", targets: ["SourcerySwift"]),
        .library(name: "SourceryFramework", targets: ["SourceryFramework"]),
        .library(name: "SourceryLib", targets: ["SourceryLib"]),
        .plugin(name: "SourceryCommandPlugin", targets: ["SourceryCommandPlugin"])
    ],
    dependencies: dependencies,
    targets: targets
)


================================================
FILE: Plugins/SourceryCommandPlugin/SourceryCommandPlugin.swift
================================================
import PackagePlugin
import Foundation

@main
struct SourceryCommandPlugin {
    private func run(_ sourcery: String, withConfig configFilePath: String, cacheBasePath: String) throws {
        let sourceryURL = URL(fileURLWithPath: sourcery)
        
        let process = Process()
        process.executableURL = sourceryURL
        process.arguments = [
            "--config",
            configFilePath,
            "--cacheBasePath",
            cacheBasePath
        ]
        
        try process.run()
        process.waitUntilExit()
        
        let gracefulExit = process.terminationReason == .exit && process.terminationStatus == 0
        if !gracefulExit {
            throw "🛑 The plugin execution failed with reason: \(process.terminationReason.rawValue) and status: \(process.terminationStatus) "
        }
    }
}

// MARK: - CommandPlugin

extension SourceryCommandPlugin: CommandPlugin {
    func performCommand(context: PluginContext, arguments: [String]) async throws {
        // Run one per target
        for target in context.package.targets {
            let configFilePath = target.directory.appending(subpath: ".sourcery.yml").string
            let sourcery = try context.tool(named: "SourceryExecutable").path.string
            
            guard FileManager.default.fileExists(atPath: configFilePath) else {
                Diagnostics.warning("⚠️ Could not find `.sourcery.yml` for target \(target.name)")
                continue
            }
            
            try run(sourcery, withConfig: configFilePath, cacheBasePath: context.pluginWorkDirectory.string)
        }
    }
}

// MARK: - XcodeProjectPlugin

#if canImport(XcodeProjectPlugin)
import XcodeProjectPlugin

extension SourceryCommandPlugin: XcodeCommandPlugin {
    func performCommand(context: XcodePluginContext, arguments: [String]) throws {
        for target in context.xcodeProject.targets {
            guard let configFilePath = target
                .inputFiles
                .filter({ $0.path.lastComponent == ".sourcery.yml" })
                .first?
                .path
                .string else {
                Diagnostics.warning("⚠️ Could not find `.sourcery.yml` in Xcode's input file list")
                return
            }
            let sourcery = try context.tool(named: "SourceryExecutable").path.string
            
            try run(sourcery, withConfig: configFilePath, cacheBasePath: context.pluginWorkDirectory.string)
        }
    }
}
#endif

extension String: LocalizedError {
    public var errorDescription: String? { return self }
}


================================================
FILE: README.md
================================================
[![macOS 13](https://github.com/krzysztofzablocki/Sourcery/actions/workflows/test_macOS.yml/badge.svg)](https://github.com/krzysztofzablocki/Sourcery/actions/workflows/test_macOS.yml)
[![ubuntu x86_64](https://github.com/krzysztofzablocki/Sourcery/actions/workflows/test_ubuntu.yml/badge.svg?branch=master)](https://github.com/krzysztofzablocki/Sourcery/actions/workflows/test_ubuntu.yml)
<!-- [![codecov](https://codecov.io/gh/krzysztofzablocki/Sourcery/branch/master/graph/badge.svg)](https://codecov.io/gh/krzysztofzablocki/Sourcery) -->
[![docs](https://krzysztofzablocki.github.io/Sourcery/badge.svg)](https://krzysztofzablocki.github.io/Sourcery/index.html)
[![Version](https://img.shields.io/cocoapods/v/Sourcery.svg?style=flat)](http://cocoapods.org/pods/Sourcery)
[![License](https://img.shields.io/cocoapods/l/Sourcery.svg?style=flat)](http://cocoapods.org/pods/Sourcery)
[![Platform](https://img.shields.io/cocoapods/p/Sourcery.svg?style=flat)](http://cocoapods.org/pods/Sourcery)

[**In-Depth Sourcery guide is covered as part of my SwiftyStack engineering course.**](https://www.swiftystack.com/)

**Sourcery Pro provides a powerful Stencil editor and extends Xcode with the ability to handle live AST templates: [available on Mac App Store](https://apps.apple.com/us/app/sourcery-pro/id1561780836?mt=12)**

https://user-images.githubusercontent.com/1468993/114271090-f6c19200-9a0f-11eb-9bd8-d7bb15129eb2.mp4

[Learn more about Sourcery Pro](http://merowing.info/sourcery-pro/)

<img src="Resources/icon-128.png">

**Sourcery** is a code generator for Swift language, built on top of Apple's own SwiftSyntax. It extends the language abstractions to allow you to generate boilerplate code automatically.

It's used in over 40,000 projects on both iOS and macOS and it powers some of the most popular and critically-acclaimed apps you have used (including Airbnb, Bumble, New York Times). Its massive community adoption was one of the factors that pushed Apple to implement derived Equality and automatic Codable conformance. Sourcery is maintained by a growing community of [contributors](https://github.com/krzysztofzablocki/Sourcery/graphs/contributors).

Try **Sourcery** for your next project or add it to an existing one -- you'll save a lot of time and be happy you did!

## TL;DR
Sourcery allows you to get rid of repetitive code and create better architecture and developer workflows. 
An example might be implementing `Mocks` for all your protocols, without Sourcery you will need to write **hundreds lines of code per each protocol** like this:

```swift
class MyProtocolMock: MyProtocol {

    //MARK: - sayHelloWith
    var sayHelloWithNameCallsCount = 0
    var sayHelloWithNameCalled: Bool {
        return sayHelloWithNameCallsCount > 0
    }
    var sayHelloWithNameReceivedName: String?
    var sayHelloWithNameReceivedInvocations: [String] = []
    var sayHelloWithNameClosure: ((String) -> Void)?

    func sayHelloWith(name: String) {
        sayHelloWithNameCallsCount += 1
        sayHelloWithNameReceivedName = name
        sayHelloWithNameReceivedInvocations.append(name)
        sayHelloWithNameClosure?(name)
    }

}
```

and with Sourcery ?

```swift
extension MyProtocol: AutoMockable {}
```

Sourcery removes the need to write any of the mocks code, how many protocols do you have in your project? Imagine how much time you'll save, using Sourcery will also make every single mock consistent and if you refactor or add properties, the mock code will be automatically updated for you, eliminating possible human errors. 

Sourcery can be applied to arbitrary problems across your codebase, if you can describe an algorithm to another human, you can automate it using Sourcery.

Most common uses are:

- [Equality](https://krzysztofzablocki.github.io/Sourcery/equatable.html) & [Hashing](https://krzysztofzablocki.github.io/Sourcery/hashable.html)
- [Enum cases & Counts](https://krzysztofzablocki.github.io/Sourcery/enum-cases.html)
- [Lenses](https://krzysztofzablocki.github.io/Sourcery/lenses.html)
- [Mocks & Stubs](https://krzysztofzablocki.github.io/Sourcery/mocks.html)
- [LinuxMain](https://krzysztofzablocki.github.io/Sourcery/linuxmain.html)
- [Decorators](https://krzysztofzablocki.github.io/Sourcery/decorator.html)
- [Persistence and advanced Codable](https://krzysztofzablocki.github.io/Sourcery/codable.html)
- [Property level diffing](https://krzysztofzablocki.github.io/Sourcery/diffable.html)

But how about more specific use-cases, like automatically generating all the UI for your app `BetaSetting`? [you can use Sourcery for that too](https://github.com/krzysztofzablocki/AutomaticSettings)

Once you start writing your own template and learn the power of Sourcery you won't be able to live without it.

## How To Get Started
There are plenty of tutorials for different uses of Sourcery, and you can always ask for help in our [Swift Forum Category](https://forums.swift.org/c/related-projects/sourcery).

- [The Magic of Sourcery](https://www.caseyliss.com/2017/3/31/the-magic-of-sourcery) is a great starting tutorial
- [Generating Swift Code for iOS](https://www.raywenderlich.com/158803/sourcery-tutorial-generating-swift-code-ios) deals with JSON handling code
- [How To Automate Swift Boilerplate with Sourcery](https://atomicrobot.io/blog/sourcery/) generates conversions to dictionaries
- [Codable Enums](https://littlebitesofcocoa.com/318-codable-enums) implements Codable support for Enumerations
- [Sourcery Workshops](https://github.com/krzysztofzablocki/SourceryWorkshops)

### Quick Mocking Intro & Getting Started Video

You can also watch this quick getting started and intro to mocking video by Inside iOS Dev: 
<br />

[![Watch the video](Resources/Inside-iOS-Dev-Sourcery-Intro-To-Mocking-Video-Thumbnail.png)](https://youtu.be/-ZbBNuttlt4?t=214)

## Installation

- _Binary form_

    Download the latest release with the prebuilt binary from [release tab](https://github.com/krzysztofzablocki/Sourcery/releases/latest). Unzip the archive into the desired destination and run `bin/sourcery`
    
- _[Homebrew](https://brew.sh)_

	`brew install sourcery`

- _[CocoaPods](https://cocoapods.org)_

    Add `pod 'Sourcery'` to your `Podfile` and run `pod update Sourcery`. This will download the latest release binary and will put it in your project's CocoaPods path so you will run it with `$PODS_ROOT/Sourcery/bin/sourcery`

    If you only want to install the `sourcery` binary, you may want to use the `CLI-Only` subspec: `pod 'Sourcery', :subspecs => ['CLI-Only']`.

- _[Mint](https://github.com/yonaskolb/Mint)_

    `mint run krzysztofzablocki/Sourcery`

- _Building from Source_

    Download the latest release source code from [the release tab](https://github.com/krzysztofzablocki/Sourcery/releases/latest) or clone the repository and build Sourcery manually.

    - _Building with Swift Package Manager_

        Run `swift build -c release` in the root folder and then copy `.build/release/sourcery` to your desired destination.

        > Note: JS templates are not supported when building with SPM yet.

    - _Building with Xcode_

        Run `xcodebuild -scheme sourcery -destination generic/platform=macOS -archivePath sourcery.xcarchive archive` and export the binary from the archive.

- _SPM (for plugin use only)_
Add the package dependency to your `Package.swift` manifest from version `1.8.3`.

```
.package(url: "https://github.com/krzysztofzablocki/Sourcery.git", from: "1.8.3")
```

- _[pre-commit](https://pre-commit.com/)_
Add the dependency to `.pre-commit-config.yaml`.

```
- repo: https://github.com/krzysztofzablocki/Sourcery
  rev: 1.9.1
  hooks:
  - id: sourcery
```

## Documentation

Full documentation for the latest release is available [here](https://krzysztofzablocki.github.io/Sourcery/).

## Linux Support

Linux support is [described on this page](LINUX.md).

## Usage

### Running the executable

Sourcery is a command line tool; you can either run it manually or in a custom build phase using the following command:

```
$ ./bin/sourcery --sources <sources path> --templates <templates path> --output <output path>
```

> Note: this command differs depending on how you installed Sourcery (see [Installation](#installation))

### Swift Package command

Sourcery can now be used as a Swift package command plugin. In order to do this, the package must be added as a dependency to your Swift package or Xcode project (see [Installation](#installation) above).

To provide a configuration for the plugin to use, place a `.sourcery.yml` file at the root of the target's directory (in the sources folder rather than the root of the package).

#### Running from the command line

To verify the plugin can be found by SwiftPM, use:

```
$ swift package plugin --list
```

To run the code generator, you need to allow changes to the project with the `--allow-writing-to-package-directory` flag:

```
$ swift package --allow-writing-to-package-directory sourcery-command
```

#### Running in Xcode

Inside a project/package that uses this command plugin, right-click the project and select "SourceryCommand" from the "SourceryPlugins" menu group.

> ⚠️ Note that this is only available from Xcode 14 onwards.

### Command line options

- `--sources` - Path to a source swift files or directories. You can provide multiple paths using multiple `--sources` option.
- `--templates` - Path to templates. File or Directory. You can provide multiple paths using multiple `--templates` options.
- `--force-parse` - File extensions of Sourcery generated file you want to parse. You can provide multiple extension using multiple `--force-parse` options. (i.e. `file.toparse.swift` will be parsed even if generated by Sourcery if `--force-parse toparse`). Useful when trying to implement a multiple phases generation. `--force-parse` can also be used to process within a sourcery annotation. For example to process code within `sourcery:inline:auto:Type.AutoCodable` annotation you can use `--force-parse AutoCodable`
- `--output` [default: current path] - Path to output. File or Directory.
- `--config` [default: current path] - Path to config file. File or Directory. See [Configuration file](#configuration-file).
- `--args` - Additional arguments to pass to templates. Each argument can have an explicit value or will have implicit `true` value. Arguments should be separated with `,` without spaces (i.e. `--args arg1=value,arg2`). Arguments are accessible in templates via `argument.name`
- `--watch` [default: false] - Watch both code and template folders for changes and regenerate automatically.
- `--verbose` [default: false] - Turn on verbose logging
- `--quiet` [default: false] - Turn off any logging, only emit errors
- `--disableCache` [default: false] - Turn off caching of parsed data
- `--prune` [default: false] - Prune empty generated files
- `--version` - Display the current version of Sourcery
- `--help` - Display help information
- `--cacheBasePath` - Base path to the cache directory. Can be overriden by the config file.
- `--buildPath` - Path to directory used when building from .swifttemplate files. This defaults to system temp directory
- `--hideVersionHeader` [default: false] - Stop adding the Sourcery version to the generated files headers.
- `--headerPrefix` - Additional prefix for headers.

### Configuration file

Instead of CLI arguments, you can use a `.sourcery.yml` configuration file:

```yaml
sources:
  - <sources path>
  - <sources path>
templates:
  - <templates path>
  - <templates path>
forceParse:
  - <string value>
  - <string value>
output:
  <output path>
args:
  <name>: <value>
```

Read more about this configuration file [here](https://krzysztofzablocki.github.io/Sourcery/usage.html#configuration-file).

## Issues
If you get an unverified developer warning when using binary zip distribution try:
`xattr -dr com.apple.quarantine Sourcery-1.1.1`

## Contributing

Contributions to Sourcery are welcomed and encouraged!

It is easy to get involved. Please see the [Contributing guide](CONTRIBUTING.md) for more details.

[A list of contributors is available through GitHub](https://github.com/krzysztofzablocki/Sourcery/graphs/contributors).

To clarify what is expected of our community, Sourcery has adopted the code of conduct defined by the Contributor Covenant. This document is used across many open source communities, and articulates my values well. For more, see the [Code of Conduct](CODE_OF_CONDUCT.md).

## Sponsoring

If you'd like to support Sourcery development you can do so through [GitHub Sponsors](https://github.com/sponsors/krzysztofzablocki) or [Open Collective](https://opencollective.com/sourcery), it's highly appreciated 🙇‍

If you are a company and would like to sponsor the project directly and get it's logo here, you can [contact me directly](mailto:krzysztof.zablocki@pixle.pl?subject=[Sourcery-Sponsorship])

### Sponsors 

[<img alt="Bumble Inc" width="256px" src="https://github.com/krzysztofzablocki/Sourcery/assets/1468993/159e0943-c890-42b7-9de7-9de9e70dd720" />](https://team.bumble.com/teams/engineering)

[<img alt="Airbnb Engineering" width="128px" src="https://github.com/krzysztofzablocki/Sourcery/assets/1468993/b1c06e1c-06da-4a77-a4f1-7dabd02bbaba" />](https://airbnb.io/)

## License

Sourcery is available under the MIT license. See [LICENSE](LICENSE) for more information.

## Attributions

This tool is powered by

- [Stencil](https://github.com/kylef/Stencil) and few other libs by [Kyle Fuller](https://github.com/kylef)

Thank you! to:

- [Mariusz Ostrowski](http://twitter.com/faktory) for creating the logo.
- [Artsy Eidolon](https://github.com/artsy/eidolon) team, because we use their codebase as a stub data for performance testing the parser.
- [Olivier Halligon](https://github.com/AliSoftware) for showing me his setup scripts for CLI tools which are powering our rakefile.
- [JP Simard](https://github.com/jpsim) for creating [SourceKitten](https://github.com/jpsim/SourceKitten) that originally powered Sourcery and was instrumental in making this project happen. 

## Other Libraries / Tools

If you want to generate code for asset related data like .xib, .storyboards etc. use [SwiftGen](https://github.com/AliSoftware/SwiftGen). SwiftGen and Sourcery are complementary tools.

Make sure to check my other libraries and tools, especially:
- [KZPlayground](https://github.com/krzysztofzablocki/KZPlayground) - Powerful playgrounds for Swift and Objective-C
- [KZFileWatchers](https://github.com/krzysztofzablocki/KZFileWatchers) - Daemon for observing local and remote file changes, used for building other developer tools (Sourcery uses it)

You can [follow me on Twitter][1] for news/updates about other projects I am creating.

 [1]: http://twitter.com/merowing_


================================================
FILE: RELEASING.md
================================================
# Releasing Sourcery

## Note

See https://github.com/krzysztofzablocki/Sourcery/issues/1247#issuecomment-1892571851 for the exact, step by step guide how to release a new version.

# Releasing Sourcery (Deprecated)

There're no hard rules about when to release Sourcery. Release bug fixes frequently, features not so frequently and breaking API changes rarely.

Following the [Semantic Versioning](http://semver.org/):
*  Increment the third number if the release has bug fixes and/or very minor features with backward compatibility, only (eg. change `0.6.0` to `0.6.1`).
*  Increment the second number if the release contains major features or breaking API changes (eg. change `0.6.1` to `0.7.0`).

Make sure you've been added as owner for [CocoaPods Trunk](https://guides.cocoapods.org/making/getting-setup-with-trunk.html) and have push access to the [Sourcery](https://github.com/krzysztofzablocki/Sourcery) repository.

To create automatic GitHub releases, set up [API Token](https://github.com/settings/tokens/new). We recommend giving the token the smallest scope possible. This means just `public_repo`. After getting the token add the following ENV variables:

```
export SOURCERY_GITHUB_USERNAME=YOUR_GITHUB_USERNAME
export SOURCERY_GITHUB_API_TOKEN=YOUR_TOKEN
```

To be able to release a [Homebrew](https://github.com/Homebrew/homebrew-core) formula update, install [brew](https://brew.sh/).

### Release

Example is for releasing `0.6.1` version of the Sourcery.

To release a new version of the Sourcery please rake task and follow the commands.
```
rake release:new
```

It will perform the following steps:
1. Install Bundler and CocoaPods dependencies;
2. Check if the docs are up-to-date or not;
3. Check if the master branch is green on [CI](https://circleci.com/gh/krzysztofzablocki/Sourcery);
4. Update internal boilerplate code;
5. Run tests;
6. Ask for the new release version and updates metadata for it;
7. Create a new release on [GitHub](https://github.com/krzysztofzablocki/Sourcery/releases);
8. Push new release to [CocoaPods Trunk](https://guides.cocoapods.org/making/getting-setup-with-trunk.html);
9. Push new formula to [Homebrew](https://github.com/Homebrew/homebrew-core), this will ask you for manual input of your username and password to open a GitHub PR;
10. Prepare a new development iteration.

Some tasks require manual approvement or input, please pay attention to the automatic changes before confirming them.


================================================
FILE: Rakefile
================================================
#!/usr/bin/rake
## Most of this code is adapted from Sourcery https://github.com/AliSoftware/Sourcery/blob/master/Rakefile

require 'pathname'
require 'yaml'
require 'json'
require 'net/http'
require 'uri'
require 'rbconfig'

BUILD_DIR = 'build/'
CLI_DIR = 'cli/'
VERSION_FILE = 'SourceryUtils/Sources/Version.swift'

## [ Utils ] ##################################################################
def version_select
  latest_xcode_version = `xcode-select -p`.chomp
  %Q(DEVELOPER_DIR="#{latest_xcode_version}" TOOLCHAINS=com.apple.dt.toolchain.XcodeDefault.xctoolchain)
end

def xcpretty(cmd)
  if `which xcpretty` && $?.success?
    sh "set -o pipefail && #{cmd} | xcpretty -c"
  else
    sh cmd
  end
end

def print_info(str)
  (red,clr) = (`tput colors`.chomp.to_i >= 8) ? %W(\e[33m \e[m) : ["", ""]
  puts red, "== #{str.chomp} ==", clr
end

## [ Bundler ] ####################################################

desc "Install dependencies"
task :install_dependencies do
  sh %Q(bundle install)
end

## [ Tests & Clean ] ##########################################################

desc "Run the Unit Tests on all projects"
task :tests do
  print_info "Running Unit Tests"
  sh %Q(swift test)
end

desc "Delete the build/ directory"
task :clean do
  print_info "Cleaning build folder"
  sh %Q(rm -fr build)
end

def build_framework(fat_library)
  print_info "Building project (fat: #{fat_library})"

  # Prepare the export directory
  sh %Q(rm -fr #{CLI_DIR})
  sh %Q(mkdir -p "#{CLI_DIR}bin")
  output_path="#{CLI_DIR}bin/sourcery"

  if fat_library
    sh %Q(swift build --disable-sandbox -c release --arch arm64 --build-path #{BUILD_DIR})
    sh %Q(swift build --disable-sandbox -c release --arch x86_64 --build-path #{BUILD_DIR})
    sh %Q(lipo -create -output #{output_path} #{BUILD_DIR}arm64-apple-macosx/release/sourcery #{BUILD_DIR}x86_64-apple-macosx/release/sourcery)
    sh %Q(strip -rSTX #{output_path})
  else
    sh %Q(swift build --disable-sandbox -c release --build-path #{BUILD_DIR})
    sh %Q(cp #{BUILD_DIR}release/sourcery #{output_path})
  end

  # Export the build products and clean up
  sh %Q(cp SourceryJS/Resources/ejs.js #{CLI_DIR}bin)
  sh %Q(rm -fr #{BUILD_DIR})
end

task :build do
  build_framework(false)
end

task :fat_build do
  build_framework(true)
end

## [ Code Generated ] ################################################

task :run_sourcery do
  print_info "Generating internal boilerplate code"
  sh "#{CLI_DIR}bin/sourcery --config .sourcery-macOS.yml"
  sh "#{CLI_DIR}bin/sourcery --config .sourcery-ubuntu.yml"
end

desc "Update internal boilerplate code"
task :generate_internal_boilerplate_code => [:build, :run_sourcery] do
  sh "Scripts/package_content \"SourceryRuntime/Sources/Common,SourceryRuntime/Sources/macOS,SourceryRuntime/Sources/Generated\" \"true\" > \"SourcerySwift/Sources/SourceryRuntime.content.generated.swift\""
  sh "Scripts/package_content \"SourceryRuntime/Sources/Common,SourceryRuntime/Sources/Linux,SourceryRuntime/Sources/Generated\" \"false\" > \"SourcerySwift/Sources/SourceryRuntime_Linux.content.generated.swift\""
  generated_files = `git status --porcelain`
                      .split("\n")
                      .select { |item| item.include?('.generated.') }
                      .map { |item| item.split.last }
  manual_commit(generated_files, "update internal boilerplate code.")
end

## [ Docs ] ##########################################################
def clean_jazzy
  # jazzy divs are broken, so we need to fix them
  sh "find docs -type f -name '*.html' -print0 | xargs -0 -I % sh -c \"tac '%' | sed '2d' | tac > tmp && mv tmp '%';\""
end

desc "Update docs"
task :docs do
  print_info "Updating docs"
  temp_build_dir = "#{BUILD_DIR}tmp/"
  # tac Enum.html | sed '2d' | tac > Enum.html
  sh "bundle exec sourcekitten doc --spm --module-name SourceryRuntime > docs.json && bundle exec jazzy --clean --skip-undocumented && rm docs.json"
  clean_jazzy
  sh "rm -fr #{temp_build_dir}"
end

desc "Validate docs"
task :validate_docs do
  print_info "Checking docs are up to date"
  temp_build_dir = "#{BUILD_DIR}tmp/"
  ## TODO: RA this step is disabled due to error comming only on CI and only sometimes locally:
  ## [1/1] Compiling plugin SourceryCommandPlugin
  ## Building for debugging...
  ## error: command /Users/art-divin/Documents/Projects/Sourcery/.build/arm64-apple-macosx/debug/Sourcery_SourceryJS.bundle/ejs.js not registered
  ## [1/12] Copying ejs.js
  ## [1/12] Compiling scanner.c
  ## ...
  #sh "bundle exec sourcekitten doc --spm --module-name SourceryRuntime -- --very-verbose > docs.json && bundle exec jazzy --skip-undocumented && rm docs.json"
  ## clean_jazzy
  sh "rm -fr #{temp_build_dir}"
end

## [ Release ] ##########################################################

namespace :release do

  desc 'Perform pre-release tasks'
  task :prepare => [:clean, :install_dependencies, :check_environment_variables, :check_docs, :update_metadata, :generate_internal_boilerplate_code, :tests]

  desc 'Build the current version and release it to GitHub, CocoaPods'
  task :build_and_deploy => [:check_versions, :fat_build, :tag_release, :push_to_origin, :github, :cocoapods]

  desc 'Create a new release on GitHub, CocoaPods'
  task :new => [:prepare, :build_and_deploy]

  def podspec_update_version(version, file = 'Sourcery.podspec')
    # The code is mainly taken from https://github.com/fastlane/fastlane/blob/master/fastlane/lib/fastlane/helper/podspec_helper.rb
    podspec_content = File.read(file)
    version_var_name = 'version'
    version_regex = /^(?<begin>[^#]*version\s*=\s*['"])(?<value>(?<major>[0-9]+)(\.(?<minor>[0-9]+))?(\.(?<patch>[0-9]+))?)(?<end>['"])/i
    version_match = version_regex.match(podspec_content)
    updated_podspec_content = podspec_content.gsub(version_regex, "#{version_match[:begin]}#{version}#{version_match[:end]}")
    File.open(file, "w") { |f| f.puts updated_podspec_content }
  end

  def podspec_version(file = 'Sourcery')
    JSON.parse(`bundle exec pod ipc spec #{file}.podspec`)["version"]
  end

  VERSION_REGEX = /(?<begin>public static let current\s*=\s*SourceryVersion\(value:\s*.*")(?<value>(?<major>[0-9]+)(\.(?<minor>[0-9]+))?(\.(?<patch>[0-9]+))?)(?<end>"\))/i.freeze

  def command_line_tool_update_version(version, file = VERSION_FILE)
    version_content = File.read(file)
    version_match = VERSION_REGEX.match(version_content)
    updated_version_content = version_content.gsub(VERSION_REGEX, "#{version_match[:begin]}#{version}#{version_match[:end]}")
    File.open(file, "w") { |f| f.puts updated_version_content }
  end

  def command_line_tool_version(file = VERSION_FILE)
    version_content = File.read(file)
    version_match = VERSION_REGEX.match(version_content)
    version_match[:value]
  end

  def log_result(result, label, error_msg)
    if result
      puts "#{label.ljust(25)} \u{2705}"
    else
      puts "#{label.ljust(25)} \u{274C}  - #{error_msg}"
    end
    result
  end

  def get(url, content_type = 'application/json')
    uri = URI.parse(url)
    req = Net::HTTP::Get.new(uri, initheader = {'Content-Type' => content_type})
    yield req if block_given?

    response = Net::HTTP.start(uri.host, uri.port, :use_ssl => (uri.scheme == 'https')) do |http|
      http.request(req)
    end
    unless response.code == '200'
      puts "Error: #{response.code} - #{response.message}"
      puts response.body
      exit 3
    end
    JSON.parse(response.body)
  end

  def post(url, content_type = 'application/json')
    uri = URI.parse(url)
    req = Net::HTTP::Post.new(uri, initheader = {'Content-Type' => content_type})
    yield req if block_given?

    response = Net::HTTP.start(uri.host, uri.port, :use_ssl => (uri.scheme == 'https')) do |http|
      http.request(req)
    end
    unless response.code == '201' || response.code == '202'
      puts "Error: #{response.code} - #{response.message}"
      puts response.body
      exit 3
    end
    JSON.parse(response.body)
  end

  def manual_commit(files, message)
    print_info "Preparing commit"
    system(%Q{git --no-pager diff #{files.join(" ")}})
    print "Now review the above diff. Do you wish to commit the changes? [Y/n] "
    commit_changes = STDIN.gets.chomp == 'Y'
    if commit_changes then
      system(%Q{git add #{files.join(" ")}})
      system(%Q{git commit -m '#{message}'})
    else
      puts "Aborting commit, checkout pending changes"
      system(%Q{git checkout #{files.join(" ")}})
      exit 2
    end
  end

  def git_tag(tag)
    system(%Q{git tag #{tag}})
  end

  def git_push(remote = 'origin', branch = 'master')
    system(%Q{git push #{remote} #{branch} --tags})
  end

  def sourcery_targz_url(version)
    "https://github.com/krzysztofzablocki/Sourcery/archive/#{version}.tar.gz"
  end

  def extract_sha256(archive_url)
    sha256_res = `curl -L #{archive_url} | shasum -a 256`
    sha256 = /^[A-Fa-f0-9]+/.match(sha256_res)
    if sha256.nil? then
      print "Unable to extract SHA256"
      exit 3
    end
    sha256
  end

  desc 'Check ENV variables required for release'
  task :check_environment_variables do
    print_info "Checking ENV variables"
    results = []

    results << log_result(!ENV['SOURCERY_GITHUB_USERNAME'].nil?, "SOURCERY_GITHUB_USERNAME is set up", "Please add SOURCERY_GITHUB_USERNAME environment variable")
    results << log_result(!ENV['SOURCERY_GITHUB_API_TOKEN'].nil?, "SOURCERY_GITHUB_API_TOKEN is set up", "Please add SOURCERY_GITHUB_API_TOKEN environment variable")

    exit 1 unless results.all?
  end

  desc 'Check if CI is green'
  task :check_ci do
    print_info "Checking Circle CI master branch status"
    results = []

    json = get('https://circleci.com/api/v1.1/project/github/krzysztofzablocki/Sourcery/tree/master')
    master_branch_status = json[0]['status']
    results << log_result(master_branch_status == 'success' || master_branch_status == 'fixed', 'Master branch is green on CI', 'Please check master branch CI status first')
    exit 1 unless results.all?
  end

  desc 'Check if docs are up to date'
  task :check_docs => [:validate_docs] do
    results = []

    docs_not_changed = `git diff --name-only docs` == ""
    results << log_result(docs_not_changed, 'Docs are up to date', 'Please push updated docs first')
    exit 1 unless results.all?
  end

  desc 'Check if all versions from the podspecs, CHANGELOG and build settings match'
  task :check_versions do
    print_info "Checking versions match"
    results = []

    # Check if bundler is installed first, as we'll need it for the cocoapods task (and we prefer to fail early)
    `which bundle`
    results << log_result( $?.success?, 'Bundler installed', 'Please install bundler using `gem install bundler` and run `bundle install` first.')

    # Extract version from Sourcery.podspec
    version = podspec_version
    puts "#{'Sourcery.podspec'.ljust(25)} \u{1F449}  #{version}"

    # Check if entry present in CHANGELOG
    changelog_entry = system(%Q{grep -q '^## #{Regexp.quote(version)}$' CHANGELOG.md})
    results << log_result(changelog_entry, "CHANGELOG, Entry added", "Please add an entry for #{version} in CHANGELOG.md")

    changelog_master = system(%q{grep -qi '^## Master' CHANGELOG.md})
    results << log_result(!changelog_master, "CHANGELOG, No master", 'Please remove entry for master in CHANGELOG')

    # Check if Command Line Tool version match podspec version
    results << log_result(version == command_line_tool_version, "Command line tool version correct", "Please update current version in #{VERSION_FILE} to #{version}")

    exit 1 unless results.all?

    print "Release version #{version} [Y/n]? "
    exit 2 unless (STDIN.gets.chomp == 'Y')
  end

  desc 'Updates metadata for the new release'
  task :update_metadata do
    print "New version of Sourcery in sematic format major.minor.patch? "
    new_version = STDIN.gets.chomp
    unless new_version =~ /^\d+\.\d+\.\d+$/ then
      print "Please set version following the semantic format http://semver.org/\n"
      exit 3
    end

    print_info "Updating metadata for #{new_version} release\n"

    # Replace master with the new release version in CHANGELOG.md
    system(%Q{sed -i '' -e 's/## Master/## #{new_version}/' CHANGELOG.md})

    # Update podspec version
    podspec_update_version(new_version, 'Sourcery.podspec')
    podspec_update_version(new_version, 'SourceryFramework.podspec')
    podspec_update_version(new_version, 'SourceryRuntime.podspec')
    podspec_update_version(new_version, 'SourceryUtils.podspec')

    # Update command line tool version
    command_line_tool_update_version(new_version)

    manual_commit(["CHANGELOG.md", "Sourcery.podspec", "SourceryFramework.podspec", "SourceryRuntime.podspec", "SourceryUtils.podspec", VERSION_FILE], "docs: update metadata for #{new_version} release")
  end

  desc 'Create a tag for the project version and push to remote'
  task :tag_release do
    print_info "Tagging the release"
    git_tag(podspec_version)
  end


  desc 'Create a zip containing all the prebuilt binaries'
  task :zip => [:clean] do
    print_info "Creating zip"

    sh %Q(mkdir -p "build")
    sh %Q(mkdir -p "build/sourcery")
    sh %Q(mkdir -p "build/sourcery/Resources")
    sh %Q(cp -r #{CLI_DIR} build/sourcery/)
    sh %Q(cp -r Templates/Templates build/sourcery/)
    sh %Q(cp -r docs/docsets/Sourcery.docset build/sourcery/)
    `cp LICENSE README.md CHANGELOG.md build/sourcery`
    `cp Resources/daemon.gif Resources/icon-128.png build/sourcery/Resources`
    `cd build/sourcery; zip -r -X ../sourcery-#{podspec_version}.zip .`
  end

  desc 'Create a zip containing all the prebuilt binaries in the artifact bundle format (for SwiftPM Package Plugins)'
  task :artifactbundle => :zip do
    bundle_dir = 'build/sourcery.artifactbundle'
    bin_dir = "#{bundle_dir}/sourcery/bin"

    # Copy the built product to an artifact bundle
    `mkdir -p #{bin_dir}`
    `cp -Rf build/sourcery #{bin_dir}`

    # Write the `info.json` artifact bundle manifest
    info_template = File.read("Templates/artifactbundle.info.json.template")
    info_file_content = info_template.gsub(/(VERSION)/, podspec_version)

    File.open("#{bundle_dir}/info.json", "w") do |f|
      f.write(info_file_content)
    end

    # Zip the bundle
    `cd build; zip -r -X sourcery-#{podspec_version}.artifactbundle.zip sourcery.artifactbundle/`
  end

  def upload_zip(filename)
    upload_url = json['upload_url'].gsub(/\{.*\}/, "?name=#{filename}")
    zipfile = "build/#{filename}"
    zipsize = File.size(zipfile)

    print_info "Uploading ZIP (#{zipsize} bytes)"
    post(upload_url, 'application/zip') do |req|
      req.body_stream = File.open(zipfile, 'rb')
      req.add_field('Content-Length', zipsize)
      req.add_field('Content-Transfer-Encoding', 'binary')
      req.basic_auth ENV['SOURCERY_GITHUB_USERNAME'], ENV['SOURCERY_GITHUB_API_TOKEN'].chomp
    end
  end

  desc 'Upload the zipped binaries to a new GitHub release'
  task :github => :artifactbundle do
    v = podspec_version

    changelog = `sed -n /'^## #{v}$'/,/'^## '/p CHANGELOG.md`.gsub(/^## .*$/,'').strip
    print_info "Releasing version #{v} on GitHub"
    puts changelog

    json = post('https://api.github.com/repos/krzysztofzablocki/Sourcery/releases', 'application/json') do |req|
      req.body = { :tag_name => v, :name => v, :body => changelog, :draft => false, :prerelease => false }.to_json
      req.basic_auth ENV['SOURCERY_GITHUB_USERNAME'], ENV['SOURCERY_GITHUB_API_TOKEN'].chomp
    end

    upload_zip("Sourcery-#{v}.zip")
    upload_zip("Sourcery-#{v}.artifactbundle.zip")
  end

  desc 'pod trunk push Sourcery to CocoaPods'
  task :cocoapods do
    print_info "Pushing pod to CocoaPods Trunk"
    sh 'bundle exec pod trunk push Sourcery.podspec --allow-warnings --verbose --skip-tests'
  end

  desc 'Push the pending master changes to origin'
  task :push_to_origin do
    git_push
  end

  desc 'prepare for the new development iteration'
  task :prepare_next_development_iteration do
    print_info "Preparing for the next development iteration"
    `sed -i '' -e '3 a \\
     ## Master\\
     \\
     \\
     ' CHANGELOG.md`

     manual_commit(["CHANGELOG.md"], "docs: preparing for next development iteration.")
  end
end


================================================
FILE: Scripts/SwiftLint.sh
================================================
#!/bin/zsh

if which swiftlint >/dev/null; then
    swiftlint autocorrect
    swiftlint
else
    echo "warning: SwiftLint not installed. Install using brew update && brew install swiftlint or download from https://github.com/realm/SwiftLint."
fi


================================================
FILE: Scripts/bootstrap
================================================
#!/usr/bin/env bash
# Usage: scripts/bootstrap
# Prepares git and pods integration by providing pre-commit hook and isolated CocoaPods environment via Bundler

set -eu

if [ -h .git/hooks/pre-commit ]; then
    rm .git/hooks/pre-commit
fi

if [ -f .git/hooks/pre-commit ]; then
    echo "A git pre-commit hook already exists. Please remove it and re-run this script."
fi

ln -s ../../scripts/pre-commit.sh .git/hooks/pre-commit

bundle install --path Vendor/bundle

bundle exec pod install


================================================
FILE: Scripts/package_content
================================================
#!/usr/bin/env swift
/// Usage: $0 FOLDER
/// Description:
///   Merge all Swift files contained in FOLDER into swift code that can be used by the FolderSynchronizer.
/// Example: $0 Sources/SourceryRuntime > file.swift
/// Options:
///   FOLDERS: the paths where the Swift files to merge are, separated with comma ","
///   isForDarwinPlatform: if true, the generated code will be compilable on Darwin platforms
///   -h: Display this help message
import Foundation

func printUsage() {
    guard let scriptPath = CommandLine.arguments.first else {
        fatalError("Could not find script path in arguments (\(CommandLine.arguments))")
    }
    guard let lines = (try? String(contentsOfFile: scriptPath, encoding: .utf8))?
            .components(separatedBy: .newlines) else {
        fatalError("Could not read the script at path \(scriptPath)")
    }
    let documentationPrefix = "/// "
    lines
      .filter { $0.hasPrefix(documentationPrefix) }
      .map { $0.dropFirst(documentationPrefix.count) }
      .map { $0.replacingOccurrences(of: "$0", with: scriptPath) }
      .forEach { print("\($0)") }
}

extension String {
    func escapedSwiftTokens() -> String {
        // return self
        let replacements = [
          "\\(": "\\\\(",
          "\\\"": "\\\\\"",
          "\\n": "\\\\n",
        ]
        var escapedString = self
        replacements.forEach {
            escapedString = escapedString.replacingOccurrences(of: $0, with: $1)
        }
        return escapedString
    }
}

func package(folders folderPaths: [String], isForDarwinPlatform: Bool) throws {
    if !isForDarwinPlatform {
        print("#if !canImport(ObjectiveC)")
    } else {
        print("#if canImport(ObjectiveC)")
    }
    print("let sourceryRuntimeFiles: [FolderSynchronizer.File] = [")
    for folderPath in folderPaths {
        let folderURL = URL(fileURLWithPath: folderPath)

        guard let enumerator = FileManager.default.enumerator(at: folderURL, includingPropertiesForKeys: [.isRegularFileKey], options: [.skipsHiddenFiles, .skipsPackageDescendants]) else {
            print("Unable to retrieve file enumerator")
            exit(1)
        }
        var files = [URL]()
        for case let fileURL as URL in enumerator {
            do {
                let fileAttributes = try fileURL.resourceValues(forKeys:[.isRegularFileKey])
                if fileAttributes.isRegularFile! {
                    files.append(fileURL)
                }
            } catch { 
                print(error, fileURL) 
            }
        }
        
        try files
        .sorted(by: { $0.lastPathComponent < $1.lastPathComponent })
        .forEach { sourceFileURL in
            print("    .init(name: \"\(sourceFileURL.lastPathComponent)\", content:")
            print("\"\"\"")
            let content = try String(contentsOf: sourceFileURL, encoding: .utf8)
                .escapedSwiftTokens()
            print(content)
            print("\"\"\"),")
        }
    }
    print("]")
    print("#endif")
}

func main() {
    if CommandLine.arguments.contains("-h") {
        printUsage()
        exit(0)
    }
    guard CommandLine.arguments.count > 1 else {
        print("Missing folderPath argument")
        exit(1)
    }
    guard CommandLine.arguments.count > 2 else {
        print("Missing isForDarwinPlatform argument")
        exit(1)
    }
    let foldersPaths = CommandLine.arguments[1]
    let isForDarwinPlatform = Bool(CommandLine.arguments[2]) ?? false
    let folders = foldersPaths.split(separator: ",").map(String.init)

    do {
        try package(folders: folders, isForDarwinPlatform: isForDarwinPlatform)
    } catch {
        print("Failed with error: \(error)")
        exit(1)
    }
}

main()


================================================
FILE: Scripts/pre-commit.sh
================================================
#!/usr/bin/env bash
set -eu

failed=0

test_pattern='\b(fdescribe|fit|fcontext|xdescribe|xit|xcontext)\b'
if git diff-index -p -M --cached HEAD -- '*Tests.swift' '*Specs.swift' | grep '^+' | egrep "$test_pattern" >/dev/null 2>&1
then
  echo "COMMIT REJECTED for fdescribe/fit/fcontext/xdescribe/xit/xcontext." >&2
  echo "Remove focused and disabled tests before committing." >&2
  echo '----' >&2
  git grep --cached -E "$test_pattern" '*Tests.swift' '*Specs.swift'  >&2
  echo '----' >&2
  failed=1
fi

misplaced_pattern='misplaced="YES"'

if git diff-index -p -M --cached HEAD -- '*.xib' '*.storyboard' | grep '^+' | egrep "$misplaced_pattern" >/dev/null 2>&1
then
  echo "COMMIT REJECTED for misplaced views. Correct them before committing." >&2
  echo '----' >&2
  git grep --cached -E "$misplaced_pattern" '*.xib' '*.storyboard' >&2
  echo '----' >&2
  failed=1
fi

exit $failed


================================================
FILE: Scripts/update-placeholders
================================================
#!/usr/bin/swift
//
//  main.swift
//  UpdateAutogenerated
//
//  Created by Krunoslav Zaher on 1/6/17.
//  Copyright © 2017 Krunoslav Zaher. All rights reserved.
//

import Foundation

if CommandLine.argc < 2 {
    print("find Sourcery -name \"*.swift\" | xargs ./Scripts/update-placeholders ./Sourcery/CodeGenerated/Coding.Generated.swift")
    exit(-1)
}

let finalVersions = CommandLine.arguments[1]
let targetFiles = CommandLine.arguments.dropFirst(2)

func escape(_ text: String) -> String {
    return NSRegularExpression.escapedPattern(for: text)
}

extension NSString {
    var entireRange: NSRange {
        return NSRange(location: 0, length: self.length)
    }
}

func placeholderRegex(name: String) -> NSRegularExpression {
    let startPattern = "\(escape("//"))\\s+(\(name))\\s+\(escape("{"))"
    let endPattern = "\(escape("//"))\\s+\(escape("}"))\\s+(\(name))"
    let ignoreMiddle = "(?:(?!\(endPattern)).)*"
    return try! NSRegularExpression(pattern:
        startPattern +
        ignoreMiddle +
        endPattern, options: [.allowCommentsAndWhitespace, .dotMatchesLineSeparators])
}

func placeholderNames(content: String) -> [String] {
    let regex = placeholderRegex(name: "\\S+")

    // if this cast doesn't exist, it will crash, Swift :(
    let nsContent = content as NSString
    return regex.matches(in: nsContent as String,
                         options: [],
                         range: nsContent.entireRange).map { match in
                            return (content as NSString).substring(with: match.rangeAt(1))
    }
}

extension String {
    func getPlaceholderValue(name: String) -> String? {
        let regex = placeholderRegex(name: escape(name))

        let range = regex.matches(in: self, options: [], range: self.entireRange).first!
        return (self as NSString).substring(with: range.rangeAt(0))
    }

    func setPlaceholder(name: String, value: String) -> String {
        let regex = placeholderRegex(name: escape(name))
        let first = regex.matches(in: self, options: [], range: self.entireRange).first!
        return (self as NSString).replacingCharacters(in: first.rangeAt(0), with: value)
    }
}

let content = try! String(contentsOfFile: finalVersions)

var placeholders: [String: String] = [:]
for name in placeholderNames(content: content) {
    placeholders[name] = content.getPlaceholderValue(name: name)
}

var replacedPlaceholders = Set<String>()
for filePath in targetFiles {
    let targetFile = try! String(contentsOfFile: filePath)

    if targetFile.hasPrefix("// Generated using Sourcery") {
        continue
    }

    let finalFile = placeholderNames(content: targetFile).reduce(targetFile){ (content, name) -> String in
        replacedPlaceholders.insert(name)
        guard let value = placeholders[name] else {
            fatalError("\(filePath): \(name) placeholder not found")
        }
        return content.setPlaceholder(name: name, value: value)
    }

    try! finalFile.write(toFile: filePath, atomically: true, encoding: .utf8)
}

let notReplaced = Set(placeholders.keys).subtracting(replacedPlaceholders)

if !notReplaced.isEmpty {
    print("We've not been able to find files to update \(notReplaced)")
    exit(-1)
}


================================================
FILE: Sourcery/Configuration.swift
================================================
import Foundation
import XcodeProj
import PathKit
import Yams
import SourceryRuntime
import Basics
import TSCBasic
import Workspace
import PackageModel
import SourceryFramework
import SourceryUtils

public struct Project {
    public let file: XcodeProj
    public let root: Path
    public let targets: [Target]
    public let exclude: [Path]

    public struct Target {

        public struct XCFramework {

            public let path: Path
            public let swiftInterfacePath: Path
            public let module: String

            public init(rawPath: String, relativePath: Path) throws {
                let frameworkRelativePath = Path(rawPath, relativeTo: relativePath)
                guard let framework = frameworkRelativePath.components.last else {
                    throw Configuration.Error.invalidXCFramework(message: "Framework path invalid. Expected String.")
                }
                let `extension` = Path(framework).`extension`
                guard `extension` == "xcframework" else {
                    throw Configuration.Error.invalidXCFramework(message: "Framework path invalid. Expected path to xcframework file.")
                }
                let moduleName = Path(framework).lastComponentWithoutExtension
                guard
                    let simulatorSlicePath = frameworkRelativePath.glob("*")
                        .first(where: { $0.lastComponent.contains("simulator") })
                else {
                    throw Configuration.Error.invalidXCFramework(path: frameworkRelativePath, message: "Framework path invalid. Expected to find simulator slice.")
                }
                let modulePath = simulatorSlicePath + Path("\(moduleName).framework/Modules/\(moduleName).swiftmodule/")
                guard let interfacePath = modulePath.glob("*.swiftinterface").first(where: { $0.lastComponent.contains("simulator") })
                else {
                    throw Configuration.Error.invalidXCFramework(path: frameworkRelativePath, message: "Framework path invalid. Expected to find .swiftinterface.")
                }
                self.path = frameworkRelativePath
                self.swiftInterfacePath = interfacePath
                self.module = moduleName
            }
        }

        public let name: String
        public let module: String
        public let xcframeworks: [XCFramework]

        public init(dict: [String: Any], relativePath: Path) throws {
            guard let name = dict["name"] as? String else {
                throw Configuration.Error.invalidSources(message: "Target name is not provided. Expected string.")
            }
            self.name = name
            self.module = (dict["module"] as? String) ?? name
            do {
                self.xcframeworks = try (dict["xcframeworks"] as? [String])?
                    .map { try XCFramework(rawPath: $0, relativePath: relativePath) } ?? []
            } catch let error as Configuration.Error {
                Log.warning(error.description)
                self.xcframeworks = []
            }
        }
    }

    public init(dict: [String: Any], relativePath: Path) throws {
        guard let file = dict["file"] as? String else {
            throw Configuration.Error.invalidSources(message: "Project file path is not provided. Expected string.")
        }

        let targetsArray: [Target]
        if let targets = dict["target"] as? [[String: Any]] {
            targetsArray = try targets.map({ try Target(dict: $0, relativePath: relativePath) })
        } else if let target = dict["target"] as? [String: Any] {
            targetsArray = try [Target(dict: target, relativePath: relativePath)]
        } else {
            throw Configuration.Error.invalidSources(message: "'target' key is missing. Expected object or array of objects.")
        }
        guard !targetsArray.isEmpty else {
            throw Configuration.Error.invalidSources(message: "No targets provided.")
        }
        self.targets = targetsArray

        let exclude = (dict["exclude"] as? [String])?.map({ Path($0, relativeTo: relativePath) }) ?? []
        self.exclude = exclude.flatMap { $0.allPaths }

        let path = Path(file, relativeTo: relativePath)
        self.file = try XcodeProj(path: path)
        self.root = path.parent()
    }

}

public struct Paths {
    public let include: [Path]
    public let exclude: [Path]
    public let allPaths: [Path]

    public var isEmpty: Bool {
        return allPaths.isEmpty
    }

    public init(dict: Any, relativePath: Path) throws {
        if let sources = dict as? [String: [String]],
            let include = sources["include"]?.map({ Path($0, relativeTo: relativePath) }) {

            let exclude = sources["exclude"]?.map({ Path($0, relativeTo: relativePath) }) ?? []
            self.init(include: include, exclude: exclude)
        } else if let sources = dict as? [String] {

            let sources = sources.map({ Path($0, relativeTo: relativePath) })
            guard !sources.isEmpty else {
                throw Configuration.Error.invalidPaths(message: "No paths provided.")
            }
            self.init(include: sources)
        } else {
            throw Configuration.Error.invalidPaths(message: "No paths provided. Expected list of strings or object with 'include' and optional 'exclude' keys.")
        }
    }

    public init(include: [Path], exclude: [Path] = []) {
        self.include = include
        self.exclude = exclude

        let include = self.include.parallelFlatMap { $0.processablePaths }
        let exclude = self.exclude.parallelFlatMap { $0.processablePaths }

        self.allPaths = Array(Set(include).subtracting(Set(exclude))).sorted()
    }

}

extension Path {
    public var processablePaths: [Path] {
        if isDirectory {
            return (try? recursiveUnhiddenChildren()) ?? []
        } else {
            return [self]
        }
    }

    public func recursiveUnhiddenChildren() throws -> [Path] {
        FileManager.default.enumerator(at: url, includingPropertiesForKeys: [.pathKey], options: [.skipsHiddenFiles, .skipsPackageDescendants], errorHandler: nil)?.compactMap { object in
            if let url = object as? URL {
                return self + Path(url.path)
            }
            return nil
        } ?? []
    }
}

public struct Package {
    public let root: Path
    public let targets: [Target]

    public struct Target {
        let name: String
        let root: Path
        let excludes: [Path]
    }

    public init(dict: [String: Any], relativePath: Path) throws {
        guard let packageRootPath = dict["path"] as? String else {
            throw Configuration.Error.invalidSources(message: "Package file directory path is not provided. Expected string.")
        }
        let path = Path(packageRootPath, relativeTo: relativePath)
        
        let packagePath = try Basics.AbsolutePath(validating: path.string)
        let observability = ObservabilitySystem { Log.verbose("\($0): \($1)") }
        let workspace = try Workspace(forRootPackage: packagePath)

        var manifestResult: Result<Manifest, Error>?
        let semaphore = DispatchSemaphore(value: 0)
        workspace.loadRootManifest(at: packagePath, observabilityScope: observability.topScope, completion: { result in
            manifestResult = result
            semaphore.signal()
        })
        semaphore.wait()
        
        guard let manifest = try manifestResult?.get() else {
            throw Configuration.Error.invalidSources(message: "Unable to load manifest")
        }
        self.root = path
        let targetNames: [String]
        if let targets = dict["target"] as? [String] {
            targetNames = targets
        } else if let target = dict["target"] as? String {
            targetNames = [target]
        } else {
            throw Configuration.Error.invalidSources(message: "'target' key is missing. Expected object or array of objects.")
        }
        let sourcesPath = Path("Sources", relativeTo: path)
        self.targets = manifest.targets.compactMap({ target in
            guard targetNames.contains(target.name) else {
                return nil
            }
            let rootPath = target.path.map { Path($0, relativeTo: path) } ?? Path(target.name, relativeTo: sourcesPath)
            let excludePaths = target.exclude.map { path in
                Path(path, relativeTo: rootPath)
            }
            return Target(name: target.name, root: rootPath, excludes: excludePaths)
        })
    }
}

public enum Source {
    case projects([Project])
    case sources(Paths)
    case packages([Package])

    public init(dict: [String: Any], relativePath: Path) throws {
        if let projects = (dict["project"] as? [[String: Any]]) ?? (dict["project"] as? [String: Any]).map({ [$0] }) {
            guard !projects.isEmpty else { throw Configuration.Error.invalidSources(message: "No projects provided.") }
            self = try .projects(projects.map({ try Project(dict: $0, relativePath: relativePath) }))
        } else if let sources = dict["sources"] {
            do {
                self = try .sources(Paths(dict: sources, relativePath: relativePath))
            } catch {
                throw Configuration.Error.invalidSources(message: "\(error)")
            }
        } else if let packages = (dict["package"] as? [[String: Any]]) ?? (dict["package"] as? [String: Any]).map({ [$0] }) {
            guard !packages.isEmpty else { throw Configuration.Error.invalidSources(message: "No packages provided.") }
            self = try .packages(packages.map({ try Package(dict: $0, relativePath: relativePath) }))
        } else if dict["child"] != nil {
            throw Configuration.Error.internalError(message: "'child' should have been parsed already.")
        } else {
            throw Configuration.Error.invalidSources(message: "'sources', 'project' or 'package' key are missing.")
        }
    }

    public var isEmpty: Bool {
        switch self {
        case let .sources(paths):
            return paths.allPaths.isEmpty
        case let .projects(projects):
            return projects.isEmpty
        case let .packages(packages):
            return packages.isEmpty
        }
    }
}

public struct Output {
    public struct LinkTo {
        public let project: XcodeProj
        public let projectPath: Path
        public let targets: [String]
        public let group: String?

        public init(dict: [String: Any], relativePath: Path) throws {
            guard let project = dict["project"] as? String else {
                throw Configuration.Error.invalidOutput(message: "No project file path provided.")
            }
            if let target = dict["target"] as? String {
                self.targets = [target]
            } else if let targets = dict["targets"] as? [String] {
                self.targets = targets
            } else {
                throw Configuration.Error.invalidOutput(message: "No target(s) provided.")
            }
            let projectPath = Path(project, relativeTo: relativePath)
            self.projectPath = projectPath
            self.project = try XcodeProj(path: projectPath)
            self.group = dict["group"] as? String
        }
    }

    public let path: Path
    public let linkTo: LinkTo?

    public var isDirectory: Bool {
        guard path.exists else {
            return path.lastComponentWithoutExtension == path.lastComponent || path.string.hasSuffix("/")
        }
        return path.isDirectory
    }

    public init(dict: [String: Any], relativePath: Path) throws {
        guard let path = dict["path"] as? String else {
            throw Configuration.Error.invalidOutput(message: "No path provided.")
        }

        self.path = Path(path, relativeTo: relativePath)

        if let linkToDict = dict["link"] as? [String: Any] {
            do {
                self.linkTo = try LinkTo(dict: linkToDict, relativePath: relativePath)
            } catch {
                self.linkTo = nil
                Log.warning(error)
            }
        } else {
            self.linkTo = nil
        }
    }

    public init(_ path: Path, linkTo: LinkTo? = nil) {
        self.path = path
        self.linkTo = linkTo
    }

}

public struct Configuration {

    public enum Error: Swift.Error, CustomStringConvertible {
        case invalidFormat(message: String)
        case invalidSources(message: String)
        case invalidXCFramework(path: Path? = nil, message: String)
        case invalidTemplates(message: String)
        case invalidOutput(message: String)
        case invalidCacheBasePath(message: String)
        case invalidPaths(message: String)
        case internalError(message: String)

        public var description: String {
            switch self {
            case .invalidFormat(let message):
                return "Invalid config file format. \(message)"
            case .invalidSources(let message):
                return "Invalid sources. \(message)"
            case .invalidXCFramework(let path, let message):
                return "Invalid xcframework\(path.map { " at path '\($0)'" } ?? "")'. \(message)"
            case .invalidTemplates(let message):
                return "Invalid templates. \(message)"
            case .invalidOutput(let message):
                return "Invalid output. \(message)"
            case .invalidCacheBasePath(let message):
                return "Invalid cacheBasePath. \(message)"
            case .invalidPaths(let message):
                return "\(message)"
            case .internalError(let message):
                return "\(message)"
            }
        }
    }

    public let source: Source
    public let templates: Paths
    public let output: Output
    public let cacheBasePath: Path
    public let forceParse: [String]
    public let parseDocumentation: Bool
    public let baseIndentation: Int
    public let args: [String: NSObject]

    public init(
        path: Path,
        relativePath: Path,
        env: [String: String] = [:]
    ) throws {
        guard let dict = try Yams.load(yaml: path.read(), .default, Constructor.sourceryContructor(env: env)) as? [String: Any] else {
            throw Configuration.Error.invalidFormat(message: "Expected dictionary.")
        }

        try self.init(dict: dict, relativePath: relativePath)
    }

    public init(dict: [String: Any], relativePath: Path) throws {
        let source = try Source(dict: dict, relativePath: relativePath)
        guard !source.isEmpty else {
            throw Configuration.Error.invalidSources(message: "No sources provided.")
        }
        self.source = source

        let templates: Paths
        guard let templatesDict = dict["templates"] else {
            throw Configuration.Error.invalidTemplates(message: "'templates' key is missing.")
        }
        do {
            templates = try Paths(dict: templatesDict, relativePath: relativePath)
        } catch {
            throw Configuration.Error.invalidTemplates(message: "\(error)")
        }
        guard !templates.isEmpty else {
            throw Configuration.Error.invalidTemplates(message: "No templates provided.")
        }
        self.templates = templates

        self.forceParse = dict["forceParse"] as? [String] ?? []

        self.parseDocumentation = dict["parseDocumentation"] as? Bool ?? false

        if let output = dict["output"] as? String {
            self.output = Output(Path(output, relativeTo: relativePath))
        } else if let output = dict["output"] as? [String: Any] {
            self.output = try Output(dict: output, relativePath: relativePath)
        } else {
            throw Configuration.Error.invalidOutput(message: "'output' key is missing or is not a string or object.")
        }

        if let cacheBasePath = dict["cacheBasePath"] as? String {
            self.cacheBasePath = Path(cacheBasePath, relativeTo: relativePath)
        } else if dict["cacheBasePath"] != nil {
            throw Configuration.Error.invalidCacheBasePath(message: "'cacheBasePath' key is not a string.")
        } else {
            self.cacheBasePath = Path.defaultBaseCachePath
        }

        self.baseIndentation = dict["baseIndentation"] as? Int ?? 0
        self.args = dict["args"] as? [String: NSObject] ?? [:]
    }

    public init(sources: Paths, templates: Paths, output: Path, cacheBasePath: Path, forceParse: [String], parseDocumentation: Bool, baseIndentation: Int, args: [String: NSObject]) {
        self.source = .sources(sources)
        self.templates = templates
        self.output = Output(output, linkTo: nil)
        self.cacheBasePath = cacheBasePath
        self.forceParse = forceParse
        self.parseDocumentation = parseDocumentation
        self.baseIndentation = baseIndentation
        self.args = args
    }

}

public enum Configurations {
    public static func make(
        path: Path,
        relativePath: Path,
        env: [String: String] = [:]
    ) throws -> [Configuration] {
        guard let dict = try Yams.load(yaml: path.read(), .default, Constructor.sourceryContructor(env: env)) as? [String: Any] else {
            throw Configuration.Error.invalidFormat(message: "Expected dictionary.")
        }

        let start = currentTimestamp()
        defer {
            Log.benchmark("Resolving configurations took \(currentTimestamp() - start)")
        }

        if let configurations = dict["configurations"] as? [[String: Any]] {
            return try configurations.flatMap { dict in
                if let child = dict["child"] as? String {
                    let childPath = Path(child, relativeTo: relativePath)
                    let childRelativePath = Path(components: childPath.components.dropLast())
                    return try Configurations.make(path: childPath, relativePath: childRelativePath, env: env)
                } else {
                    return try [Configuration(dict: dict, relativePath: relativePath)]
                }
            }
        } else {
            return try [Configuration(dict: dict, relativePath: relativePath)]
        }
    }
}

// Copied from https://github.com/realm/SwiftLint/blob/0.29.2/Source/SwiftLintFramework/Models/YamlParser.swift
// and https://github.com/SwiftGen/SwiftGen/blob/6.1.0/Sources/SwiftGenKit/Utils/YAML.swift

private extension Constructor {
    static func sourceryContructor(env: [String: String]) -> Constructor {
        return Constructor(customScalarMap(env: env))
    }

    static func customScalarMap(env: [String: String]) -> ScalarMap {
        var map = defaultScalarMap
        map[.str] = String.constructExpandingEnvVars(env: env)
        return map
    }
}

private extension String {
    static func constructExpandingEnvVars(env: [String: String]) -> (_ scalar: Node.Scalar) -> String? {
        return { (scalar: Node.Scalar) -> String? in
            scalar.string.expandingEnvVars(env: env)
        }
    }

    func expandingEnvVars(env: [String: String]) -> String? {
        // check if entry has an env variable
        guard let match = self.range(of: #"\$\{(.)\w+\}"#, options: .regularExpression) else {
            return self
        }

        // get the env variable as "${ENV_VAR}"
        let key = String(self[match])

        // get the env variable as "ENV_VAR" - note missing $ and brackets
        let keyString = String(key[2..<key.count-1])

        guard let value = env[keyString] else { return "" }

        return self.replacingOccurrences(of: key, with: value)
    }
}

private extension StringProtocol {
    subscript(bounds: CountableClosedRange<Int>) -> SubSequence {
        let start = index(startIndex, offsetBy: bounds.lowerBound)
        let end = index(start, offsetBy: bounds.count)
        return self[start..<end]
    }

    subscript(bounds: CountableRange<Int>) -> SubSequence {
        let start = index(startIndex, offsetBy: bounds.lowerBound)
        let end = index(start, offsetBy: bounds.count)
        return self[start..<end]
    }
}


================================================
FILE: Sourcery/Generating/Templates/JavaScript/JavaScriptTemplate.swift
================================================
import SourceryFramework
import SourceryJS
import SourceryRuntime
#if canImport(ObjectiveC)
import JavaScriptCore

class JavaScriptTemplate: EJSTemplate, Template {

    override var context: [String: Any] {
        didSet {
            jsContext.catchTypesAccessErrors()
            jsContext.catchTemplateContextTypesUnknownProperties()
        }
    }

    func render(_ context: TemplateContext) throws -> String {
        return try render(context.jsContext)
    }

}

private extension JSContext {

    // this will catch errors accessing types through wrong collections (i.e. using `implementing` instead of `based`)
    func catchTypesAccessErrors() {
        let valueForKey: @convention(block) (TypesCollection, String) -> Any? = { target, key in
            do {
                return try target.types(forKey: key)
            } catch {
                JSContext.current().evaluateScript("throw \"\(error)\"")
                return nil
            }
        }
        setObject(valueForKey, forKeyedSubscript: "valueForKey" as NSString)
        evaluateScript("templateContext.types.implementing = new Proxy(templateContext.types.implementing, { get: valueForKey })")
        evaluateScript("templateContext.types.inheriting = new Proxy(templateContext.types.inheriting, { get: valueForKey })")
        evaluateScript("templateContext.types.based = new Proxy(templateContext.types.based, { get: valueForKey })")
    }

    // this will catch errors when accessing context types properties (i.e. using `implements` instead of `implementing`)
    func catchTemplateContextTypesUnknownProperties() {
        evaluateScript("""
            templateContext.types = new Proxy(templateContext.types, {
                get(target, propertyKey, receiver) {
                    if (!(propertyKey in target)) {
                        throw new TypeError('Unknown property `'+propertyKey+'`');
                    }
                    // Make sure we don’t block access to Object.prototype
                    return Reflect.get(target, propertyKey, receiver);
                }
            });
            """)
    }

}
#endif


================================================
FILE: Sourcery/Generating/Templates/Stencil/StencilTemplate.swift
================================================
import Foundation
import SourceryFramework
import SourceryRuntime
import SourceryStencil

extension StencilTemplate: SourceryFramework.Template {
    public func render(_ context: TemplateContext) throws -> String {
        do {
            return try self.render(context.stencilContext)
        } catch {
            throw "\(sourcePath): \(error)"
        }
    }
}


================================================
FILE: Sourcery/Generating/Templates/Swift/SwiftTemplate.swift
================================================
//
//  SwiftTemplate.swift
//  Sourcery
//
//  Created by Krunoslav Zaher on 12/30/16.
//  Copyright © 2016 Pixle. All rights reserved.
//

import Foundation
import SourceryFramework
import SourceryRuntime
import SourcerySwift

extension SwiftTemplate: Template {

    public func render(_ context: TemplateContext) throws -> String {
        return try self.render(context as Any)
    }

}


================================================
FILE: Sourcery/Sourcery.swift
================================================
//
// Created by Krzysztof Zablocki on 14/09/2016.
// Copyright (c) 2016 Pixle. All rights reserved.
//

import Foundation
import PathKit
import SourceryFramework
import SourceryUtils
import SourceryRuntime
import SourceryJS
import SourcerySwift
import SourceryStencil
#if canImport(ObjectiveC)
import TryCatch
#endif
import XcodeProj

public class Sourcery {
    public static let version: String = SourceryVersion.current.value
    public static let generationMarker: String = "// Generated using Sourcery"
    public let generationHeader: String

    enum Error: Swift.Error {
        case containsMergeConflictMarkers
    }

    fileprivate let verbose: Bool
    fileprivate let watcherEnabled: Bool
    fileprivate let arguments: [String: NSObject]
    fileprivate let cacheDisabled: Bool
    fileprivate let cacheBasePath: Path?
    fileprivate let buildPath: Path?
    fileprivate let prune: Bool
    fileprivate let serialParse: Bool
    fileprivate let hideVersionHeader: Bool

    fileprivate var status = ""
    fileprivate var templatesPaths = Paths(include: [])
    fileprivate var outputPath = Output("", linkTo: nil)
    fileprivate var isDryRun: Bool = false
    fileprivate lazy var dryOutputBuffer = [DryOutputValue]()

    internal var dryOutput: (String) -> Void = Log.output(_:)

    // content annotated with file annotations per file path to write it to
    fileprivate var fileAnnotatedContent: [Path: [String]] = [:]

    /// Creates Sourcery processor
    public init(
        verbose: Bool = false,
        watcherEnabled: Bool = false,
        cacheDisabled: Bool = false,
        cacheBasePath: Path? = nil,
        buildPath: Path? = nil,
        prune: Bool = false,
        serialParse: Bool = false,
        hideVersionHeader: Bool = false,
        arguments: [String: NSObject] = [:],
        logConfiguration: Log.Configuration? = nil,
        headerPrefix: String? = nil
    ) {
        self.verbose = verbose
        self.arguments = arguments
        self.watcherEnabled = watcherEnabled
        self.cacheDisabled = cacheDisabled
        self.cacheBasePath = cacheBasePath
        self.buildPath = buildPath
        self.prune = prune
        self.serialParse = serialParse
        if let hideVersionHeader = arguments["hideVersionHeader"] {
            self.hideVersionHeader = (hideVersionHeader as? NSNumber)?.boolValue == true
        } else {
            self.hideVersionHeader = hideVersionHeader
        }
        if let logConfiguration {
            Log.setup(using: logConfiguration)
        }

        var prefix = ""
        if let headerPrefix {
            prefix += headerPrefix + "\n"
        }
        prefix += Sourcery.generationMarker
        if !self.hideVersionHeader {
          prefix += " \(Sourcery.version)"
        }
        self.generationHeader = "\(prefix) — https://github.com/krzysztofzablocki/Sourcery\n"
        + "// DO NOT EDIT\n"
    }

    /// Processes source files and generates corresponding code.
    ///
    /// - Parameters:
    ///   - files: Path of files to process, can be directory or specific file.
    ///   - templatePath: Specific Template to use for code generation.
    ///   - output: Path to output source code to.
    ///   - forceParse: extensions of generated sourcery file that can be parsed
    ///   - watcherEnabled: Whether daemon watcher should be enabled.
    /// - Throws: Potential errors.
    public func processFiles(_ source: Source, usingTemplates templatesPaths: Paths, output: Output, isDryRun: Bool = false, forceParse: [String] = [], parseDocumentation: Bool = false, baseIndentation: Int) throws -> [FolderWatcher.Local]? {
        self.templatesPaths = templatesPaths
        self.outputPath = output
        self.isDryRun = isDryRun

        let hasSwiftTemplates = templatesPaths.allPaths.contains(where: { $0.extension == "swifttemplate" })

        let watchPaths: Paths
        switch source {
        case let .sources(paths):
            watchPaths = paths
        case let .projects(projects):
            watchPaths = Paths(include: projects.map(\.root),
                               exclude: projects.flatMap(\.exclude))
        case let .packages(packages):
            watchPaths = Paths(include: packages.flatMap({ $0.targets.map(\.root) }),
                               exclude: packages.flatMap({ $0.targets.flatMap(\.excludes) }))
        }

        let process: (Source) throws -> ParsingResult = { source in
            var result: ParsingResult
            switch source {
            case let .sources(paths):
                result = try self.parse(from: paths.include, exclude: paths.exclude, forceParse: forceParse, parseDocumentation: parseDocumentation, modules: nil, requiresFileParserCopy: hasSwiftTemplates)
            case let .projects(projects):
                var paths: [Path] = []
                var modules = [String]()
                projects.forEach { project in
                    project.targets.forEach { target in
                        guard let projectTarget = project.file.target(named: target.name) else { return }

                        let files: [Path] = project.file.sourceFilesPaths(target: projectTarget, sourceRoot: project.root)
                        files.forEach { file in
                            guard !project.exclude.contains(file) else { return }
                            paths.append(file)
                            modules.append(target.module)
                        }
                        for framework in target.xcframeworks {
                            paths.append(framework.swiftInterfacePath)
                            modules.append(framework.module)
                        }
                    }
                }
                result = try self.parse(from: paths, forceParse: forceParse, parseDocumentation: parseDocumentation, modules: modules, requiresFileParserCopy: hasSwiftTemplates)
            case let .packages(packages):
                let paths: [Path] = packages.flatMap({ $0.targets.map(\.root) })
                let excludePaths: [Path] = packages.flatMap({ $0.targets.flatMap(\.excludes) })
                let modules = packages.flatMap({ $0.targets.map(\.name) })
                result = try self.parse(from: paths, exclude: excludePaths, forceParse: forceParse, parseDocumentation: parseDocumentation, modules: modules, requiresFileParserCopy: hasSwiftTemplates)
            }

            try self.generate(source: source, templatePaths: templatesPaths, output: output, parsingResult: &result, forceParse: forceParse, baseIndentation: baseIndentation)
            return result
        }

        var result = try process(source)

        if isDryRun {
            let encoder = JSONEncoder()
            encoder.outputFormatting = .prettyPrinted
            let data: Data = try encoder.encode(DryOutputSuccess(outputs: self.dryOutputBuffer))
            self.dryOutput(String(data: data, encoding: .utf8) ?? "")
        }

        guard watcherEnabled else {
            return nil
        }

        Log.info("Starting watching sources.")
#if canImport(ObjectiveC)
        let sourceWatchers = topPaths(from: watchPaths.allPaths).map({ watchPath in
            return FolderWatcher.Local(path: watchPath.string) { events in
                let eventPaths: [Path] = events
                    .filter { $0.flags.contains(.isFile) }
                    .compactMap {
                        let path = Path($0.path)
                        return path.isSwiftSourceFile ? path : nil
                    }

                var pathThatForcedRegeneration: Path?
                for path in eventPaths {
                    guard let file = try? path.read(.utf8) else { continue }
                    if !file.hasPrefix(Sourcery.generationMarker) {
                        pathThatForcedRegeneration = path
                        break
                    }
                }

                if let path = pathThatForcedRegeneration {
                    do {
                        Log.info("Source changed at \(path.string)")
                        result = try process(source)
                    } catch {
                        Log.error(error)
                    }
                }
            }
        })

        Log.info("Starting watching templates.")

        let templateWatchers = topPaths(from: templatesPaths.allPaths).map({ templatesPath in
            return FolderWatcher.Local(path: templatesPath.string) { events in
                let events = events
                    .filter { $0.flags.contains(.isFile) && Path($0.path).isTemplateFile }

                if !events.isEmpty {
                    do {
                        if events.count == 1 {
                            Log.info("Template changed \(events[0].path)")
                        } else {
                            Log.info("Templates changed: ")
                        }
                        try self.generate(source: source, templatePaths: Paths(include: [templatesPath]), output: output, parsingResult: &result, forceParse: forceParse, baseIndentation: baseIndentation)
                    } catch {
                        Log.error(error)
                    }
                }
            }
        })

        return Array([sourceWatchers, templateWatchers].joined())
#else
        return []
#endif
    }

    private func topPaths(from paths: [Path]) -> [Path] {
        var top: [(Path, [Path])] = []
        paths.forEach { path in
            // See if its already contained by the topDirectories
            guard top.first(where: { (_, children) -> Bool in
                return children.contains(path)
            }) == nil else { return }

            if path.isDirectory {
                top.append((path, (try? path.recursiveUnhiddenChildren()) ?? []))
            } else {
                let dir = path.parent()
                let children = (try? dir.recursiveUnhiddenChildren()) ?? []
                if children.contains(path) {
                    top.append((dir, children))
                } else {
                    top.append((path, []))
                }
            }
        }

        return top.map { $0.0 }
    }

    /// This function should be used to retrieve the path to the cache instead of `Path.cachesDir`,
    /// as it considers the `--cacheDisabled` and `--cacheBasePath` command line parameters.
    fileprivate func cachesDir(sourcePath: Path, createIfMissing: Bool = true) -> Path? {
        return cacheDisabled
            ? nil
            : Path.cachesDir(sourcePath: sourcePath, basePath: cacheBasePath, createIfMissing: createIfMissing)
    }

    /// Remove the existing cache artifacts if it exists.
    /// Currently this is only called from tests, and the `--cacheDisabled` and `--cacheBasePath` command line parameters are not considered.
    ///
    /// - Parameter sources: paths of the sources you want to delete the
    static func removeCache(for sources: [Path], cacheDisabled: Bool = false, cacheBasePath: Path? = nil) {
        if cacheDisabled {
            return
        }
        sources.forEach { path in
            let cacheDir = Path.cachesDir(sourcePath: path, basePath: cacheBasePath, createIfMissing: false)
            _ = try? cacheDir.delete()
        }
    }

    private func templatePaths(from: Paths) -> [Path] {
        return from.allPaths.filter { $0.isTemplateFile }
    }

}

#if canImport(ObjectiveC)
private extension Sourcery {
    func templates(from: Paths) throws -> [Template] {
        return try templatePaths(from: from).compactMap {
            if $0.extension == "sourcerytemplate" {
                let template = try JSONDecoder().decode(SourceryTemplate.self, from: $0.read())
                switch template.instance.kind {
                case .ejs:
                    guard let ejsPath = EJSTemplate.ejsPath else {
                        Log.warning("Skipping template \($0). JavaScript templates require EJS path to be set manually when using Sourcery built with Swift Package Manager. Use `--ejsPath` command line argument to set it.")
                        return nil
                    }
                    return try JavaScriptTemplate(path: $0, templateString: template.instance.content, ejsPath: ejsPath)
                case .stencil:
                    return try StencilTemplate(path: $0, templateString: template.instance.content)
                }
            } else if $0.extension == "swifttemplate" {
                let cachePath = cachesDir(sourcePath: $0)
                return try SwiftTemplate(path: $0, cachePath: cachePath, version: type(of: self).version, buildPath: buildPath)
            } else if $0.extension == "ejs" {
                guard let ejsPath = EJSTemplate.ejsPath else {
                    Log.warning("Skipping template \($0). JavaScript templates require EJS path to be set manually when using Sourcery built with Swift Package Manager. Use `--ejsPath` command line argument to set it.")
                    return nil
                }
                return try JavaScriptTemplate(path: $0, ejsPath: ejsPath)
            } else {
                return try StencilTemplate(path: $0)
            }
        }
    }
}
#else
private extension Sourcery {
    func templates(from: Paths) throws -> [Template] {
        return try templatePaths(from: from).compactMap {
            if $0.extension == "sourcerytemplate" {
                let template = try JSONDecoder().decode(SourceryTemplate.self, from: $0.read())
                return try StencilTemplate(path: $0, templateString: template.instance.content)
            } else if $0.extension == "swifttemplate" {
                let cachePath = cachesDir(sourcePath: $0)
                return try SwiftTemplate(path: $0, cachePath: cachePath, version: type(of: self).version, buildPath: buildPath)
            } else {
                return try StencilTemplate(path: $0)
            }
        }
    }
}
#endif

// MARK: - Parsing

extension Sourcery {
    typealias ParsingResult = (
        parserResult: FileParserResult?,
        types: Types,
        functions: [SourceryMethod],
        inlineRanges: [(file: String, ranges: [String: NSRange], indentations: [String: String])])

    typealias ParserWrapper = (path: Path, parse: () throws -> FileParserResult?)

  fileprivate func parse(from: [Path], exclude: [Path] = [], forceParse: [String] = [], parseDocumentation: Bool, modules: [String]?, requiresFileParserCopy: Bool) throws -> ParsingResult {
        if let modules = modules {
            precondition(from.count == modules.count, "There should be module for each file to parse")
        }

        let startScan = currentTimestamp()
        Log.info("Scanning sources...")

        var inlineRanges = [(file: String, ranges: [String: NSRange], indentations: [String: String])]()
        var allResults = [(changed: Bool, result: FileParserResult)]()

        let excludeSet = Set(exclude
            .map { $0.processablePaths }
            .compactMap({ $0 }).flatMap({ $0 }))

        try from.enumerated().forEach { index, from in
            let fileList = from.processablePaths
            let parserGenerator: [ParserWrapper] = fileList
                .filter { $0.isSwiftSourceFile }
                .filter {
                    return !excludeSet.contains($0)
                }
                .map { path in
                    return (path: path, parse: {
                        let module = modules?[index]

                        guard path.exists else {
                            return nil
                        }

                        let content = try path.read(.utf8)
                        let status = Verifier.canParse(content: content, path: path, generationMarker: Sourcery.generationMarker, forceParse: forceParse)
                        switch status {
                        case .containsConflictMarkers:
                            throw Error.containsMergeConflictMarkers
                        case .isCodeGenerated:
                            return nil
                        case .approved:
                            return try makeParser(for: content, forceParse: forceParse, parseDocumentation: parseDocumentation, path: path, module: module).parse()
                        }
                    })
                }

            var lastError: Swift.Error?

            let transform: (ParserWrapper) -> (changed: Bool, result: FileParserResult)? = { parser in
                do {
                    return try self.loadOrParse(parser: parser, cachesPath: self.cachesDir(sourcePath: from))
                } catch {
                    lastError = error
                    Log.error("Unable to parse \(parser.path), error \(error)")
                    return nil
                }
            }

            let results: [(changed: Bool, result: FileParserResult)]
            if serialParse {
                results = parserGenerator.compactMap(transform)
            } else {
                results = parserGenerator.parallelCompactMap(transform: transform)
            }

            if let error = lastError {
                throw error
            }

            if !results.isEmpty {
                allResults.append(contentsOf: results)
            }
        }

        Log.benchmark("\tloadOrParse: \(currentTimestamp() - startScan)")
        let reduceStart = currentTimestamp()

        var allTypealiases = [Typealias]()
        var allTypes = [Type]()
        var allFunctions = [SourceryMethod]()

        for pair in allResults {
            let next = pair.result
            allTypealiases += next.typealiases
            allTypes += next.types
            allFunctions += next.functions

            // swiftlint:disable:next force_unwrapping
            inlineRanges.append((next.path!, next.inlineRanges, next.inlineIndentations))
        }

        let parserResult = FileParserResult(path: nil, module: nil, types: allTypes, functions: allFunctions, typealiases: allTypealiases)

        var parserResultCopy: FileParserResult?
        if requiresFileParserCopy {
            let data = try NSKeyedArchiver.archivedData(withRootObject: parserResult, requiringSecureCoding: false)
            parserResultCopy = try NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(data) as? FileParserResult
        }

        let uniqueTypeStart = currentTimestamp()

        // ! All files have been scanned, time to join extensions with base class
        let (types, functions, typealiases) = Composer.uniqueTypesAndFunctions(parserResult, serial: serialParse)


        let filesThatHadToBeParsed = allResults
            .filter { $0.changed }
            .compactMap { $0.result.path }

        Log.benchmark("\treduce: \(uniqueTypeStart - reduceStart)\n\tcomposer: \(currentTimestamp() - uniqueTypeStart)\n\ttotal: \(currentTimestamp() - startScan)")
        Log.info("Found \(types.count) types in \(allResults.count) files, \(filesThatHadToBeParsed.count) changed from last run.")

        if !filesThatHadToBeParsed.isEmpty, (filesThatHadToBeParsed.count < 50 || Log.level == .verbose) {
            let files = filesThatHadToBeParsed
                .joined(separator: "\n")
            Log.info("Files changed:\n\(files)")
        }
        return (parserResultCopy, Types(types: types, typealiases: typealiases), functions, inlineRanges)
    }

    private func loadOrParse(parser: ParserWrapper, cachesPath: @autoclosure () -> Path?) throws -> (changed: Bool, result: FileParserResult)? {
        guard let cachesPath = cachesPath() else {
            return try parser.parse().map { (changed: true, result: $0) }
        }

        let path = parser.path
        let artifactsPath = cachesPath + "\(path.string.sha256()?.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? "\(path.string.hash)").srf"

        guard
            artifactsPath.exists,
            let modifiedDate = path.modifiedDate,
            let unarchived = load(artifacts: artifactsPath.string, modifiedDate: modifiedDate, path: path) else {

            guard let result = try parser.parse() else {
                return nil
            }

            do {
                let data = try NSKeyedArchiver.archivedData(withRootObject: result, requiringSecureCoding: false)
                try artifactsPath.write(data)
            } catch {
                fatalError("Unable to save artifacts for \(path) under \(artifactsPath), error: \(error)")
            }

            return (changed: true, result: result)
        }

        return (changed: false, result: unarchived)
    }

    private func load(artifacts: String, modifiedDate: Date, path: Path) -> FileParserResult? {
        var unarchivedResult: FileParserResult?

#if canImport(ObjectiveC)
        SwiftTryCatch.try({
            // this deprecation can't be removed atm, new API is 10x slower
            if let unarchived = NSKeyedUnarchiver.unarchiveObject(withFile: artifacts) as? FileParserResult {
                if unarchived.sourceryVersion == Sourcery.version, unarchived.modifiedDate == modifiedDate {
                    unarchivedResult = unarchived
                }
            }
        }, catch: { _ in
            Log.warning("Failed to unarchive cache for \(path.string) due to error, re-parsing file")
        }, finallyBlock: {})
#else
            // this deprecation can't be removed atm, new API is 10x slower
            if let unarchived = NSKeyedUnarchiver.unarchiveObject(withFile: artifacts) as? FileParserResult {
                if unarchived.sourceryVersion == Sourcery.version, unarchived.modifiedDate == modifiedDate {
                    unarchivedResult = unarchived
                }
            }
#endif

        return unarchivedResult
    }
}

// MARK: - Generation
extension Sourcery {
    private typealias SourceChange = (path: String, rangeInFile: NSRange, newRangeInFile: NSRange)
    private typealias GenerationResult = (String, [SourceChange])

    fileprivate func generate(source: Source, templatePaths: Paths, output: Output, parsingResult: inout ParsingResult, forceParse: [String], baseIndentation: Int) throws {
        let generationStart = currentTimestamp()

        Log.info("Loading templates...")
        let allTemplates = try templates(from: templatePaths)
        Log.info("Loaded \(allTemplates.count) templates.")
        Log.benchmark("\tLoading took \(currentTimestamp() - generationStart)")

        Log.info("Generating code...")
        status = ""

        if output.isDirectory {
            try allTemplates.forEach { template in
                let (result, sourceChanges) = try generate(template, forParsingResult: parsingResult, outputPath: output.path, forceParse: forceParse, baseIndentation: baseIndentation)
                updateRanges(in: &parsingResult, sourceChanges: sourceChanges)
                let outputPath = output.path + generatedPath(for: template.sourcePath)
                let isEmptyFile = result.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty
                let willSkipResultFile = prune && isEmptyFile
                try self.output(type: .template(template.sourcePath.string), result: result, to: outputPath, isEmptyFile: isEmptyFile)

                if !isDryRun, !willSkipResultFile, let linkTo = output.linkTo {
                    linkTo.targets.forEach { target in
                        link(outputPath, to: linkTo, target: target)
                    }
                }
            }
        } else {
            let result = try allTemplates.reduce((contents: "", parsingResult: parsingResult)) { state, template in
                var (result, parsingResult) = state
                let (generatedCode, sourceChanges) = try generate(template, forParsingResult: parsingResult, outputPath: output.path, forceParse: forceParse, baseIndentation: baseIndentation)
              
Download .txt
gitextract_t4znldax/

├── .circleci/
│   └── config.yml
├── .codecov.yml
├── .github/
│   └── workflows/
│       ├── bump_homebrew.yml
│       ├── docker.yml
│       ├── jazzy.yml
│       ├── release_macOS.yml
│       ├── release_ubuntu.yml
│       ├── test_macOS.yml
│       └── test_ubuntu.yml
├── .gitignore
├── .gitmodules
├── .jazzy.yaml
├── .pre-commit-hooks.yaml
├── .ruby-version
├── .sourcery-macOS.yml
├── .sourcery-ubuntu.yml
├── .swift-version
├── .swiftlint.yml
├── .vscode/
│   ├── launch.json
│   └── settings.json
├── ABOUT.md
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── Dangerfile
├── Dockerfile
├── Funding.yml
├── Gemfile
├── LICENSE
├── LINUX.md
├── LinuxMain.swift
├── Package.resolved
├── Package.swift
├── Plugins/
│   └── SourceryCommandPlugin/
│       └── SourceryCommandPlugin.swift
├── README.md
├── RELEASING.md
├── Rakefile
├── Scripts/
│   ├── SwiftLint.sh
│   ├── bootstrap
│   ├── package_content
│   ├── pre-commit.sh
│   └── update-placeholders
├── Sourcery/
│   ├── Configuration.swift
│   ├── Generating/
│   │   └── Templates/
│   │       ├── JavaScript/
│   │       │   └── JavaScriptTemplate.swift
│   │       ├── Stencil/
│   │       │   └── StencilTemplate.swift
│   │       └── Swift/
│   │           └── SwiftTemplate.swift
│   ├── Sourcery.swift
│   ├── Templates/
│   │   ├── Coding.stencil
│   │   ├── Description.stencil
│   │   ├── Diffable.stencil
│   │   ├── Equality.stencil
│   │   ├── JSExport.ejs
│   │   ├── Typed.stencil
│   │   └── TypedSpec.stencil
│   └── Utils/
│       ├── ByteRangeConversion.swift
│       ├── BytesRange + Editing.swift
│       ├── DryOutputModels.swift
│       ├── FolderWatcher.swift
│       ├── NSRange + Editing.swift
│       └── Xcode+Extensions.swift
├── Sourcery-Example/
│   ├── CodeGenerated/
│   │   └── Basic.generated.swift
│   ├── Podfile
│   ├── Sourcery-Example/
│   │   ├── AppDelegate.swift
│   │   ├── Assets.xcassets/
│   │   │   └── AppIcon.appiconset/
│   │   │       └── Contents.json
│   │   ├── Base.lproj/
│   │   │   ├── LaunchScreen.storyboard
│   │   │   └── Main.storyboard
│   │   ├── Info.plist
│   │   └── ViewController.swift
│   ├── Sourcery-Example.xcodeproj/
│   │   ├── project.pbxproj
│   │   └── project.xcworkspace/
│   │       └── contents.xcworkspacedata
│   ├── Sourcery-Example.xcworkspace/
│   │   └── contents.xcworkspacedata
│   └── Templates/
│       └── Basic.stencil
├── Sourcery.podspec
├── SourceryExecutable/
│   ├── Info.plist
│   └── main.swift
├── SourceryFramework/
│   ├── Info.plist
│   ├── SourceryFramework.h
│   └── Sources/
│       ├── Generating/
│       │   ├── Generator.swift
│       │   ├── SourceryTemplate.swift
│       │   └── Template.swift
│       └── Parsing/
│           ├── FileParserType.swift
│           ├── String+TypeInference.swift
│           ├── SwiftSyntax/
│           │   ├── AST/
│           │   │   ├── AccessLevel+SwiftSyntax.swift
│           │   │   ├── Actor+SwiftSyntax.swift
│           │   │   ├── Attribute+SwiftSyntax.swift
│           │   │   ├── Class+SwiftSyntax.swift
│           │   │   ├── Enum+SwiftSyntax.swift
│           │   │   ├── EnumCase+SwiftSyntax.swift
│           │   │   ├── GenericParameter+SwiftSyntax.swift
│           │   │   ├── GenericRequirement+SwiftSyntax.swift
│           │   │   ├── GenericType+SwiftSyntax.swift
│           │   │   ├── Method+SwiftSyntax.swift
│           │   │   ├── MethodParameter+SwiftSyntax.swift
│           │   │   ├── Modifier+SwiftSyntax.swift
│           │   │   ├── Protocol+SwiftSyntax.swift
│           │   │   ├── Signature.swift
│           │   │   ├── Struct+SwiftSyntax.swift
│           │   │   ├── Subscript+SwiftSyntax.swift
│           │   │   ├── Type+SwiftSyntax.swift
│           │   │   ├── TypeName+SwiftSyntax.swift
│           │   │   └── Variable+SwiftSyntax.swift
│           │   ├── FileParserSyntax.swift
│           │   ├── Syntax+Extensions.swift
│           │   └── SyntaxTreeCollector.swift
│           └── Utils/
│               ├── AnnotationsParser.swift
│               ├── Bridges.swift
│               ├── InlineParser.swift
│               ├── StringView.swift
│               └── Verifier.swift
├── SourceryFramework.podspec
├── SourceryJS/
│   ├── Info.plist
│   ├── Resources/
│   │   └── ejs.js
│   ├── SourceryJS.h
│   └── Sources/
│       ├── EJSTemplate+Tests.swift
│       └── EJSTemplate.swift
├── SourceryRuntime/
│   ├── Sources/
│   │   ├── Common/
│   │   │   ├── AST/
│   │   │   │   ├── AccessLevel.swift
│   │   │   │   ├── Actor.swift
│   │   │   │   ├── Annotations.swift
│   │   │   │   ├── Attribute.swift
│   │   │   │   ├── Class.swift
│   │   │   │   ├── Definition.swift
│   │   │   │   ├── Documentation.swift
│   │   │   │   ├── Import.swift
│   │   │   │   ├── Modifier.swift
│   │   │   │   ├── PhantomProtocols.swift
│   │   │   │   ├── Protocol.swift
│   │   │   │   ├── ProtocolComposition.swift
│   │   │   │   ├── Struct.swift
│   │   │   │   ├── TypeName/
│   │   │   │   │   ├── Array.swift
│   │   │   │   │   ├── Dictionary.swift
│   │   │   │   │   ├── Generic.swift
│   │   │   │   │   ├── Set.swift
│   │   │   │   │   └── Typed.swift
│   │   │   │   └── Typealias.swift
│   │   │   ├── Array+Parallel.swift
│   │   │   ├── BytesRange.swift
│   │   │   ├── Composer/
│   │   │   │   ├── Composer.swift
│   │   │   │   └── ParserResultsComposed.swift
│   │   │   ├── Diffable.swift
│   │   │   ├── Extensions.swift
│   │   │   ├── FileParserResult.swift
│   │   │   ├── Log.swift
│   │   │   └── TemplateContext.swift
│   │   ├── Generated/
│   │   │   ├── AutoHashable.generated.swift
│   │   │   ├── Coding.generated.swift
│   │   │   ├── JSExport.generated.swift
│   │   │   └── Typed.generated.swift
│   │   ├── Linux/
│   │   │   ├── AST/
│   │   │   │   ├── AssociatedType_Linux.swift
│   │   │   │   ├── AssociatedValue_Linux.swift
│   │   │   │   ├── ClosureParameter_Linux.swift
│   │   │   │   ├── EnumCase_Linux.swift
│   │   │   │   ├── Enum_Linux.swift
│   │   │   │   ├── GenericParameter_Linux.swift
│   │   │   │   ├── GenericRequirement_Linux.swift
│   │   │   │   ├── MethodParameter_Linux.swift
│   │   │   │   ├── Method_Linux.swift
│   │   │   │   ├── Protocol_Linux.swift
│   │   │   │   ├── Subscript_Linux.swift
│   │   │   │   ├── TypeName/
│   │   │   │   │   ├── Closure_Linux.swift
│   │   │   │   │   ├── GenericTypeParameter_Linux.swift
│   │   │   │   │   ├── Tuple_Linux.swift
│   │   │   │   │   └── TypeName_Linux.swift
│   │   │   │   ├── Type_Linux.swift
│   │   │   │   └── Variable_Linux.swift
│   │   │   ├── DynamicMemberLookup_Linux.swift
│   │   │   ├── NSException_Linux.swift
│   │   │   ├── TypesCollection_Linux.swift
│   │   │   └── Types_Linux.swift
│   │   └── macOS/
│   │       ├── AST/
│   │       │   ├── AssociatedType.swift
│   │       │   ├── AssociatedValue.swift
│   │       │   ├── ClosureParameter.swift
│   │       │   ├── Enum.swift
│   │       │   ├── EnumCase.swift
│   │       │   ├── GenericParameter.swift
│   │       │   ├── GenericRequirement.swift
│   │       │   ├── Method.swift
│   │       │   ├── MethodParameter.swift
│   │       │   ├── Subscript.swift
│   │       │   ├── Type.swift
│   │       │   ├── TypeName/
│   │       │   │   ├── Closure.swift
│   │       │   │   ├── GenericTypeParameter.swift
│   │       │   │   ├── Tuple.swift
│   │       │   │   └── TypeName.swift
│   │       │   └── Variable.swift
│   │       ├── Types.swift
│   │       └── TypesCollection.swift
│   └── Supporting Files/
│       ├── Info.plist
│       └── SourceryRuntime.h
├── SourceryRuntime.podspec
├── SourceryStencil/
│   ├── Info.plist
│   ├── SourceryStencil.h
│   └── Sources/
│       ├── NewLineNode.swift
│       ├── StencilTemplate.swift
│       └── TypedNode.swift
├── SourcerySwift/
│   ├── Info.plist
│   ├── SourcerySwift.h
│   └── Sources/
│       ├── SourceryRuntime.content.generated.swift
│       ├── SourceryRuntime_Linux.content.generated.swift
│       └── SwiftTemplate.swift
├── SourceryTests/
│   ├── ConfigurationSpec.swift
│   ├── Generating/
│   │   ├── JavaScriptTemplateSpecs.swift
│   │   ├── StencilTemplateSpec.swift
│   │   └── SwiftTemplateSpecs.swift
│   ├── GeneratorSpec.swift
│   ├── Helpers/
│   │   ├── Builders.swift
│   │   ├── CustomMatchers.swift
│   │   └── Extensions.swift
│   ├── Info.plist
│   ├── Models/
│   │   ├── ActorSpec.swift
│   │   ├── ArrayTypeSpec.swift
│   │   ├── ClassSpec.swift
│   │   ├── DiffableSpec.swift
│   │   ├── EnumSpec.swift
│   │   ├── MethodSpec.swift
│   │   ├── ProtocolSpec.swift
│   │   ├── StructSpec.swift
│   │   ├── TypeSpec.swift
│   │   ├── TypealiasSpec.swift
│   │   ├── TypedSpec.generated.swift
│   │   └── VariableSpec.swift
│   ├── Output/
│   │   └── DryOutputSpec.swift
│   ├── Parsing/
│   │   ├── ComposerSpec.swift
│   │   ├── FileParserSpec.swift
│   │   ├── FileParser_AssociatedTypeSpec.swift
│   │   ├── FileParser_AttributesModifierSpec.swift
│   │   ├── FileParser_MethodsSpec.swift
│   │   ├── FileParser_ProtocolComposition.swift
│   │   ├── FileParser_SubscriptsSpec.swift
│   │   ├── FileParser_TypeNameSpec.swift
│   │   ├── FileParser_VariableSpec.swift
│   │   └── Helpers/
│   │       ├── AnnotationsParserSpec.swift
│   │       ├── StringViewSpec.swift
│   │       ├── TemplateAnnotationsParserSpec.swift
│   │       ├── TemplatesAnnotationParser_ForceParseInlineCodeSpec.swift
│   │       └── VerifierSpec.swift
│   ├── Sourcery+PerformanceSpec.swift
│   ├── SourcerySpec.swift
│   └── Stub/
│       ├── Configs/
│       │   ├── invalid.yml
│       │   ├── multi.yml
│       │   ├── parent.yml
│       │   └── valid.yml
│       ├── DryRun-Code/
│       │   └── Base.swift
│       ├── Errors/
│       │   └── localized-error.swift
│       ├── JavaScriptTemplates/
│       │   ├── AllTypealiases.ejs
│       │   ├── Equality.ejs
│       │   ├── Function.ejs
│       │   ├── Includes.ejs
│       │   ├── Other.ejs
│       │   ├── ProtocolCompositions.ejs
│       │   ├── SubfolderIncludes.ejs
│       │   ├── Typealiases.ejs
│       │   └── lib/
│       │       ├── One.ejs
│       │       └── Two.ejs
│       ├── Performance-Code/
│       │   ├── Kiosk/
│       │   │   ├── Admin/
│       │   │   │   ├── AdminCardTestingViewController.swift
│       │   │   │   ├── AdminLogViewController.swift
│       │   │   │   ├── AdminPanelViewController.swift
│       │   │   │   ├── AuctionWebViewController.swift
│       │   │   │   ├── ChooseAuctionViewController.swift
│       │   │   │   └── PasswordAlertViewController.swift
│       │   │   ├── App/
│       │   │   │   ├── APIPingManager.swift
│       │   │   │   ├── AppDelegate+GlobalActions.swift
│       │   │   │   ├── AppDelegate.swift
│       │   │   │   ├── AppSetup.swift
│       │   │   │   ├── AppViewController.swift
│       │   │   │   ├── BidderDetailsRetrieval.swift
│       │   │   │   ├── CardHandler.swift
│       │   │   │   ├── Constants.swift
│       │   │   │   ├── GlobalFunctions.swift
│       │   │   │   ├── KioskDateFormatter.h
│       │   │   │   ├── KioskDateFormatter.m
│       │   │   │   ├── Logger.swift
│       │   │   │   ├── MarkdownParser.swift
│       │   │   │   ├── Models/
│       │   │   │   │   ├── Artist.swift
│       │   │   │   │   ├── Artwork.swift
│       │   │   │   │   ├── Bid.swift
│       │   │   │   │   ├── Bidder.swift
│       │   │   │   │   ├── BidderPosition.swift
│       │   │   │   │   ├── BuyersPremium.swift
│       │   │   │   │   ├── Card.swift
│       │   │   │   │   ├── GenericError.swift
│       │   │   │   │   ├── Image.swift
│       │   │   │   │   ├── JSONAble.swift
│       │   │   │   │   ├── Location.swift
│       │   │   │   │   ├── Sale.swift
│       │   │   │   │   ├── SaleArtwork.swift
│       │   │   │   │   ├── SaleArtworkViewModel.swift
│       │   │   │   │   ├── SystemTime.swift
│       │   │   │   │   └── User.swift
│       │   │   │   ├── NSErrorExtensions.swift
│       │   │   │   ├── Networking/
│       │   │   │   │   ├── APIKeys.swift
│       │   │   │   │   ├── ArtsyAPI.swift
│       │   │   │   │   ├── NetworkLogger.swift
│       │   │   │   │   ├── Networking.swift
│       │   │   │   │   ├── UserCredentials.swift
│       │   │   │   │   └── XAppToken.swift
│       │   │   │   ├── OfflineViewController.swift
│       │   │   │   ├── STPCard+Validation.h
│       │   │   │   ├── STPCard+Validation.m
│       │   │   │   ├── StubResponses.h
│       │   │   │   ├── StubResponses.m
│       │   │   │   ├── SwiftExtensions.swift
│       │   │   │   ├── UIStoryboardSegueExtensions.swift
│       │   │   │   ├── UIViewControllerExtensions.swift
│       │   │   │   ├── UIViewSubclassesErrorExtensions.swift
│       │   │   │   └── Views/
│       │   │   │       ├── Button Subclasses/
│       │   │   │       │   └── Button.swift
│       │   │   │       ├── RegisterFlowView.swift
│       │   │   │       ├── SimulatorOnlyView.swift
│       │   │   │       ├── Spinner.swift
│       │   │   │       ├── SwitchView.swift
│       │   │   │       └── Text Fields/
│       │   │   │           ├── CursorView.swift
│       │   │   │           └── TextField.swift
│       │   │   ├── Auction Listings/
│       │   │   │   ├── ListingsCountdownManager.swift
│       │   │   │   ├── ListingsViewController.swift
│       │   │   │   ├── ListingsViewModel.swift
│       │   │   │   ├── MasonryCollectionViewCell.swift
│       │   │   │   ├── TableCollectionViewCell.swift
│       │   │   │   └── WebViewController.swift
│       │   │   ├── Bid Fulfillment/
│       │   │   │   ├── AdminCCBypassNetworkModel.swift
│       │   │   │   ├── BidCheckingNetworkModel.swift
│       │   │   │   ├── BidDetailsPreviewView.swift
│       │   │   │   ├── BidderNetworkModel.swift
│       │   │   │   ├── ConfirmYourBidArtsyLoginViewController.swift
│       │   │   │   ├── ConfirmYourBidEnterYourEmailViewController.swift
│       │   │   │   ├── ConfirmYourBidPINViewController.swift
│       │   │   │   ├── ConfirmYourBidPasswordViewController.swift
│       │   │   │   ├── ConfirmYourBidViewController.swift
│       │   │   │   ├── FulfillmentContainerViewController.swift
│       │   │   │   ├── FulfillmentNavigationController.swift
│       │   │   │   ├── GenericFormValidationViewModel.swift
│       │   │   │   ├── KeypadContainerView.swift
│       │   │   │   ├── KeypadView.swift
│       │   │   │   ├── KeypadViewModel.swift
│       │   │   │   ├── LoadingViewController.swift
│       │   │   │   ├── LoadingViewModel.swift
│       │   │   │   ├── ManualCreditCardInputViewController.swift
│       │   │   │   ├── ManualCreditCardInputViewModel.swift
│       │   │   │   ├── Models/
│       │   │   │   │   ├── BidDetails.swift
│       │   │   │   │   ├── NewUser.swift
│       │   │   │   │   └── RegistrationCoordinator.swift
│       │   │   │   ├── PlaceBidNetworkModel.swift
│       │   │   │   ├── PlaceBidViewController.swift
│       │   │   │   ├── RegisterViewController.swift
│       │   │   │   ├── RegistrationEmailViewController.swift
│       │   │   │   ├── RegistrationMobileViewController.swift
│       │   │   │   ├── RegistrationPasswordViewController.swift
│       │   │   │   ├── RegistrationPasswordViewModel.swift
│       │   │   │   ├── RegistrationPostalZipViewController.swift
│       │   │   │   ├── StripeManager.swift
│       │   │   │   ├── SwipeCreditCardViewController.swift
│       │   │   │   └── YourBiddingDetailsViewController.swift
│       │   │   ├── Help/
│       │   │   │   ├── HelpAnimator.swift
│       │   │   │   └── HelpViewController.swift
│       │   │   ├── HelperFunctions.swift
│       │   │   ├── ListingsCollectionViewCell.swift
│       │   │   ├── Observable+JSONAble.swift
│       │   │   ├── Observable+Logging.swift
│       │   │   ├── Observable+Operators.swift
│       │   │   ├── Sale Artwork Details/
│       │   │   │   ├── ImageTiledDataSource.swift
│       │   │   │   ├── SaleArtworkDetailsViewController.swift
│       │   │   │   ├── SaleArtworkZoomViewController.swift
│       │   │   │   └── WhitespaceGobbler.swift
│       │   │   ├── UIKit+Rx.swift
│       │   │   ├── UILabel+Fonts.swift
│       │   │   ├── UIView+LongPressDisplayMessage.swift
│       │   │   └── UIViewController+Bidding.swift
│       │   └── LICENSE
│       ├── Result/
│       │   ├── AllTypealiases.swift
│       │   ├── Basic+Other+SourceryTemplates.swift
│       │   ├── Basic+Other+SourceryTemplates_Linux.swift
│       │   ├── Basic+Other.swift
│       │   ├── Basic.swift
│       │   ├── BasicFooExcluded.swift
│       │   ├── Function.swift
│       │   ├── Other.swift
│       │   ├── ProtocolCompositions.swift
│       │   └── Typealiases.swift
│       ├── Source/
│       │   ├── Bar.swift
│       │   ├── Foo.swift
│       │   ├── FooBar.swift
│       │   └── TestProject/
│       │       ├── TestProject/
│       │       │   └── Info.plist
│       │       └── TestProject.xcodeproj/
│       │           ├── project.pbxproj
│       │           └── project.xcworkspace/
│       │               └── contents.xcworkspacedata
│       ├── Source_Linux/
│       │   ├── Bar.swift
│       │   ├── Foo.swift
│       │   ├── FooBar.swift
│       │   └── TestProject/
│       │       ├── TestProject/
│       │       │   └── Info.plist
│       │       └── TestProject.xcodeproj/
│       │           ├── project.pbxproj
│       │           └── project.xcworkspace/
│       │               └── contents.xcworkspacedata
│       ├── Stubs.swift
│       ├── SwiftTemplates/
│       │   ├── Equality.swift
│       │   ├── Equality.swifttemplate
│       │   ├── Function.swifttemplate
│       │   ├── IncludeCycle.swifttemplate
│       │   ├── IncludeFile.swifttemplate
│       │   ├── IncludeFileNoExtension.swifttemplate
│       │   ├── Includes.swifttemplate
│       │   ├── IncludesNoExtension.swifttemplate
│       │   ├── Invalid.swifttemplate
│       │   ├── InvalidTag.swifttemplate
│       │   ├── Other.swifttemplate
│       │   ├── Runtime.swifttemplate
│       │   ├── SelfIncludeCycle.swifttemplate
│       │   ├── SubfolderFileIncludes.swifttemplate
│       │   ├── SubfolderIncludes.swifttemplate
│       │   ├── Throws.swifttemplate
│       │   ├── includeCycle/
│       │   │   ├── One.swifttemplate
│       │   │   └── Two.swifttemplate
│       │   └── lib/
│       │       ├── Equality.swift
│       │       ├── One.swifttemplate
│       │       └── Two.swifttemplate
│       └── Templates/
│           ├── Basic.stencil
│           ├── GenerationWays.stencil
│           ├── Include.stencil
│           ├── Other.stencil
│           ├── Partial.stencil
│           ├── SourceryTemplateEJS.sourcerytemplate
│           └── SourceryTemplateStencil.sourcerytemplate
├── SourceryUtils/
│   ├── Sources/
│   │   ├── Path+Extensions.swift
│   │   ├── Sha.swift
│   │   ├── Time.swift
│   │   └── Version.swift
│   └── Supporting Files/
│       ├── Info.plist
│       └── SourceryUtils.h
├── SourceryUtils.podspec
├── Templates/
│   ├── .swiftlint.yml
│   ├── CodableContext/
│   │   ├── CodableContext.h
│   │   └── Info.plist
│   ├── CodableContextTests/
│   │   ├── CodableContextTests.swift
│   │   └── Info.plist
│   ├── Templates/
│   │   ├── AutoCases.stencil
│   │   ├── AutoCodable.swifttemplate
│   │   ├── AutoEquatable.stencil
│   │   ├── AutoHashable.stencil
│   │   ├── AutoLenses.stencil
│   │   ├── AutoMockable.stencil
│   │   ├── Decorator.swifttemplate
│   │   └── LinuxMain.stencil
│   ├── Templates.xcodeproj/
│   │   ├── project.pbxproj
│   │   └── xcshareddata/
│   │       └── xcschemes/
│   │           └── TemplatesTests.xcscheme
│   ├── Tests/
│   │   ├── Context/
│   │   │   ├── AutoCases.swift
│   │   │   ├── AutoCodable.swift
│   │   │   ├── AutoEquatable.swift
│   │   │   ├── AutoHashable.swift
│   │   │   ├── AutoLenses.swift
│   │   │   ├── AutoMockable.swift
│   │   │   └── LinuxMain.swift
│   │   ├── Context_Linux/
│   │   │   ├── AutoCases.swift
│   │   │   ├── AutoEquatable.swift
│   │   │   ├── AutoHashable.swift
│   │   │   ├── AutoLenses.swift
│   │   │   ├── AutoMockable.swift
│   │   │   └── LinuxMain.swift
│   │   ├── Expected/
│   │   │   ├── AutoCases.expected
│   │   │   ├── AutoCodable.expected
│   │   │   ├── AutoEquatable.expected
│   │   │   ├── AutoHashable.expected
│   │   │   ├── AutoLenses.expected
│   │   │   ├── AutoMockable.expected
│   │   │   └── LinuxMain.expected
│   │   ├── Generated/
│   │   │   ├── AutoCases.generated.swift
│   │   │   ├── AutoCodable.generated.swift
│   │   │   ├── AutoEquatable.generated.swift
│   │   │   ├── AutoHashable.generated.swift
│   │   │   ├── AutoLenses.generated.swift
│   │   │   ├── AutoMockable.generated.swift
│   │   │   └── LinuxMain.generated.swift
│   │   ├── Info.plist
│   │   └── TemplatesTests.swift
│   └── artifactbundle.info.json.template
├── TryCatch/
│   ├── Info.plist
│   ├── TryCatch.m
│   └── include/
│       └── TryCatch.h
├── docs/
│   ├── Classes/
│   │   ├── Actor.html
│   │   ├── ArrayType.html
│   │   ├── AssociatedType.html
│   │   ├── AssociatedValue.html
│   │   ├── Attribute.html
│   │   ├── Class.html
│   │   ├── ClosureParameter.html
│   │   ├── ClosureType.html
│   │   ├── DictionaryType.html
│   │   ├── DiffableResult.html
│   │   ├── Enum.html
│   │   ├── EnumCase.html
│   │   ├── GenericParameter.html
│   │   ├── GenericRequirement/
│   │   │   └── Relationship.html
│   │   ├── GenericRequirement.html
│   │   ├── GenericType.html
│   │   ├── GenericTypeParameter.html
│   │   ├── Import.html
│   │   ├── Method.html
│   │   ├── MethodParameter.html
│   │   ├── Modifier.html
│   │   ├── Protocol.html
│   │   ├── ProtocolComposition.html
│   │   ├── SetType.html
│   │   ├── Struct.html
│   │   ├── Subscript.html
│   │   ├── TupleElement.html
│   │   ├── TupleType.html
│   │   ├── Type.html
│   │   ├── TypeName.html
│   │   ├── Types.html
│   │   └── Variable.html
│   ├── Enums/
│   │   └── Composer.html
│   ├── Examples.html
│   ├── Extensions/
│   │   ├── Array.html
│   │   ├── String.html
│   │   ├── StringProtocol.html
│   │   └── Typealias.html
│   ├── Guides.html
│   ├── Other Classes.html
│   ├── Other Enums.html
│   ├── Other Extensions.html
│   ├── Other Protocols.html
│   ├── Other Typealiases.html
│   ├── Protocols/
│   │   ├── Annotated.html
│   │   ├── Definition.html
│   │   ├── Diffable.html
│   │   ├── Documented.html
│   │   └── Typed.html
│   ├── Types.html
│   ├── codable.html
│   ├── css/
│   │   ├── highlight.css
│   │   └── jazzy.css
│   ├── decorator.html
│   ├── diffable.html
│   ├── enum-cases.html
│   ├── equatable.html
│   ├── hashable.html
│   ├── index.html
│   ├── installing.html
│   ├── js/
│   │   ├── jazzy.js
│   │   ├── jazzy.search.js
│   │   └── typeahead.jquery.js
│   ├── lenses.html
│   ├── linuxmain.html
│   ├── mocks.html
│   ├── search.json
│   ├── usage.html
│   └── writing-templates.html
└── guides/
    ├── Codable.md
    ├── Decorator.md
    ├── Diffable.md
    ├── Enum cases.md
    ├── Equatable.md
    ├── Hashable.md
    ├── Installing.md
    ├── Lenses.md
    ├── LinuxMain.md
    ├── Mocks.md
    ├── Usage.md
    └── Writing templates.md
Download .txt
SYMBOL INDEX (74 symbols across 4 files)

FILE: SourceryJS/Resources/ejs.js
  function s (line 1) | function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&re...
  function renderTemplate (line 6) | function renderTemplate(source, context, filename, folder) {
  function getIncludePath (line 148) | function getIncludePath(path, options){
  function handleCache (line 180) | function handleCache(options, template) {
  function tryHandleCache (line 224) | function tryHandleCache(options, data, cb) {
  function fileLoader (line 243) | function fileLoader(filePath){
  function includeFile (line 260) | function includeFile(path, options) {
  function includeSource (line 276) | function includeSource(path, options) {
  function rethrow (line 305) | function rethrow(err, str, flnm, lineno, esc){
  function stripSemi (line 329) | function stripSemi(str){
  function Template (line 448) | function Template(text, opts) {
  function _addOutput (line 689) | function _addOutput() {
  function encode_char (line 923) | function encode_char(c) {
  function normalizeArray (line 1144) | function normalizeArray(parts, allowAboveRoot) {
  function trim (line 1253) | function trim(arr) {
  function filter (line 1326) | function filter (xs, f) {
  function defaultSetTimout (line 1357) | function defaultSetTimout() {
  function defaultClearTimeout (line 1360) | function defaultClearTimeout () {
  function runTimeout (line 1383) | function runTimeout(fun) {
  function runClearTimeout (line 1408) | function runClearTimeout(marker) {
  function cleanUpNextTick (line 1440) | function cleanUpNextTick() {
  function drainQueue (line 1455) | function drainQueue() {
  function Item (line 1493) | function Item(fun, array) {
  function noop (line 1507) | function noop() {}

FILE: docs/js/jazzy.js
  function toggleItem (line 15) | function toggleItem($link, $content) {
  function itemLinkToContent (line 21) | function itemLinkToContent($link) {
  function openCurrentItemIfClosed (line 26) | function openCurrentItemIfClosed() {

FILE: docs/js/jazzy.search.js
  function displayTemplate (line 10) | function displayTemplate(result) {
  function suggestionTemplate (line 14) | function suggestionTemplate(result) {

FILE: docs/js/typeahead.jquery.js
  function reverseArgs (line 55) | function reverseArgs(index, value) {
  function template (line 100) | function template() {
  function _p8 (line 153) | function _p8(s) {
  function build (line 178) | function build(o) {
  function buildHtml (line 197) | function buildHtml(c) {
  function buildSelectors (line 203) | function buildSelectors(classes) {
  function buildCss (line 210) | function buildCss() {
  function EventBus (line 267) | function EventBus(o) {
  function on (line 304) | function on(method, types, cb, context) {
  function onAsync (line 321) | function onAsync(types, cb, context) {
  function onSync (line 324) | function onSync(types, cb, context) {
  function off (line 327) | function off(types) {
  function trigger (line 338) | function trigger(types) {
  function getFlush (line 352) | function getFlush(callbacks, context, args) {
  function getNextTick (line 362) | function getNextTick() {
  function bindContext (line 379) | function bindContext(fn, context) {
  function hightlightTextNode (line 433) | function hightlightTextNode(textNode) {
  function traverse (line 445) | function traverse(el, hightlightTextNode) {
  function accent_replacer (line 457) | function accent_replacer(chr) {
  function getRegex (line 460) | function getRegex(patterns, caseSensitive, wordsOnly, diacriticInsensiti...
  function Input (line 485) | function Input(o, www) {
  function buildOverflowHelper (line 684) | function buildOverflowHelper($input) {
  function areQueriesEquivalent (line 701) | function areQueriesEquivalent(a, b) {
  function withModifier (line 704) | function withModifier($e) {
  function Dataset (line 717) | function Dataset(o, www) {
  function sync (line 858) | function sync(suggestions) {
  function async (line 870) | function async(suggestions) {
  function getDisplayFn (line 895) | function getDisplayFn(display) {
  function getTemplates (line 902) | function getTemplates(templates, displayFn) {
  function isValidName (line 918) | function isValidName(str) {
  function Menu (line 924) | function Menu(o, www) {
  function updateDataset (line 1046) | function updateDataset(dataset) {
  function clearDataset (line 1054) | function clearDataset(dataset) {
  function destroyDataset (line 1062) | function destroyDataset(dataset) {
  function Status (line 1071) | function Status(options) {
  function DefaultMenu (line 1121) | function DefaultMenu() {
  function Typeahead (line 1164) | function Typeahead(o, www) {
  function c (line 1447) | function c(ctx) {
  function attach (line 1473) | function attach() {
  function ttEach (line 1632) | function ttEach($els, fn) {
  function buildHintFromInput (line 1638) | function buildHintFromInput($input, www) {
  function prepInput (line 1647) | function prepInput($input, www) {
  function getBackgroundStyles (line 1662) | function getBackgroundStyles($el) {
  function revert (line 1674) | function revert($input) {
  function $elOrNull (line 1687) | function $elOrNull(obj) {
Condensed preview — 553 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (5,174K chars).
[
  {
    "path": ".circleci/config.yml",
    "chars": 1109,
    "preview": "version: 2\n\njobs:\n  test:\n    macos:\n      xcode: \"14.3.1\"\n    environment:\n      BUNDLE_JOBS: 3\n      BUNDLE_RETRY: 3\n "
  },
  {
    "path": ".codecov.yml",
    "chars": 198,
    "preview": "coverage:\n  ignore:\n    - Sourcery/main.swift\n    - Sourcery/CodeGenerated/*\n    - Pods/*\n  status:\n    patch: false\n   "
  },
  {
    "path": ".github/workflows/bump_homebrew.yml",
    "chars": 487,
    "preview": "name: Bump Homebrew formula\n\non:\n  workflow_dispatch:\n    inputs:\n      tag-name:\n        description: 'The git tag name"
  },
  {
    "path": ".github/workflows/docker.yml",
    "chars": 2828,
    "preview": "name: Docker\n\npermissions:\n  contents: read\n  packages: write\n\non:\n  push:\n    branches:\n      - master\n    tags:\n      "
  },
  {
    "path": ".github/workflows/jazzy.yml",
    "chars": 1100,
    "preview": "# This workflow will build a Swift project\n# For more information see: https://docs.github.com/en/actions/automating-bui"
  },
  {
    "path": ".github/workflows/release_macOS.yml",
    "chars": 3300,
    "preview": "name: release macOS\n\non:\n  workflow_dispatch:\n    inputs:\n      ref:\n        description: 'Ref to build (branch, tag or "
  },
  {
    "path": ".github/workflows/release_ubuntu.yml",
    "chars": 1608,
    "preview": "name: release ubuntu\n\non:\n  workflow_dispatch:\n    inputs:\n      ref:\n        description: 'Ref to build (branch, tag or"
  },
  {
    "path": ".github/workflows/test_macOS.yml",
    "chars": 701,
    "preview": "# This workflow will build a Swift project\n# For more information see: https://docs.github.com/en/actions/automating-bui"
  },
  {
    "path": ".github/workflows/test_ubuntu.yml",
    "chars": 699,
    "preview": "# This workflow will build a Swift project\n# For more information see: https://docs.github.com/en/actions/automating-bui"
  },
  {
    "path": ".gitignore",
    "chars": 1781,
    "preview": "# Xcode\n#\n# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore\n\n"
  },
  {
    "path": ".gitmodules",
    "chars": 0,
    "preview": ""
  },
  {
    "path": ".jazzy.yaml",
    "chars": 1080,
    "preview": "author: Krzysztof Zabłocki\nauthor_url: https://twitter.com/merowing_\nmodule: Sourcery\nsourcekitten_sourcefile: docs.json"
  },
  {
    "path": ".pre-commit-hooks.yaml",
    "chars": 210,
    "preview": "- id: sourcery\n  name: Sourcery\n  description: 'Meta-programming for Swift, stop writing boilerplate code.'\n  language: "
  },
  {
    "path": ".ruby-version",
    "chars": 5,
    "preview": "3.4.1"
  },
  {
    "path": ".sourcery-macOS.yml",
    "chars": 278,
    "preview": "sources:\n - SourceryRuntime/Sources/Common\n - SourceryRuntime/Sources/macOS\ntemplates:\n - Sourcery/Templates/Coding.sten"
  },
  {
    "path": ".sourcery-ubuntu.yml",
    "chars": 278,
    "preview": "sources:\n - SourceryRuntime/Sources/Common\n - SourceryRuntime/Sources/Linux\ntemplates:\n - Sourcery/Templates/Coding.sten"
  },
  {
    "path": ".swift-version",
    "chars": 4,
    "preview": "5.8\n"
  },
  {
    "path": ".swiftlint.yml",
    "chars": 1266,
    "preview": "disabled_rules: # rule identifiers to exclude from running\n  - function_parameter_count\n  - line_length\n  - variable_nam"
  },
  {
    "path": ".vscode/launch.json",
    "chars": 840,
    "preview": "{\n    \"configurations\": [\n        {\n            \"type\": \"lldb\",\n            \"request\": \"launch\",\n            \"sourceLang"
  },
  {
    "path": ".vscode/settings.json",
    "chars": 2,
    "preview": "{}"
  },
  {
    "path": "ABOUT.md",
    "chars": 1861,
    "preview": "## What is Sourcery?\n_**Sourcery** scans your source code, applies your personal templates and generates Swift code for "
  },
  {
    "path": "CHANGELOG.md",
    "chars": 52524,
    "preview": "# Sourcery CHANGELOG\n\n## 2.3.0\n* Added `withExtendedLifetime` support for better lifetime management in templates (#1419"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "chars": 3235,
    "preview": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nIn the interest of fostering an open and welcoming environment, w"
  },
  {
    "path": "CONTRIBUTING.md",
    "chars": 956,
    "preview": "# Contributing to Sourcery\n\nSourcery is an open source project started by Krzysztof Zabłocki and open to the entire Coco"
  },
  {
    "path": "Dangerfile",
    "chars": 1534,
    "preview": "# Sometimes it's a README fix, or something like that - which isn't relevant for\n# including in a project's CHANGELOG fo"
  },
  {
    "path": "Dockerfile",
    "chars": 1265,
    "preview": "ARG BUILDER_IMAGE=swift:6.0-jammy\nARG RUNTIME_IMAGE=swift:6.0-jammy-slim\n\n# Builder image\nFROM ${BUILDER_IMAGE} AS build"
  },
  {
    "path": "Funding.yml",
    "chars": 71,
    "preview": "github: krzysztofzablocki\ncustom: https://www.merowing.info/membership\n"
  },
  {
    "path": "Gemfile",
    "chars": 172,
    "preview": "source 'https://rubygems.org'\n\ngem 'cocoapods', '1.14.3'\ngem 'danger'\ngem 'rake'\ngem 'slather'\ngem 'xcpretty'\ngem 'ffi',"
  },
  {
    "path": "LICENSE",
    "chars": 1080,
    "preview": "MIT License\n\nCopyright (c) 2016-2021 Krzysztof Zabłocki\n\nPermission is hereby granted, free of charge, to any person obt"
  },
  {
    "path": "LINUX.md",
    "chars": 3407,
    "preview": "## Linux Support\n\nCurrently (as per 2.1.0 release), Linux Support is **experimental**. This means the following:\n\n1. Run"
  },
  {
    "path": "LinuxMain.swift",
    "chars": 3107,
    "preview": "import XCTest\nimport Quick\n\n@testable import SourceryLibTests\n@testable import TemplatesTests\n@testable import CodableCo"
  },
  {
    "path": "Package.resolved",
    "chars": 6289,
    "preview": "{\n  \"pins\" : [\n    {\n      \"identity\" : \"aexml\",\n      \"kind\" : \"remoteSourceControl\",\n      \"location\" : \"https://githu"
  },
  {
    "path": "Package.swift",
    "chars": 9081,
    "preview": "// swift-tools-version:5.8\n\nimport PackageDescription\nimport Foundation\n\nvar sourceryLibDependencies: [Target.Dependency"
  },
  {
    "path": "Plugins/SourceryCommandPlugin/SourceryCommandPlugin.swift",
    "chars": 2591,
    "preview": "import PackagePlugin\nimport Foundation\n\n@main\nstruct SourceryCommandPlugin {\n    private func run(_ sourcery: String, wi"
  },
  {
    "path": "README.md",
    "chars": 14798,
    "preview": "[![macOS 13](https://github.com/krzysztofzablocki/Sourcery/actions/workflows/test_macOS.yml/badge.svg)](https://github.c"
  },
  {
    "path": "RELEASING.md",
    "chars": 2456,
    "preview": "# Releasing Sourcery\n\n## Note\n\nSee https://github.com/krzysztofzablocki/Sourcery/issues/1247#issuecomment-1892571851 for"
  },
  {
    "path": "Rakefile",
    "chars": 16277,
    "preview": "#!/usr/bin/rake\n## Most of this code is adapted from Sourcery https://github.com/AliSoftware/Sourcery/blob/master/Rakefi"
  },
  {
    "path": "Scripts/SwiftLint.sh",
    "chars": 246,
    "preview": "#!/bin/zsh\n\nif which swiftlint >/dev/null; then\n    swiftlint autocorrect\n    swiftlint\nelse\n    echo \"warning: SwiftLin"
  },
  {
    "path": "Scripts/bootstrap",
    "chars": 490,
    "preview": "#!/usr/bin/env bash\n# Usage: scripts/bootstrap\n# Prepares git and pods integration by providing pre-commit hook and isol"
  },
  {
    "path": "Scripts/package_content",
    "chars": 3742,
    "preview": "#!/usr/bin/env swift\n/// Usage: $0 FOLDER\n/// Description:\n///   Merge all Swift files contained in FOLDER into swift co"
  },
  {
    "path": "Scripts/pre-commit.sh",
    "chars": 885,
    "preview": "#!/usr/bin/env bash\nset -eu\n\nfailed=0\n\ntest_pattern='\\b(fdescribe|fit|fcontext|xdescribe|xit|xcontext)\\b'\nif git diff-in"
  },
  {
    "path": "Scripts/update-placeholders",
    "chars": 3226,
    "preview": "#!/usr/bin/swift\n//\n//  main.swift\n//  UpdateAutogenerated\n//\n//  Created by Krunoslav Zaher on 1/6/17.\n//  Copyright © "
  },
  {
    "path": "Sourcery/Configuration.swift",
    "chars": 20098,
    "preview": "import Foundation\nimport XcodeProj\nimport PathKit\nimport Yams\nimport SourceryRuntime\nimport Basics\nimport TSCBasic\nimpor"
  },
  {
    "path": "Sourcery/Generating/Templates/JavaScript/JavaScriptTemplate.swift",
    "chars": 2131,
    "preview": "import SourceryFramework\nimport SourceryJS\nimport SourceryRuntime\n#if canImport(ObjectiveC)\nimport JavaScriptCore\n\nclass"
  },
  {
    "path": "Sourcery/Generating/Templates/Stencil/StencilTemplate.swift",
    "chars": 368,
    "preview": "import Foundation\nimport SourceryFramework\nimport SourceryRuntime\nimport SourceryStencil\n\nextension StencilTemplate: Sou"
  },
  {
    "path": "Sourcery/Generating/Templates/Swift/SwiftTemplate.swift",
    "chars": 391,
    "preview": "//\n//  SwiftTemplate.swift\n//  Sourcery\n//\n//  Created by Krunoslav Zaher on 12/30/16.\n//  Copyright © 2016 Pixle. All r"
  },
  {
    "path": "Sourcery/Sourcery.swift",
    "chars": 39549,
    "preview": "//\n// Created by Krzysztof Zablocki on 14/09/2016.\n// Copyright (c) 2016 Pixle. All rights reserved.\n//\n\nimport Foundati"
  },
  {
    "path": "Sourcery/Templates/Coding.stencil",
    "chars": 2953,
    "preview": "// swiftlint:disable vertical_whitespace trailing_newline\n\nimport Foundation\n\n\nextension NSCoder {\n\n    @nonobjc func de"
  },
  {
    "path": "Sourcery/Templates/Description.stencil",
    "chars": 655,
    "preview": "// swiftlint:disable vertical_whitespace\n\n\n{% for type in types.implementing.AutoDescription|class %} {% if type.variabl"
  },
  {
    "path": "Sourcery/Templates/Diffable.stencil",
    "chars": 1037,
    "preview": "import Foundation\n\n{% for type in types.implementing.AutoDiffable|!protocol|!annotated:\"skipDiffing\" %}\nextension {{ typ"
  },
  {
    "path": "Sourcery/Templates/Equality.stencil",
    "chars": 1400,
    "preview": "// swiftlint:disable vertical_whitespace\n\n\n{% for type in types.implementing.AutoEquatable|class %}\nextension {{ type.na"
  },
  {
    "path": "Sourcery/Templates/JSExport.ejs",
    "chars": 584,
    "preview": "// swiftlint:disable vertical_whitespace trailing_newline\n\n#if canImport(JavaScriptCore)\nimport JavaScriptCore\n\n<%_ for "
  },
  {
    "path": "Sourcery/Templates/Typed.stencil",
    "chars": 1655,
    "preview": "// swiftlint:disable vertical_whitespace\n\n\n{% for type in types.implementing.Typed %}\nextension {{ type.name }} {\n    //"
  },
  {
    "path": "Sourcery/Templates/TypedSpec.stencil",
    "chars": 3964,
    "preview": "//sourcery:file:../../../SourceryTests/Models/TypedSpec\nimport Quick\nimport Nimble\n#if SWIFT_PACKAGE\nimport SourceryLib\n"
  },
  {
    "path": "Sourcery/Utils/ByteRangeConversion.swift",
    "chars": 607,
    "preview": "//\n//  ByteRangeConversion.swift\n//  Sourcery\n//\n//  Created by Evgeniy Gubin on 16.04.2021.\n//  Copyright © 2021 Pixle."
  },
  {
    "path": "Sourcery/Utils/BytesRange + Editing.swift",
    "chars": 570,
    "preview": "//\n//  BytesRange + Editing.swift\n//  Sourcery\n//\n//  Created by Evgeniy Gubin on 16.04.2021.\n//  Copyright © 2021 Pixle"
  },
  {
    "path": "Sourcery/Utils/DryOutputModels.swift",
    "chars": 1303,
    "preview": "import Foundation\n\nstruct DryOutputType: Codable {\n    enum SubType: String, Codable {\n        case allTemplates\n       "
  },
  {
    "path": "Sourcery/Utils/FolderWatcher.swift",
    "chars": 5480,
    "preview": "//\n//  FolderWatcher.swift\n//  Sourcery\n//\n//  Created by Krzysztof Zabłocki on 24/12/2016.\n//  Copyright © 2016 Pixle. "
  },
  {
    "path": "Sourcery/Utils/NSRange + Editing.swift",
    "chars": 640,
    "preview": "//\n// Created by hemet_000 on 14.04.2021.\n//\n\nimport Foundation\nimport struct SourceryFramework.ByteRange\nimport struct "
  },
  {
    "path": "Sourcery/Utils/Xcode+Extensions.swift",
    "chars": 4313,
    "preview": "import Foundation\nimport PathKit\nimport XcodeProj\nimport SourceryRuntime\n\nprivate struct UnableToAddSourceFile: Error {\n"
  },
  {
    "path": "Sourcery-Example/CodeGenerated/Basic.generated.swift",
    "chars": 50,
    "preview": "// Found 2 Types\n//  AppDelegate   ViewController\n"
  },
  {
    "path": "Sourcery-Example/Podfile",
    "chars": 254,
    "preview": "# Uncomment the next line to define a global platform for your project\n# platform :ios, '9.0'\n\ntarget 'Sourcery-Example'"
  },
  {
    "path": "Sourcery-Example/Sourcery-Example/AppDelegate.swift",
    "chars": 2180,
    "preview": "//\n//  AppDelegate.swift\n//  Sourcery-Example\n//\n//  Created by Krzysztof Zablocki on 11/12/2016.\n//  Copyright © 2016 P"
  },
  {
    "path": "Sourcery-Example/Sourcery-Example/Assets.xcassets/AppIcon.appiconset/Contents.json",
    "chars": 585,
    "preview": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"29x29\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\""
  },
  {
    "path": "Sourcery-Example/Sourcery-Example/Base.lproj/LaunchScreen.storyboard",
    "chars": 1740,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard"
  },
  {
    "path": "Sourcery-Example/Sourcery-Example/Base.lproj/Main.storyboard",
    "chars": 1695,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard"
  },
  {
    "path": "Sourcery-Example/Sourcery-Example/Info.plist",
    "chars": 1152,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "Sourcery-Example/Sourcery-Example/ViewController.swift",
    "chars": 514,
    "preview": "//\n//  ViewController.swift\n//  Sourcery-Example\n//\n//  Created by Krzysztof Zablocki on 11/12/2016.\n//  Copyright © 201"
  },
  {
    "path": "Sourcery-Example/Sourcery-Example.xcodeproj/project.pbxproj",
    "chars": 16735,
    "preview": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 46;\n\tobjects = {\n\n/* Begin PBXBuildFile section *"
  },
  {
    "path": "Sourcery-Example/Sourcery-Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata",
    "chars": 161,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"self:Sourcery-Exampl"
  },
  {
    "path": "Sourcery-Example/Sourcery-Example.xcworkspace/contents.xcworkspacedata",
    "chars": 234,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"group:Sourcery-Examp"
  },
  {
    "path": "Sourcery-Example/Templates/Basic.stencil",
    "chars": 98,
    "preview": "// Found {{ types.all.count }} Types\n// {% for type in types.all %} {{ type.name }}  {% endfor %}\n"
  },
  {
    "path": "Sourcery.podspec",
    "chars": 1172,
    "preview": "Pod::Spec.new do |s|\n\n  s.name         = \"Sourcery\"\n  s.version      = \"2.3.0\"\n  s.summary      = \"A tool that brings me"
  },
  {
    "path": "SourceryExecutable/Info.plist",
    "chars": 1099,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "SourceryExecutable/main.swift",
    "chars": 20993,
    "preview": "//\n//  main.swift\n//  Sourcery\n//\n//  Created by Krzysztof Zablocki on 09/12/2016.\n//  Copyright © 2016 Pixle. All right"
  },
  {
    "path": "SourceryFramework/Info.plist",
    "chars": 826,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "SourceryFramework/SourceryFramework.h",
    "chars": 548,
    "preview": "//\n//  SourceryFramework.h\n//  SourceryFramework\n//\n//  Created by Ilya Puchka on 24/12/2018.\n//  Copyright © 2018 Pixle"
  },
  {
    "path": "SourceryFramework/Sources/Generating/Generator.swift",
    "chars": 568,
    "preview": "//\n// Created by Krzysztof Zablocki on 13/09/2016.\n// Copyright (c) 2016 Pixle. All rights reserved.\n//\n\nimport Foundati"
  },
  {
    "path": "SourceryFramework/Sources/Generating/SourceryTemplate.swift",
    "chars": 661,
    "preview": "import Foundation\n\npublic struct SourceryTemplate: Decodable {\n    public struct Instance: Decodable {\n        public en"
  },
  {
    "path": "SourceryFramework/Sources/Generating/Template.swift",
    "chars": 605,
    "preview": "//\n// Created by Krzysztof Zablocki on 31/12/2016.\n// Copyright (c) 2016 Pixle. All rights reserved.\n//\n\nimport Foundati"
  },
  {
    "path": "SourceryFramework/Sources/Parsing/FileParserType.swift",
    "chars": 978,
    "preview": "import Foundation\nimport PathKit\nimport SourceryRuntime\n\npublic protocol FileParserType {\n\n    var path: String? { get }"
  },
  {
    "path": "SourceryFramework/Sources/Parsing/String+TypeInference.swift",
    "chars": 10984,
    "preview": "import Foundation\nimport SourceryRuntime\n\nextension String {\n    private static let optionalTypeName: TypeName = {\n     "
  },
  {
    "path": "SourceryFramework/Sources/Parsing/SwiftSyntax/AST/AccessLevel+SwiftSyntax.swift",
    "chars": 902,
    "preview": "import SourceryRuntime\nimport SwiftSyntax\n\nextension AccessLevel {\n    init?(_ modifier: Modifier) {\n        switch modi"
  },
  {
    "path": "SourceryFramework/Sources/Parsing/SwiftSyntax/AST/Actor+SwiftSyntax.swift",
    "chars": 1067,
    "preview": "import Foundation\nimport SourceryRuntime\nimport SwiftSyntax\n\nextension Actor {\n    convenience init(_ node: ActorDeclSyn"
  },
  {
    "path": "SourceryFramework/Sources/Parsing/SwiftSyntax/AST/Attribute+SwiftSyntax.swift",
    "chars": 3462,
    "preview": "import Foundation\nimport SourceryRuntime\nimport SwiftSyntax\n\nextension Attribute {\n    convenience init(_ attribute: Att"
  },
  {
    "path": "SourceryFramework/Sources/Parsing/SwiftSyntax/AST/Class+SwiftSyntax.swift",
    "chars": 1605,
    "preview": "import Foundation\nimport SourceryRuntime\nimport SwiftSyntax\n\nextension Class {\n    convenience init(_ node: ClassDeclSyn"
  },
  {
    "path": "SourceryFramework/Sources/Parsing/SwiftSyntax/AST/Enum+SwiftSyntax.swift",
    "chars": 1236,
    "preview": "import Foundation\nimport SourceryRuntime\nimport SwiftSyntax\n\nextension Enum {\n    convenience init(_ node: EnumDeclSynta"
  },
  {
    "path": "SourceryFramework/Sources/Parsing/SwiftSyntax/AST/EnumCase+SwiftSyntax.swift",
    "chars": 2641,
    "preview": "import Foundation\nimport SwiftSyntax\nimport SourceryRuntime\n\nextension EnumCase {\n\n    convenience init(_ node: EnumCase"
  },
  {
    "path": "SourceryFramework/Sources/Parsing/SwiftSyntax/AST/GenericParameter+SwiftSyntax.swift",
    "chars": 274,
    "preview": "import Foundation\nimport SwiftSyntax\nimport SourceryRuntime\n\nextension GenericParameter {\n    convenience init(_ node: G"
  },
  {
    "path": "SourceryFramework/Sources/Parsing/SwiftSyntax/AST/GenericRequirement+SwiftSyntax.swift",
    "chars": 1216,
    "preview": "import Foundation\nimport SwiftSyntax\nimport SourceryRuntime\n\nextension GenericRequirement {\n    convenience init(_ node:"
  },
  {
    "path": "SourceryFramework/Sources/Parsing/SwiftSyntax/AST/GenericType+SwiftSyntax.swift",
    "chars": 1128,
    "preview": "import Foundation\nimport SourceryRuntime\nimport SwiftSyntax\n\nextension GenericType {\n    convenience init(name: String, "
  },
  {
    "path": "SourceryFramework/Sources/Parsing/SwiftSyntax/AST/Method+SwiftSyntax.swift",
    "chars": 7715,
    "preview": "import Foundation\nimport SwiftSyntax\nimport SourceryRuntime\n\nextension SourceryMethod {\n    convenience init(_ node: Fun"
  },
  {
    "path": "SourceryFramework/Sources/Parsing/SwiftSyntax/AST/MethodParameter+SwiftSyntax.swift",
    "chars": 1714,
    "preview": "import SwiftSyntax\nimport SourceryRuntime\n\nextension MethodParameter {\n    convenience init(_ node: FunctionParameterSyn"
  },
  {
    "path": "SourceryFramework/Sources/Parsing/SwiftSyntax/AST/Modifier+SwiftSyntax.swift",
    "chars": 2251,
    "preview": "import Foundation\nimport SwiftSyntax\nimport SourceryRuntime\n\n/// modifier can be thing like `private`, `class`, `nonmuta"
  },
  {
    "path": "SourceryFramework/Sources/Parsing/SwiftSyntax/AST/Protocol+SwiftSyntax.swift",
    "chars": 1528,
    "preview": "import Foundation\nimport SourceryRuntime\nimport SwiftSyntax\n\nextension SourceryProtocol {\n    convenience init(_ node: P"
  },
  {
    "path": "SourceryFramework/Sources/Parsing/SwiftSyntax/AST/Signature.swift",
    "chars": 3192,
    "preview": "import SwiftSyntax\nimport SourceryRuntime\n\npublic struct Signature {\n    /// The function inputs.\n    public let input: "
  },
  {
    "path": "SourceryFramework/Sources/Parsing/SwiftSyntax/AST/Struct+SwiftSyntax.swift",
    "chars": 1578,
    "preview": "import Foundation\nimport SourceryRuntime\nimport SwiftSyntax\n\nextension Struct {\n    convenience init(_ node: StructDeclS"
  },
  {
    "path": "SourceryFramework/Sources/Parsing/SwiftSyntax/AST/Subscript+SwiftSyntax.swift",
    "chars": 4647,
    "preview": "import Foundation\nimport SwiftSyntax\nimport SourceryRuntime\n\nextension Subscript {\n    convenience init(_ node: Subscrip"
  },
  {
    "path": "SourceryFramework/Sources/Parsing/SwiftSyntax/AST/Type+SwiftSyntax.swift",
    "chars": 450,
    "preview": "import Foundation\nimport SourceryRuntime\nimport SwiftSyntax\n\nextension Type {\n    convenience init?(_ node: TypeSyntax) "
  },
  {
    "path": "SourceryFramework/Sources/Parsing/SwiftSyntax/AST/TypeName+SwiftSyntax.swift",
    "chars": 16976,
    "preview": "import Foundation\nimport SourceryRuntime\nimport SwiftSyntax\n\nextension SyntaxProtocol {\n    @inlinable\n    var sourceryS"
  },
  {
    "path": "SourceryFramework/Sources/Parsing/SwiftSyntax/AST/Variable+SwiftSyntax.swift",
    "chars": 5696,
    "preview": "import Foundation\nimport SourceryRuntime\nimport SwiftSyntax\n\nextension Variable {\n    convenience init(\n      _ node: Pa"
  },
  {
    "path": "SourceryFramework/Sources/Parsing/SwiftSyntax/FileParserSyntax.swift",
    "chars": 2789,
    "preview": "import Foundation\nimport SwiftSyntax\nimport SwiftParser\nimport PathKit\nimport SourceryRuntime\nimport SourceryUtils\n\npubl"
  },
  {
    "path": "SourceryFramework/Sources/Parsing/SwiftSyntax/Syntax+Extensions.swift",
    "chars": 1338,
    "preview": "import SwiftSyntax\n\npublic extension TriviaPiece {\n    /// Returns string value of a comment piece or nil otherwise\n    "
  },
  {
    "path": "SourceryFramework/Sources/Parsing/SwiftSyntax/SyntaxTreeCollector.swift",
    "chars": 13842,
    "preview": "import SwiftSyntax\nimport SourceryRuntime\nimport SourceryUtils\nimport Foundation\n\nclass SyntaxTreeCollector: SyntaxVisit"
  },
  {
    "path": "SourceryFramework/Sources/Parsing/Utils/AnnotationsParser.swift",
    "chars": 23251,
    "preview": "//\n// Created by Krzysztof Zablocki on 31/12/2016.\n// Copyright (c) 2016 Pixle. All rights reserved.\n//\n\nimport Foundati"
  },
  {
    "path": "SourceryFramework/Sources/Parsing/Utils/Bridges.swift",
    "chars": 538,
    "preview": "import Foundation\n\nextension Array {\n    public func bridge() -> NSArray {\n        return self as NSArray\n    }\n}\n\nexten"
  },
  {
    "path": "SourceryFramework/Sources/Parsing/Utils/InlineParser.swift",
    "chars": 4284,
    "preview": "//\n// Created by Krzysztof Zablocki on 16/01/2017.\n// Copyright (c) 2017 Pixle. All rights reserved.\n//\n\nimport Foundati"
  },
  {
    "path": "SourceryFramework/Sources/Parsing/Utils/StringView.swift",
    "chars": 18841,
    "preview": "import Foundation\nimport SwiftSyntax\n\n// Represents the number of bytes in a string. Could be used to model offsets into"
  },
  {
    "path": "SourceryFramework/Sources/Parsing/Utils/Verifier.swift",
    "chars": 1170,
    "preview": "//\n// Created by Krzysztof Zablocki on 23/01/2017.\n// Copyright (c) 2017 Pixle. All rights reserved.\n//\n\nimport Foundati"
  },
  {
    "path": "SourceryFramework.podspec",
    "chars": 1103,
    "preview": "Pod::Spec.new do |s|\n\n  s.name         = \"SourceryFramework\"\n  s.version      = \"2.3.0\"\n  s.summary      = \"A tool that "
  },
  {
    "path": "SourceryJS/Info.plist",
    "chars": 874,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "SourceryJS/Resources/ejs.js",
    "chars": 42335,
    "preview": "(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0)"
  },
  {
    "path": "SourceryJS/SourceryJS.h",
    "chars": 499,
    "preview": "//\n//  SourceryJS.h\n//  SourceryJS\n//\n//  Created by Ilya Puchka on 25/01/2018.\n//  Copyright © 2018 Pixle. All rights r"
  },
  {
    "path": "SourceryJS/Sources/EJSTemplate+Tests.swift",
    "chars": 5244,
    "preview": "// swift test runs tests in DEBUG, thus this file will only be compiled for `swift test`\n#if canImport(ObjectiveC) && DE"
  },
  {
    "path": "SourceryJS/Sources/EJSTemplate.swift",
    "chars": 4463,
    "preview": "#if canImport(ObjectiveC) && !DEBUG\nimport JavaScriptCore\nimport PathKit\n\nprivate extension Foundation.Bundle {\n    /// "
  },
  {
    "path": "SourceryRuntime/Sources/Common/AST/AccessLevel.swift",
    "chars": 379,
    "preview": "//\n// Created by Krzysztof Zablocki on 13/09/2016.\n// Copyright (c) 2016 Pixle. All rights reserved.\n//\n\nimport Foundati"
  },
  {
    "path": "SourceryRuntime/Sources/Common/AST/Actor.swift",
    "chars": 3806,
    "preview": "import Foundation\n\n// sourcery: skipDescription\n/// Descibes Swift actor\n#if canImport(ObjectiveC)\n@objc(SwiftActor) @ob"
  },
  {
    "path": "SourceryRuntime/Sources/Common/AST/Annotations.swift",
    "chars": 704,
    "preview": "import Foundation\n\npublic typealias Annotations = [String: NSObject]\n\n/// Describes annotated declaration, i.e. type, me"
  },
  {
    "path": "SourceryRuntime/Sources/Common/AST/Attribute.swift",
    "chars": 7627,
    "preview": "import Foundation\n\n/// Describes Swift attribute\n#if canImport(ObjectiveC)\n@objcMembers\n#endif\npublic class Attribute: N"
  },
  {
    "path": "SourceryRuntime/Sources/Common/AST/Class.swift",
    "chars": 3559,
    "preview": "import Foundation\n// sourcery: skipDescription\n/// Descibes Swift class\n#if canImport(ObjectiveC)\n@objc(SwiftClass) @obj"
  },
  {
    "path": "SourceryRuntime/Sources/Common/AST/Definition.swift",
    "chars": 708,
    "preview": "import Foundation\n\n/// Describes that the object is defined in a context of some `Type`\npublic protocol Definition: AnyO"
  },
  {
    "path": "SourceryRuntime/Sources/Common/AST/Documentation.swift",
    "chars": 225,
    "preview": "import Foundation\n\npublic typealias Documentation = [String]\n\n/// Describes a declaration with documentation, i.e. type,"
  },
  {
    "path": "SourceryRuntime/Sources/Common/AST/Import.swift",
    "chars": 2873,
    "preview": "import Foundation\n\n/// Defines import type\n#if canImport(ObjectiveC)\n@objcMembers\n#endif\npublic class Import: NSObject, "
  },
  {
    "path": "SourceryRuntime/Sources/Common/AST/Modifier.swift",
    "chars": 2699,
    "preview": "import Foundation\n\npublic typealias SourceryModifier = Modifier\n/// modifier can be thing like `private`, `class`, `nonm"
  },
  {
    "path": "SourceryRuntime/Sources/Common/AST/PhantomProtocols.swift",
    "chars": 625,
    "preview": "//\n// Created by Krzysztof Zablocki on 23/01/2017.\n// Copyright (c) 2017 Pixle. All rights reserved.\n//\n\nimport Foundati"
  },
  {
    "path": "SourceryRuntime/Sources/Common/AST/Protocol.swift",
    "chars": 4855,
    "preview": "//\n//  Protocol.swift\n//  Sourcery\n//\n//  Created by Krzysztof Zablocki on 09/12/2016.\n//  Copyright © 2016 Pixle. All r"
  },
  {
    "path": "SourceryRuntime/Sources/Common/AST/ProtocolComposition.swift",
    "chars": 4580,
    "preview": "// Created by eric_horacek on 2/12/20.\n// Copyright © 2020 Airbnb Inc. All rights reserved.\n\nimport Foundation\n\n/// Desc"
  },
  {
    "path": "SourceryRuntime/Sources/Common/AST/Struct.swift",
    "chars": 3488,
    "preview": "//\n//  Struct.swift\n//  Sourcery\n//\n//  Created by Krzysztof Zablocki on 13/09/2016.\n//  Copyright © 2016 Pixle. All rig"
  },
  {
    "path": "SourceryRuntime/Sources/Common/AST/TypeName/Array.swift",
    "chars": 3784,
    "preview": "import Foundation\n\n/// Describes array type\n#if canImport(ObjectiveC)\n@objcMembers \n#endif\npublic final class ArrayType:"
  },
  {
    "path": "SourceryRuntime/Sources/Common/AST/TypeName/Dictionary.swift",
    "chars": 5023,
    "preview": "import Foundation\n\n/// Describes dictionary type\n#if canImport(ObjectiveC)\n@objcMembers\n#endif\npublic final class Dictio"
  },
  {
    "path": "SourceryRuntime/Sources/Common/AST/TypeName/Generic.swift",
    "chars": 3058,
    "preview": "import Foundation\n\n/// Descibes Swift generic type\n#if canImport(ObjectiveC)\n@objcMembers\n#endif\npublic final class Gene"
  },
  {
    "path": "SourceryRuntime/Sources/Common/AST/TypeName/Set.swift",
    "chars": 3750,
    "preview": "import Foundation\n\n/// Describes set type\n#if canImport(ObjectiveC)\n@objcMembers\n#endif\npublic final class SetType: NSOb"
  },
  {
    "path": "SourceryRuntime/Sources/Common/AST/TypeName/Typed.swift",
    "chars": 777,
    "preview": "import Foundation\n\n/// Descibes typed declaration, i.e. variable, method parameter, tuple element, enum case associated "
  },
  {
    "path": "SourceryRuntime/Sources/Common/AST/Typealias.swift",
    "chars": 8296,
    "preview": "import Foundation\n\n/// :nodoc:\n#if canImport(ObjectiveC)\n@objcMembers\n#endif\npublic final class Typealias: NSObject, Typ"
  },
  {
    "path": "SourceryRuntime/Sources/Common/Array+Parallel.swift",
    "chars": 1043,
    "preview": "//\n// Created by Krzysztof Zablocki on 06/01/2017.\n// Copyright (c) 2017 Pixle. All rights reserved.\n//\n\nimport Foundati"
  },
  {
    "path": "SourceryRuntime/Sources/Common/BytesRange.swift",
    "chars": 2448,
    "preview": "//\n//  Created by Sébastien Duperron on 03/01/2018.\n//  Copyright © 2018 Pixle. All rights reserved.\n//\n\nimport Foundati"
  },
  {
    "path": "SourceryRuntime/Sources/Common/Composer/Composer.swift",
    "chars": 12803,
    "preview": "//\n// Created by Krzysztof Zablocki on 31/12/2016.\n// Copyright (c) 2016 Pixle. All rights reserved.\n//\n\nimport Foundati"
  },
  {
    "path": "SourceryRuntime/Sources/Common/Composer/ParserResultsComposed.swift",
    "chars": 33862,
    "preview": "//\n// Created by Krzysztof Zablocki on 31/12/2016.\n// Copyright (c) 2016 Pixle. All rights reserved.\n//\n\nimport Foundati"
  },
  {
    "path": "SourceryRuntime/Sources/Common/Diffable.swift",
    "chars": 7439,
    "preview": "//\n//  Diffable.swift\n//  Sourcery\n//\n//  Created by Krzysztof Zabłocki on 22/12/2016.\n//  Copyright © 2016 Pixle. All r"
  },
  {
    "path": "SourceryRuntime/Sources/Common/Extensions.swift",
    "chars": 8047,
    "preview": "import Foundation\n\npublic extension StringProtocol {\n    /// Trimms leading and trailing whitespaces and newlines\n    va"
  },
  {
    "path": "SourceryRuntime/Sources/Common/FileParserResult.swift",
    "chars": 9256,
    "preview": "//\n//  FileParserResult.swift\n//  Sourcery\n//\n//  Created by Krzysztof Zablocki on 11/01/2017.\n//  Copyright © 2017 Pixl"
  },
  {
    "path": "SourceryRuntime/Sources/Common/Log.swift",
    "chars": 3118,
    "preview": "//import Darwin\nimport Foundation\n\n/// :nodoc:\npublic enum Log {\n    public struct Configuration {\n        let isDryRun:"
  },
  {
    "path": "SourceryRuntime/Sources/Common/TemplateContext.swift",
    "chars": 5946,
    "preview": "//\n// Created by Krzysztof Zablocki on 31/12/2016.\n// Copyright (c) 2016 Pixle. All rights reserved.\n//\n\nimport Foundati"
  },
  {
    "path": "SourceryRuntime/Sources/Generated/AutoHashable.generated.swift",
    "chars": 215,
    "preview": "// Generated using Sourcery 1.3.1 — https://github.com/krzysztofzablocki/Sourcery\n// DO NOT EDIT\n// swiftlint:disable al"
  },
  {
    "path": "SourceryRuntime/Sources/Generated/Coding.generated.swift",
    "chars": 2055,
    "preview": "// Generated using Sourcery 2.2.6 — https://github.com/krzysztofzablocki/Sourcery\n// DO NOT EDIT\n// swiftlint:disable ve"
  },
  {
    "path": "SourceryRuntime/Sources/Generated/JSExport.generated.swift",
    "chars": 25482,
    "preview": "// Generated using Sourcery 2.2.6 — https://github.com/krzysztofzablocki/Sourcery\n// DO NOT EDIT\n// swiftlint:disable ve"
  },
  {
    "path": "SourceryRuntime/Sources/Generated/Typed.generated.swift",
    "chars": 8603,
    "preview": "// Generated using Sourcery 2.2.6 — https://github.com/krzysztofzablocki/Sourcery\n// DO NOT EDIT\n// swiftlint:disable ve"
  },
  {
    "path": "SourceryRuntime/Sources/Linux/AST/AssociatedType_Linux.swift",
    "chars": 3348,
    "preview": "#if !canImport(ObjectiveC)\nimport Foundation\n\n/// Describes Swift AssociatedType\npublic final class AssociatedType: NSOb"
  },
  {
    "path": "SourceryRuntime/Sources/Linux/AST/AssociatedValue_Linux.swift",
    "chars": 6937,
    "preview": "//\n// Created by Krzysztof Zablocki on 13/09/2016.\n// Copyright (c) 2016 Pixle. All rights reserved.\n//\n#if !canImport(O"
  },
  {
    "path": "SourceryRuntime/Sources/Linux/AST/ClosureParameter_Linux.swift",
    "chars": 6735,
    "preview": "#if !canImport(ObjectiveC)\nimport Foundation\n\n// sourcery: skipDiffing\npublic final class ClosureParameter: NSObject, So"
  },
  {
    "path": "SourceryRuntime/Sources/Linux/AST/EnumCase_Linux.swift",
    "chars": 7235,
    "preview": "//\n// Created by Krzysztof Zablocki on 13/09/2016.\n// Copyright (c) 2016 Pixle. All rights reserved.\n//\n#if !canImport(O"
  },
  {
    "path": "SourceryRuntime/Sources/Linux/AST/Enum_Linux.swift",
    "chars": 6717,
    "preview": "//\n// Created by Krzysztof Zablocki on 13/09/2016.\n// Copyright (c) 2016 Pixle. All rights reserved.\n//\n\n#if !canImport("
  },
  {
    "path": "SourceryRuntime/Sources/Linux/AST/GenericParameter_Linux.swift",
    "chars": 3131,
    "preview": "#if !canImport(ObjectiveC)\nimport Foundation\n\n/// Descibes Swift generic parameter\npublic final class GenericParameter: "
  },
  {
    "path": "SourceryRuntime/Sources/Linux/AST/GenericRequirement_Linux.swift",
    "chars": 5860,
    "preview": "#if !canImport(ObjectiveC)\nimport Foundation\n\n/// Descibes Swift generic requirement\npublic class GenericRequirement: NS"
  },
  {
    "path": "SourceryRuntime/Sources/Linux/AST/MethodParameter_Linux.swift",
    "chars": 9577,
    "preview": "#if !canImport(ObjectiveC)\nimport Foundation\n\n/// Describes method parameter\npublic class MethodParameter: NSObject, Sou"
  },
  {
    "path": "SourceryRuntime/Sources/Linux/AST/Method_Linux.swift",
    "chars": 24310,
    "preview": "#if !canImport(ObjectiveC)\nimport Foundation\n\n/// :nodoc:\npublic typealias SourceryMethod = Method\n\n/// Describes method"
  },
  {
    "path": "SourceryRuntime/Sources/Linux/AST/Protocol_Linux.swift",
    "chars": 5101,
    "preview": "//\n//  Protocol.swift\n//  Sourcery\n//\n//  Created by Krzysztof Zablocki on 09/12/2016.\n//  Copyright © 2016 Pixle. All r"
  },
  {
    "path": "SourceryRuntime/Sources/Linux/AST/Subscript_Linux.swift",
    "chars": 18745,
    "preview": "#if !canImport(ObjectiveC)\nimport Foundation\n\n/// Describes subscript\npublic final class Subscript: NSObject, SourceryMo"
  },
  {
    "path": "SourceryRuntime/Sources/Linux/AST/TypeName/Closure_Linux.swift",
    "chars": 10080,
    "preview": "#if !canImport(ObjectiveC)\nimport Foundation\n\n/// Describes closure type\npublic final class ClosureType: NSObject, Sourc"
  },
  {
    "path": "SourceryRuntime/Sources/Linux/AST/TypeName/GenericTypeParameter_Linux.swift",
    "chars": 2772,
    "preview": "#if !canImport(ObjectiveC)\nimport Foundation\n\n/// Descibes Swift generic type parameter\npublic final class GenericTypePa"
  },
  {
    "path": "SourceryRuntime/Sources/Linux/AST/TypeName/Tuple_Linux.swift",
    "chars": 7011,
    "preview": "#if !canImport(ObjectiveC)\nimport Foundation\n\n/// Describes tuple type\npublic final class TupleType: NSObject, SourceryM"
  },
  {
    "path": "SourceryRuntime/Sources/Linux/AST/TypeName/TypeName_Linux.swift",
    "chars": 14139,
    "preview": "//\n// Created by Krzysztof Zabłocki on 25/12/2016.\n// Copyright (c) 2016 Pixle. All rights reserved.\n//\n#if !canImport(O"
  },
  {
    "path": "SourceryRuntime/Sources/Linux/AST/Type_Linux.swift",
    "chars": 37027,
    "preview": "//\n// Created by Krzysztof Zablocki on 11/09/2016.\n// Copyright (c) 2016 Pixle. All rights reserved.\n//\n#if !canImport(O"
  },
  {
    "path": "SourceryRuntime/Sources/Linux/AST/Variable_Linux.swift",
    "chars": 17022,
    "preview": "//\n// Created by Krzysztof Zablocki on 13/09/2016.\n// Copyright (c) 2016 Pixle. All rights reserved.\n//\n#if !canImport(O"
  },
  {
    "path": "SourceryRuntime/Sources/Linux/DynamicMemberLookup_Linux.swift",
    "chars": 1129,
    "preview": "//\n// Stencil\n// Copyright © 2022 Stencil\n// MIT Licence\n//\n\n#if !canImport(ObjectiveC)\n#if canImport(Stencil)\nimport St"
  },
  {
    "path": "SourceryRuntime/Sources/Linux/NSException_Linux.swift",
    "chars": 447,
    "preview": "#if !canImport(ObjectiveC)\nimport Foundation\n\npublic class NSException {\n    static func raise(_ name: String, format: S"
  },
  {
    "path": "SourceryRuntime/Sources/Linux/TypesCollection_Linux.swift",
    "chars": 2242,
    "preview": "//\n// Created by Krzysztof Zablocki on 31/12/2016.\n// Copyright (c) 2016 Pixle. All rights reserved.\n//\n#if !canImport(O"
  },
  {
    "path": "SourceryRuntime/Sources/Linux/Types_Linux.swift",
    "chars": 7681,
    "preview": "//\n// Created by Krzysztof Zablocki on 31/12/2016.\n// Copyright (c) 2016 Pixle. All rights reserved.\n//\n#if !canImport(O"
  },
  {
    "path": "SourceryRuntime/Sources/macOS/AST/AssociatedType.swift",
    "chars": 2972,
    "preview": "#if canImport(ObjectiveC)\nimport Foundation\n\n/// Describes Swift AssociatedType\n@objcMembers\npublic final class Associat"
  },
  {
    "path": "SourceryRuntime/Sources/macOS/AST/AssociatedValue.swift",
    "chars": 5857,
    "preview": "//\n// Created by Krzysztof Zablocki on 13/09/2016.\n// Copyright (c) 2016 Pixle. All rights reserved.\n//\n#if canImport(Ob"
  },
  {
    "path": "SourceryRuntime/Sources/macOS/AST/ClosureParameter.swift",
    "chars": 6162,
    "preview": "#if canImport(ObjectiveC)\nimport Foundation\n\n// sourcery: skipDiffing\n@objcMembers\npublic final class ClosureParameter: "
  },
  {
    "path": "SourceryRuntime/Sources/macOS/AST/Enum.swift",
    "chars": 6432,
    "preview": "//\n// Created by Krzysztof Zablocki on 13/09/2016.\n// Copyright (c) 2016 Pixle. All rights reserved.\n//\n\n#if canImport(O"
  },
  {
    "path": "SourceryRuntime/Sources/macOS/AST/EnumCase.swift",
    "chars": 6628,
    "preview": "//\n// Created by Krzysztof Zablocki on 13/09/2016.\n// Copyright (c) 2016 Pixle. All rights reserved.\n//\n#if canImport(Ob"
  },
  {
    "path": "SourceryRuntime/Sources/macOS/AST/GenericParameter.swift",
    "chars": 2791,
    "preview": "#if canImport(ObjectiveC)\nimport Foundation\n\n/// Descibes Swift generic parameter\n@objcMembers\npublic final class Generi"
  },
  {
    "path": "SourceryRuntime/Sources/macOS/AST/GenericRequirement.swift",
    "chars": 5378,
    "preview": "#if canImport(ObjectiveC)\nimport Foundation\n\n/// Descibes Swift generic requirement\n@objcMembers\npublic class GenericReq"
  },
  {
    "path": "SourceryRuntime/Sources/macOS/AST/Method.swift",
    "chars": 22812,
    "preview": "#if canImport(ObjectiveC)\nimport Foundation\n\n/// :nodoc:\npublic typealias SourceryMethod = Method\n\n/// Describes method\n"
  },
  {
    "path": "SourceryRuntime/Sources/macOS/AST/MethodParameter.swift",
    "chars": 8806,
    "preview": "#if canImport(ObjectiveC)\nimport Foundation\n\n/// Describes method parameter\n@objcMembers\npublic class MethodParameter: N"
  },
  {
    "path": "SourceryRuntime/Sources/macOS/AST/Subscript.swift",
    "chars": 16831,
    "preview": "#if canImport(ObjectiveC)\nimport Foundation\n\n/// Describes subscript\n@objcMembers\npublic final class Subscript: NSObject"
  },
  {
    "path": "SourceryRuntime/Sources/macOS/AST/Type.swift",
    "chars": 35868,
    "preview": "//\n// Created by Krzysztof Zablocki on 11/09/2016.\n// Copyright (c) 2016 Pixle. All rights reserved.\n//\n#if canImport(Ob"
  },
  {
    "path": "SourceryRuntime/Sources/macOS/AST/TypeName/Closure.swift",
    "chars": 8819,
    "preview": "#if canImport(ObjectiveC)\nimport Foundation\n\n/// Describes closure type\n@objcMembers\npublic final class ClosureType: NSO"
  },
  {
    "path": "SourceryRuntime/Sources/macOS/AST/TypeName/GenericTypeParameter.swift",
    "chars": 2450,
    "preview": "#if canImport(ObjectiveC)\nimport Foundation\n\n/// Descibes Swift generic type parameter\n@objcMembers\npublic final class G"
  },
  {
    "path": "SourceryRuntime/Sources/macOS/AST/TypeName/Tuple.swift",
    "chars": 6368,
    "preview": "#if canImport(ObjectiveC)\nimport Foundation\n\n/// Describes tuple type\n@objcMembers\npublic final class TupleType: NSObjec"
  },
  {
    "path": "SourceryRuntime/Sources/macOS/AST/TypeName/TypeName.swift",
    "chars": 13235,
    "preview": "//\n// Created by Krzysztof Zabłocki on 25/12/2016.\n// Copyright (c) 2016 Pixle. All rights reserved.\n//\n#if canImport(Ob"
  },
  {
    "path": "SourceryRuntime/Sources/macOS/AST/Variable.swift",
    "chars": 16189,
    "preview": "//\n// Created by Krzysztof Zablocki on 13/09/2016.\n// Copyright (c) 2016 Pixle. All rights reserved.\n//\n#if canImport(Ob"
  },
  {
    "path": "SourceryRuntime/Sources/macOS/Types.swift",
    "chars": 6878,
    "preview": "//\n// Created by Krzysztof Zablocki on 31/12/2016.\n// Copyright (c) 2016 Pixle. All rights reserved.\n//\n\n#if canImport(O"
  },
  {
    "path": "SourceryRuntime/Sources/macOS/TypesCollection.swift",
    "chars": 2220,
    "preview": "//\n// Created by Krzysztof Zablocki on 31/12/2016.\n// Copyright (c) 2016 Pixle. All rights reserved.\n//\n#if canImport(Ob"
  },
  {
    "path": "SourceryRuntime/Supporting Files/Info.plist",
    "chars": 853,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "SourceryRuntime/Supporting Files/SourceryRuntime.h",
    "chars": 391,
    "preview": "#import <Cocoa/Cocoa.h>\n\n//! Project version number for SourceryRuntime.\nFOUNDATION_EXPORT double SourceryRuntimeVersion"
  },
  {
    "path": "SourceryRuntime.podspec",
    "chars": 1066,
    "preview": "Pod::Spec.new do |s|\n\n  s.name         = \"SourceryRuntime\"\n  s.version      = \"2.3.0\"\n  s.summary      = \"A tool that br"
  },
  {
    "path": "SourceryStencil/Info.plist",
    "chars": 852,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "SourceryStencil/SourceryStencil.h",
    "chars": 538,
    "preview": "//\n//  SourceryStencil.h\n//  SourceryStencil\n//\n//  Created by merowing on 3/19/21.\n//  Copyright © 2021 Pixle. All righ"
  },
  {
    "path": "SourceryStencil/Sources/NewLineNode.swift",
    "chars": 730,
    "preview": "import Stencil\n\nclass NewLineNode: NodeType {\n    static let marker = \"__sourcery__newline__\"\n    enum Content {\n       "
  },
  {
    "path": "SourceryStencil/Sources/StencilTemplate.swift",
    "chars": 20087,
    "preview": "import Foundation\nimport Stencil\nimport PathKit\nimport StencilSwiftKit\nimport SourceryRuntime\n\npublic final class Stenci"
  },
  {
    "path": "SourceryStencil/Sources/TypedNode.swift",
    "chars": 1291,
    "preview": "import Stencil\n\nextension Array {\n    func chunked(into size: Int) -> [[Element]] {\n        return stride(from: 0, to: c"
  },
  {
    "path": "SourcerySwift/Info.plist",
    "chars": 874,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "SourcerySwift/SourcerySwift.h",
    "chars": 520,
    "preview": "//\n//  SourcerySwift.h\n//  SourcerySwift\n//\n//  Created by Ilya Puchka on 29/01/2018.\n//  Copyright © 2018 Pixle. All ri"
  },
  {
    "path": "SourcerySwift/Sources/SourceryRuntime.content.generated.swift",
    "chars": 360680,
    "preview": "#if canImport(ObjectiveC)\nlet sourceryRuntimeFiles: [FolderSynchronizer.File] = [\n    .init(name: \"AccessLevel.swift\", c"
  },
  {
    "path": "SourcerySwift/Sources/SourceryRuntime_Linux.content.generated.swift",
    "chars": 381575,
    "preview": "#if !canImport(ObjectiveC)\nlet sourceryRuntimeFiles: [FolderSynchronizer.File] = [\n    .init(name: \"AccessLevel.swift\", "
  },
  {
    "path": "SourcerySwift/Sources/SwiftTemplate.swift",
    "chars": 18983,
    "preview": "//\n//  SwiftTemplate.swift\n//  Sourcery\n//\n//  Created by Krunoslav Zaher on 12/30/16.\n//  Copyright © 2016 Pixle. All r"
  },
  {
    "path": "SourceryTests/ConfigurationSpec.swift",
    "chars": 16546,
    "preview": "import Quick\nimport Nimble\nimport PathKit\n#if SWIFT_PACKAGE\n@testable import SourceryLib\n#else\n@testable import Sourcery"
  }
]

// ... and 353 more files (download for full content)

About this extraction

This page contains the full source code of the krzysztofzablocki/Sourcery GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 553 files (4.7 MB), approximately 1.3M tokens, and a symbol index with 74 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!