Skip to content
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

Reduce main thread usage in SafeDITool #114

Merged
merged 5 commits into from
Oct 3, 2024
Merged

Reduce main thread usage in SafeDITool #114

merged 5 commits into from
Oct 3, 2024

Conversation

dfed
Copy link
Owner

@dfed dfed commented Oct 3, 2024

No description provided.

@dfed dfed self-assigned this Oct 3, 2024
Copy link

codecov bot commented Oct 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.59%. Comparing base (d20e9a6) to head (1ae5061).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #114      +/-   ##
==========================================
+ Coverage   99.52%   99.59%   +0.07%     
==========================================
  Files          33       33              
  Lines        2724     2728       +4     
==========================================
+ Hits         2711     2717       +6     
+ Misses         13       11       -2     
Files with missing lines Coverage Δ
...s/SafeDICore/Extensions/CollectionExtensions.swift 100.00% <100.00%> (ø)
...afeDICore/Generators/DependencyTreeGenerator.swift 100.00% <100.00%> (ø)
Sources/SafeDICore/Models/TypeDescription.swift 99.15% <100.00%> (+0.54%) ⬆️
Sources/SafeDITool/SafeDITool.swift 98.83% <100.00%> (+0.05%) ⬆️

@@ -523,8 +523,7 @@ extension TypeSpecifierListSyntax {
if case let .simpleTypeSpecifier(simpleTypeSpecifierSyntax) = specifier {
simpleTypeSpecifierSyntax.specifier.text
} else {
// lifetimeTypeSpecifier is SPI, so we ignore it.
nil
nil // lifetimeTypeSpecifier is SPI, so we ignore it.
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated change, but it helps up our code coverage so ¯\(ツ)

Comment on lines -120 to -121
let includedFileEnumerator = fileFinder
.enumerator(
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eek. we were previously enumerating directories on disk on main.

@@ -314,5 +327,9 @@ protocol FileFinder {
}

extension FileManager: FileFinder {}
extension FileManager: @retroactive @unchecked Sendable {
// FileManager is thread safe:
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the delegate methods aren't thread safe. but we aren't using those

@@ -1733,6 +1733,7 @@ final class SafeDIToolCodeGenerationErrorTests: XCTestCase {
tool.moduleInfoOutput = nil
tool.dependentModuleInfoFilePath = nil
tool.dependencyTreeOutput = nil
tool.dotFileOutput = nil
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not strictly speaking necessary but it is best to set every property on the tool before trying to run it to avoid spurious errors.

@dfed dfed marked this pull request as ready for review October 3, 2024 15:52
Comment on lines -487 to -493
### Requirements

* Xcode 16.0 or later
* iOS 13 or later
* tvOS 13 or later
* watchOS 6 or later
* macOS 10.13 or later
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deferring instead to Package.swift. Requirements are effectively "you can compile the Swift 6 toolchain and are compiling on a target that supports SwiftSyntax"

Comment on lines +73 to +75
public func removingEmpty() -> [Element] {
filter { !$0.isEmpty }
}
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we were doing this in enough places, it felt like a reasonable addition.

@dfed dfed merged commit 85c2c7e into main Oct 3, 2024
13 checks passed
@dfed dfed deleted the dfed--main-thread branch October 3, 2024 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant