New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New parser: file resources #734
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @mgray88 and thanks for the draft PR!
I know it's only a draft for now, but:
- Could you please add a description as to what this PR does?
- It seems to be an implementation of [Feature] General file resources from bundle #665 – which you've referenced in the title, tho honestly I missed it at first – but mentioning it in the PR description helps having GitHub cross-link the PR and issue. You might also want to cross-reference Add file names generator (nibs, plists, etc) #284.
Thx! 🙂
I'm running into the issue again where swiftlint is ignoring the |
I can take a look tomorrow (I'm on my phone rn) to check if it's indeed what I think it is, but it could be expected. Because we have a somewhat special setup for linting our template files Basically the way our linting script is set up on SwiftGen for the generated files in fixtures is that it intentionally removes the
I can get how this could be confusing and seem convoluted 😅 (we should definitively document that special setup in our CONTRIBUTING.md btw…). But that's the way we found to both disable swiftlint for end users of our templates while still be able to lint those templates for ourselves when working on SwiftGen — to ensure they are at least consistent with our style rules. [EDIT] If you're curious, here is where the magic happens |
- Add `path` and `mimeType` to `File` type - Recursively parse files - Start writing tests for parser
Gotcha. That all makes sense. I did notice the |
Yes it does force-lint (= remove disable:all before linting) everything under Did you use the "Generate Outputs" Xcode scheme to auto-generate those fixtures from the templates (so that they can then be used by our unit tests)? Or did you write them by hand? |
Hey 👋 I'm Eve, the friendly bot watching over SwiftGen 🤖 Thanks a lot for your contribution! Seems like everything is in order 👍 You did a good job here! 🤝 Generated by 🚫 Danger |
Can anyone provide insight on why the lint task is failing? All it says is
|
@AliSoftware @djbe Will the cli additions need to be included with this PR or a new one? I'm also working on writing up some of the documentation |
I've implemented the filter changes I mentioned in one of my previous review comments, it was really needed (I think) because the old code would just go through all the files/children of a folder without applying the filter anymore. Does this matter for basic extension regexes? No. But it might've mattered for more complex cases 🤷 As discussed I've applied the other changes as well. The end result is that this parser is kind of like a mix of the Fonts and Strings parsers. Future PRs could add extra accessors/methods depending on the file mime-type, a bit like the XCAssets templates right now. |
@djbe I'm glad you were able to get these changes in, work's been hectic on my end. I think it definitely looks much better. I did notice a few things in the new swift4 docs that still referenced swift5, or other files they were probably copied from |
Co-authored-by: Michael Gray <mgray88@gmail.com>
Any news on this? Looking forward to it 🙂 |
# Conflicts: # .swiftpm/xcode/xcshareddata/xcschemes/swiftgen.xcscheme # Sources/SwiftGenCLI/templates/files/flat-swift4.stencil # Sources/SwiftGenCLI/templates/files/flat-swift5.stencil # Sources/SwiftGenCLI/templates/files/structured-swift4.stencil # Sources/SwiftGenCLI/templates/files/structured-swift5.stencil # Sources/TestUtils/TestsHelper+Context.swift # SwiftGen.xcodeproj/project.pbxproj # Tests/TemplatesTests/TestsHelper.swift
d3fec67
to
e7c4cf6
Compare
Add a new parser which allows accessing any other specified files that need to be accessed from the bundle, usually with
Bundle.main.url(forResource:withExtension:)
and the like.develop
branch (gitflow)develop
as the "base" branch for this Pull Request I'm about to createCHANGELOG.md
file to explain my changes and credit myself(or added
#trivial
to the PR title if I think it doesn't warrant a mention in the CHANGELOG)Fixes #665, fixes #637, fixes #496, fixes #284, fixes #146, fixes #109.