-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add --include flag to SafeDITool #80
Conversation
208af58
to
886efc3
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #80 +/- ##
==========================================
- Coverage 99.59% 99.52% -0.08%
==========================================
Files 44 44
Lines 9295 9383 +88
==========================================
+ Hits 9257 9338 +81
- Misses 38 45 +7
|
@@ -1,3 +1,7 @@ | |||
# file options | |||
|
|||
--exclude Examples/ExampleMultiProjectIntegration/ExampleMultiProjectIntegration/SafeDI.swift |
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.
The linter does not approve of the code-gen. Go figure.
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.
What specifically doesn't it like? Worth it to fix?
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.
It's my own swift format config that I'm fighting. Not worth fixing (at least not in the short term) – this generated code isn't meant to be pretty as much as it's meant to be easy to write + maintain.
Biggest delta is that my format config wants @MainActor
on its own line rather than on the same line as func
.
|
||
extension FileManager: FileFinder {} | ||
|
||
var fileFinder: FileFinder = FileManager.default |
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.
A little nuts to have a global like this, but since SafeDITool
must be Decodable
(which FileFinder
most assuredly isn't) we can't add it as an ivar.
Open to better ideas here.
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.
Hmmm yeah this is a tricky one. I was thinking maybe you could wrap this in another type like GlobalDependencies
or something but you still have the same setup. Not sure if there's anything that's obviously better.
@Argument(help: "A path to a CSV file containing paths of Swift files to parse.") var swiftSourcesFilePath: String | ||
@Argument(help: "A path to a CSV file containing paths of Swift files to parse.") var swiftSourcesFilePath: String? | ||
|
||
@Option(parsing: .upToNextOption, help: "Directories containing Swift files to include, relative to the executing directory.") var include: [String] = [] |
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.
One of these days we may want to add an exclude
, but for now this gets the job done.
a92bb66
to
6960ed6
Compare
...ples/ExampleMultiProjectIntegration/ExampleMultiProjectIntegration.xcodeproj/project.pbxproj
Outdated
Show resolved
Hide resolved
run: xcrun swift build -c release --package-path Examples/ExamplePackageIntegration | ||
run: xcrun swift build --package-path Examples/ExamplePackageIntegration |
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.
an unrelated change, but we're already building for release elsewhere – no reason to do it here as well.
public init( | ||
userService: any UserService, | ||
stringStorage: StringStorage, | ||
nameEntryViewBuilder: Instantiator<NameEntryView>, | ||
noteViewBuilder: Instantiator<NoteView> | ||
) { | ||
self.userService = userService | ||
self.stringStorage = stringStorage | ||
self.nameEntryViewBuilder = nameEntryViewBuilder | ||
self.noteViewBuilder = noteViewBuilder | ||
observedUserService = AnyObservableObject(userService) | ||
} |
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.
Do you think it's worth mentioning above that, in addition to the reasons you outlined, there's also a property here not marked with @Instantiated/@Forwarded/@received so you must write your own init?
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.
That’s useful info but I fear it’s a bit tangential to what I’m trying to get across with this comment. There’s so much information to convey when teaching this lib. It’s probably best to not try to do it all at once.
Makes it much easier to integrate SafeDI into a project by adding an
--include
flag toSafeDITool
, removing the need to utilize a.csv
file.This new flag made it easier to showcase what it would look like to run SafeDI in a multi-module Xcode project, so I added those directions and also created
ExampleMultiProjectIntegration
. TheExampleMultiProjectIntegration
project has the same code asExampleProjectIntegration
, but split into one app target and one library.Best reviewed with the
Examples/ExampleMultiProjectIntegration/
path folded. This new project constitutes the majority of the diff, and it does not need to be carefully reviewed.