peripheryapp / periphery

A tool to identify unused code in Swift projects.
MIT License
5.02k stars 178 forks source link

Added ability to read package manifest json from provided path #732

Closed rock88 closed 1 month ago

rock88 commented 1 month ago

Hello! I want to write a plugin for Swift Package Manager and I'm running into an issue where SPM doesn't allow to run swift package describe in plugins (due to plugin sandbox limitation). As a workaround we can perform this command manually (before plugin usage) or generate in the plugin using PackagePlugin.Package/Target. So I added an extra argument to the scan command - --json-package-manifest-path and serialize SPM.Package from that path if it exists.

You can check out the proof of concept for a possible Periphery plugin here:

https://github.com/peripheryapp/periphery/assets/323908/1eb8458e-1856-4a1f-8fc9-aebbb817fbca