-
Notifications
You must be signed in to change notification settings - Fork 104
Add Swift Package Manager component detection support #1316
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 Swift Package Manager component detection support #1316
Conversation
@microsoft-github-policy-service agree company="Microsoft" |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1316 +/- ##
=======================================
+ Coverage 89.2% 89.4% +0.1%
=======================================
Files 393 398 +5
Lines 30445 30997 +552
Branches 1854 1867 +13
=======================================
+ Hits 27175 27726 +551
+ Misses 2867 2866 -1
- Partials 403 405 +2 ☔ View full report in Codecov by Sentry. |
src/Microsoft.ComponentDetection.Detectors/swiftpm/SwiftPMResolvedComponentDetector.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.ComponentDetection.Detectors/swiftpm/SwiftResolvedComponentDetector.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.ComponentDetection.Detectors/swiftpm/SwiftResolvedComponentDetector.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.ComponentDetection.Detectors/swiftpm/SwiftResolvedComponentDetector.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.ComponentDetection.Contracts/TypedComponent/SwiftComponent.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.ComponentDetection.Detectors/swiftpm/SwiftResolvedComponentDetector.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.ComponentDetection.Contracts/TypedComponent/SwiftComponent.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.ComponentDetection.Contracts/TypedComponent/SwiftComponent.cs
Outdated
Show resolved
Hide resolved
👋 Hi! It looks like you modified some files in the
If none of the above scenarios apply, feel free to ignore this comment 🙂 |
Component detection does not currently support detection of Swift Package Manager. This package manager is the new default for swift-related projects now that CocoaPods (supported by Component detection) is on maintenance mode.
This new detector adds basic support to SwiftPM by parsing the JSON file
Package.resolved
that is generated when dependencies are resolved. This file is usually present in repositories and after building a Swift Package and its contents are enough to detect both direct and transitive dependencies.This detector does not parse the
Package.swift
file (hard to parse and does not include transitive dependencies) and does not differentiate between build dependencies, transitive dependencies, and direct dependencies (it is not possible by just parsingPackage.resolved
).This detector will register two kind of components: a
SwiftPMComponent
and aGitComponent
. I have decided to also register a Git component because SwiftPM does not rely in a repository infrastructure such as NPM, it directly downloads other Swift Packages from the git repositories. I need feedback in this regard, since I do not know what is the best practice (maybe having two registered components for the same dependency is not a good idea?)I had to invest time in troubleshooting the verification tests because I was not passing them. The issue is that the reference snapshot has less packages because the environments differ for
PipReport
since PR #1259. I have added the same environment vars to the snapshot-publish pipeline although maybe @pauld-msft could take a look at this PR to verify that my modification is correct.