Skip to content

Conversation

@pepicrft
Copy link
Contributor

I noticed this package depends on the service-context-module. I don't think a dependency should have an opinion about how its dependencies, like logger in this case, are passed. I believe this is a pattern that leaked from one of the main consumers of the package, tuist/tuist. This PR removes that dependency and passes Logger through the constructor of the utility that expects it.

@pepicrft pepicrft self-assigned this May 20, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR removes the ServiceContextModule dependency in favor of an explicit Logger dependency injection for improved decoupling.

  • Removed unnecessary ServiceContextModule imports in test files.
  • Updated XCFrameworkMetadataProvider to accept an optional Logger via its constructor while eliminating ServiceContextModule usage.
  • Removed the LoggerServiceContextKey and updated Package.swift accordingly.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Tests/XcodeMetadataTests/XCFrameworkMetadataProviderTests.swift Removed unused ServiceContextModule import
Tests/XcodeMetadataTests/AssertionsTesting.swift Removed unused ServiceContextModule import
Tests/XcodeGraphMapperTests/Mocks/AssertionsTesting.swift Removed unused ServiceContextModule import
Sources/XcodeMetadata/Providers/XCFrameworkMetadataProvider.swift Replaced ServiceContextModule logger with an optional Logger injection
Sources/XcodeMetadata/LoggerServiceContextKey.swift Removed the file as the dependency is no longer used
Package.swift Removed dependency on swift-service-context package
Comments suppressed due to low confidence (1)

Sources/XcodeMetadata/Providers/XCFrameworkMetadataProvider.swift:190

  • Consider adding a comment to clarify that the logger parameter is optional and that warnings won't be logged if no Logger is provided. This could help future maintainers understand the design decision.
logger?.warning(

Copy link
Member

@fortmarek fortmarek left a comment

Choose a reason for hiding this comment

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

Let's not forget to pass the logger from tuist/tuist.

@pepicrft pepicrft merged commit fda0296 into main May 20, 2025
7 checks passed
@pepicrft pepicrft deleted the remove-service-context-dep branch May 20, 2025 14:55
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.

3 participants