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

Danger-Swift as SPM Plugin? [IDEA] #586

Open
NFulkerson opened this issue Jun 1, 2023 · 3 comments
Open

Danger-Swift as SPM Plugin? [IDEA] #586

NFulkerson opened this issue Jun 1, 2023 · 3 comments

Comments

@NFulkerson
Copy link

At WWDC22, Apple introduced the concept of plugins for SPM. These plugins allow us to specify scripts that run either at build time or can be invoked manually.

Today, Danger Swift's setup requires "working around the system" to use the docs own words. I wonder whether the plugin system in SPM would remove the need to create a special target to get libDanger compiled. Once implemented as a plugin, it seems all one has to do is import it as a dependency like any other Swift Package, and then simply run something like:

swift package danger pr https://github.com/Moya/Harvey/pull/23

I don't see mass adoption of SPM plugins quite yet -- there may be reason for that. Perhaps at WWDC23 in a few days we'll see some further refinements to plugins.

@orta
Copy link
Member

orta commented Jun 1, 2023

This could work - it'd be worth figuring out if there are any sandboxing issues which come with running as a plugin ( I hear networking permissions were added pretty recently, so who knows what is not possible ) but it could work and it could be easier for folks to use then - which would be cool

I'd recommend taking a quick stab at it to see if there's any blockers

@f-meloni
Copy link
Member

f-meloni commented Jun 1, 2023

I believe the main issue is how Danger works.
Danger compiles the Dangerfile linking the needed libraries.
If you have plugins the library is compiled using your Package.swift definition to understand what is the library name to compile and link.
If you are not using plugins, the Danger library is linked.
I believe (and I would be happy to be wrong) using only a plugin would not allow us to have the libraries that needs to be linked to the Dangerfile compilation.

@NFulkerson
Copy link
Author

It was my understanding that the SPM plugins are essentially just light runners or wrappers over tools, and so my hope is that we could compile and link as part of the build step for the plugin. I can try and fool around with it some over the upcoming weekend and see if there's any feasibility.

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

No branches or pull requests

3 participants