18 Commits
Author SHA1 Message Date
swiftty bcd00412b3 Use withExtendedLifetime 2025-05-20 15:26:06 +09:00
Rafal Sroka c6fde60f5a Revert df3936e292 (#1413) to allow for releasing 2025-05-13 22:42:00 +02:00
Krzysztof Zabłocki df3936e292 Merge pull request #1413 from krzysztofzablocki:feature/keep-alive
chore: keep alive properly
2025-05-08 13:54:00 +02:00
Krzysztof Zabłocki 012f281490 chore: keep alive properly 2025-05-08 13:48:42 +02:00
Ilya Kharlamov 3d3a2be0dc Ability to use custom header prefix (#1389) 2024-12-18 15:49:28 +01:00
Ruslan Alikhamov 53c1f8f33a Improved Logging/Error Handling during SwiftTemplate Processing (#1320)
* Improved logging for SwiftTemplate processing;

Added more logs for time measurement in SwiftTemplate; added a note how exactly cacheKey is calculated and it's intended usage; added possibility to pass Log configuration when using SourceryLib instead of executable for logging setup.

* update internal boilerplate code.

* Fixed failing tests
2024-03-30 21:51:17 +04:00
David Cacenabes 33be2ab2ad Remove Sourcery version from header (#1309)
* Remove version from headers

* Remove from generated files

* Revert "Remove from generated files"

This reverts commit 9a8c14e430.

* Revert "Remove version from headers"

This reverts commit 93ddd54fd9.

* Add support to hide header via config

* Remove redundant self

* Make non-lazy
2024-03-26 10:09:02 +04:00
MontakOleg b37ea718c0 Format processing time log message (#1274) 2024-02-16 17:24:47 +01:00
Ruslan Alikhamov ba63cd6b84 Linux Support (#1188)
* work in progress

* More conditional checks, less errors

* Further steps onto successful compilation

* Enabled try-catch back for macOS

* reverted redundant change

* Replaced getVaList with recommended withVaList

* Update FileParser + AttributesModifierSpec.swift

fixed wrong find-replace

* added missing import of CDispatch

* enabled fatalError instead of NSException

* enabled value(forKey:) for TypesCollection type

* removed commented import

* enabled sha256 for macOS

* Enabled sha256 hashing for Linux

* disabled JavaScriptTemplate tests under Linux

* added check for vendor for tests

* disabled value(forKeyPath:) calls under Linux

* reverted redundant gem

* Fixed issue with `swift test` not finding .ejs bundle

* removed commented code

* switched to `swift test`

* enabled GH actions

* Temporary check for installed Xcodes - Update swift.yml

* Temporary checking Xcode versions - Update swift.yml

* Temporary setting Xcode version - Update swift.yml

* Temporary remove custom Ruby installation - Update swift.yml

* Removed spaces from filenames

* removed + from filenames

* Added -enable-testing for all test targets

* Try Xcode 15 beta

* trying to generate LinuxMain

* refactoring

* running a test for test of a test

* set SPM version to 5.8

* added tests to LinuxMain.swift

* removed redundantly disabled code

* fixed wrong ifdef

* Moved diffable implementation to definitions

* fixed failing UTs

* replaced os(macOS) with canImport(ObjectiveC)

* replaced more os(macOS) with canImport(ObjectiveC)

* enabled filtering for sorted arrays on linux

* eliminating API unsupported by swift-corelibs-foundation

* enabled SourceryRuntime to compile under Linux

* isEqual overrides only for Darwin platforms

* Fixed all SourceryRuntime compilation errors; more green tests

* Disabled enum test case

* moved isEqual to definitions

* fatalError when DynamicMemberLookup fails

* disabled failing test

* disabled crashing test in DryOutputSpec

* Fixed more unit tests

* Fixed typo

* Added best effort sorting filter

* added missing dynamic member lookups

* Added missing dynamic member lookup

* fixed compilation error

* Take into account 1-off linebreak issue between Linux and macOS

* Removed diffable from content generation due to new structure

* added missing dynamic member lookups

* Added missing dynamic member lookup

* moving hashing into class definitions

* Moved description and hash into class definitions

* Added DynamicMemberLookup definition for SourceryRuntime

* Added comment why import Stencil is needed

* Added missing dynamic member lookup

* Removed redundant imports

* Fixed failing tests

* Adjusted test expectation for Linux

* Fixed SourcerySpec template combining test

* Temporary commit for CI verification

* Adjusted SwiftTemplateSpecs tests for Linux

* reverted redundant change

* enable more linux tests for CI verification

* Adjusted CodableContextTests for Linux

* Added more tests that are green

* enabled all tests except 3

* Remove verbosity from CI build

* Removed redundant steps from CI

* Reverted redundant change

* Testing job cancellation

* Added new dynamic member lookup to generated sources [no ci]

* Added different TypesCollection definition for Linux

* Make TypesCollection conform to DynamicMemberLookup only on Linux

* Moved TypesCollection to separate generated source file

* Moved Type to separate file for Linux

* Split GitHub actions

* removed common GH action

* added separate file for Variable on linux

* removed DynamicMemberLookup conformance on macOS

* removed @objc conditions on Linux

* Temporary commit to fix build error

* moved NSException workaround to separate file

* Fixed compiler warning

* moved Types to a separate file

* moved generated Types to a separate file

* split Enum.swift into separate files

* removed redundant imports

* added missing import

* Removed redundant import

* Split Method into separate files

* Added DynamicMemberLookup to Method on Linux [no ci]

* removed redundant override

* added badges for GH Actions

* Fixed failing test on macOS

* Split Tuple into separate files for Linux

* Split EnumCase into separate file for DynamicMemberLookup on Linux

* Enabled GeneratorSpec tests

* Added missing lookup member

* Fixed SourcerySpecTests

* enabled SourcerySpec tests

* Added missing lookup member

* call runCLI on Linux

* Disabled codegen for Sourcery

* Added missing member lookup

* Added missing members lookup

* renamed Linux to include experimental

* Added missing member lookups

* Added missing import

* Adjusted padding [no ci]

* Added missing member lookups

* Adjusted padding [no ci]

* Disabled Codable tests on Linux

* enabled all tests classes under Linux

* Added AssociatedValue for Linux

* Added missing member lookups

* Changed resource copy path in TemplatesTests for Linux

* Updated CHANGELOG

* Added LINUX.md

* Added references to README and LINUX

* Updated content.generated files

* Fixed a typo [no ci]

* Changed wording related to @objc attribute

* Use currentTimestamp() instead of Date().timeIntervalSince1970

* Returned guard statements; removed default values from EJSTemplate
2023-09-07 23:27:22 +04:00
sam woolf e4e39715b4 Add a new command line argument to allow setting an optional build directory for .swifttemplates (#1147)
* add optional build directory argument

* Add to readme

* remove space
2023-02-28 12:23:20 +01:00
Krzysztof Zablocki 9b9dc0feda feat: add baseIndentation option 2023-01-19 10:44:26 +01:00
Lucky Rocky b9b5981d87 Dry run support (with json output) (#1097)
* dry run support

* added changelog description for dry flag

* remove debug print statement

* review fixes

fix SourceryRuntime generated files
fix changelog format
fix package.resolved changes
2022-09-29 17:47:16 +02:00
Pol Piella Abadia 368ae703b4 Adds cacheBasePath option to executable 2022-09-13 20:08:21 +01:00
Eric Horacek d64c263e0b Add a flag to parse serially (#1063)
* Don't parse in parallel

Parsing in parallel is leading to unexpected `EXC_BAD_ACCESS`es in our codebase.  By switching to `compactMap`, the crashes go away.

The specific crash is deep in the internals of `SwiftSyntax`, which leads me to believe that there's some internal global thread-unsafe state that's being shared bewteen parsing instances. Here's an example (abbreviated) stacktrace:
```
#0	0x00000001001209e4 in protocol witness for SyntaxProtocol._syntaxNode.getter in conformance Syntax ()
#1	0x0000000100121ec3 in SyntaxProtocol.raw.getter at /Users/eric_horacek/Library/Developer/Xcode/DerivedData/Sourcery-hibchsafsxkdcjaxxaylrbeyoydh/SourcePackages/checkouts/swift-syntax/Sources/SwiftSyntax/Syntax.swift:129
#2	0x0000000100b85c32 in SimpleTypeIdentifierSyntax.init(_:) at /Users/eric_horacek/Library/Developer/Xcode/DerivedData/Sourcery-hibchsafsxkdcjaxxaylrbeyoydh/SourcePackages/checkouts/swift-syntax/Sources/SwiftSyntax/gyb_generated/syntax_nodes/SyntaxTypeNodes.swift:68
#3	0x0000000100b89979 in protocol witness for SyntaxProtocol.init(_:) in conformance SimpleTypeIdentifierSyntax ()
#4	0x00000001001acab7 in TypeSyntax.as<τ_0_0>(_:) at /Users/eric_horacek/Library/Developer/Xcode/DerivedData/Sourcery-hibchsafsxkdcjaxxaylrbeyoydh/SourcePackages/checkouts/swift-syntax/Sources/SwiftSyntax/gyb_generated/SyntaxBaseNodes.swift:421
```

I was able to reproduce this in the debugger, but there was no information available with either TSAN or ASAN.

Fixes #1009.

I know that a lot of folks rely on the performance of parsing in parallel and it only seems to be crashing on our codebase, so perhaps we could put this behind an argument?

* Add back OSAtomicIncrement32 for numberOfFilesThatHadToBeParsed

* Add a configuration flag for parsing in serial

* Add changelog entry
2022-05-11 08:39:36 +02:00
Andrew CobbandKrzysztof Zabłocki 36adeacef3 Add support for parsing documentation comments on declarations (#1002)
* Add support for parsing documentation comments on declarations

* Update changelog

* Put documentation parsing behind a config flag

Co-authored-by: Krzysztof Zabłocki <krzysztof.zablocki@pixle.pl>
2021-12-09 15:59:15 +01:00
Rick M feeb0a3fbc Make --args usage more explicit (#1005)
* Make --args usage more explicit

* Minor grammatical improvement to --args docs
2021-10-24 15:54:47 +02:00
Krzysztof Zablocki 6ef751aeda feat: use file manager to automatically skip hidden files or package descendants, closes #883 2021-09-26 16:36:34 +02:00
Eugene Gubin 83fe75a562 Remove symlinks (#954)
* Remove symlinks. These can confuse Xcode.

* Exclude Info.plist-s from targets. No more warnings about unhandled files.

* Update Package.swift

* Update CHANGELOG.md
2021-05-05 09:09:54 +02:00