There is a failure after the attempt to launch SwiftGen by Mint.
mint run SwiftGen/SwiftGen
🌱 Finding latest version of SwiftGen
🌱 Resolved latest version of SwiftGen to 6.0.0
🌱 SwiftGen 6.0.0 already installed
🌱 Running swiftgen 6.0.0...
Unknown filter 'escapeReservedKeyword'. Found similar filters: 'escapeReservedKeywords'.
I've installed the libxml2 package (version 2.9.7).
The error is disappeared if I try to launch the brew version.
Thanks for reporting the issue!
That's strange, that error seems to suggest that the templates bundled via Mint are different from the ones bundled by brew, one using escapeReservedKeyword and the other using escapeReservedKeywords. Or maybe that's Mint & Brew not pointing to the same version of StencilSwiftKit (which is the pod where those filters are defined)… We'll need to investigate
The escapeReservedKeywords has always had that name, I don't think we've ever had that error?
@alphatroya are you using a custom template? I assume you're using a config file, could you post that please?
No, I use bundled templates, my config is here.
input_dir: Project/Resources/
output_dir: Project/Classes/UIKit/Extensions/
strings:
inputs: ru.lproj/Localizable.strings
outputs:
templateName: structured-swift4
output: Strings.swift
xcassets:
inputs: Assets.xcassets
outputs:
templateName: swift4
output: Images.swift
Which template is it failing on?
Both, error remains when I comment out strings or xcassets parts
mint run SwiftGen/[email protected] swiftgen --verbose
🌱 SwiftGen 6.0.0 already installed
🌱 Running swiftgen 6.0.0...
Executing configuration file swiftgen.yml
swiftgen xcassets -t swift4 -o Project/Classes/UIKit/Extensions/Images.swift Project/Resources/Assets.xcassets
Unknown filter 'escapeReservedKeyword'. Found similar filters: 'escapeReservedKeywords'.
mint run SwiftGen/[email protected] swiftgen --verbose
🌱 SwiftGen 6.0.0 already installed
🌱 Running swiftgen 6.0.0...
Executing configuration file swiftgen.yml
$ swiftgen strings -t structured-swift4 -o Project/Classes/UIKit/Extensions/Strings.swift Project/Resources/ru.lproj/Localizable.strings
Unknown filter 'escapeReservedKeyword'. Found similar filters: 'escapeReservedKeywords'.
Random idea @djbe : Maybe that's because Mint uses a different version of Stencil/StencilSwiftKit (if we forgot to update the Package.swift appropriately) and that version of Stencil includes a bug chopping off the last character of the filter (I remember seing a PR about something like this when there were no spaces between the filter name and the closing }}?)
That's just a thought, I haven't even looked at it, maybe I'm completely wrong, but maybe that's not the templates but the way they are parsed…
@alphatroya Could you run mint run SwiftGen/[email protected] swiftgen --version to show us the version of all our libs your install of SwiftGen is using? Thx
Ah, you're right, that might be it. The resolved version is Stencil 0.13.0, so we need to update that.
And since we don't run any SPM tests, we never caught this 😢
mint run SwiftGen/[email protected] swiftgen --version
🌱 SwiftGen 6.0.0 already installed
🌱 Running swiftgen 6.0.0...
SwiftGen v0.0 (Stencil v0.0, StencilSwiftKit v0.0, SwiftGenKit v0.0)
Oh boy, so that's broken as well.
I think those versions are broken because with SPM, there's no separate bundle for the frameworks (static libs).
I'm not sure how we'd fix the version information? If we somehow can add the version information for the other frameworks in __TEXT sections, we can then load them using https://stackoverflow.com/questions/39732016/calling-getsectiondata-from-swift.
@djbe that's actually what we already do… for the brew install step (since it uses our rake cli:install task which does that integration of the plist inside the binary during that process)
Not sure we can do the same with SPM as there's no possibility to execute post-install scripts in Package.swift afaik?
Maybe we can give some sort of linker flags?
I think to remember that passing custom linker flag was not supported… yet? But worth checking since it's been a while since I haven't followed what's new in SPM.
Another solution is to include the Info.plist as part of the Package.resources that Mint uses — and adapt the code to look at that if present…?
Info.plist and other plists as well.
I'm closing this as the "unknown filter error" has been fixed in #527, and opened #536 for the other issue of empty version on Mint install.
SwiftGen 6.0.1 is out, which includes the fix for that bug 🎉