swift icon indicating copy to clipboard operation
swift copied to clipboard

Create example approach to Danger framework with module stability

Open DavidBrunow opened this issue 2 years ago • 2 comments

This pull request shows an example implementation of changes that could be made to enable module stability for the Danger dependency used by Dangerfile.swift. It also builds a universal binary for danger-swift.

All credit for the idea goes to @bobergj, I saw this comment, needed to implement it for a fork used internally at work, and thought I'd share it in case it is useful: https://github.com/danger/swift/issues/476#issuecomment-984248497

Drawbacks to this approach in general (as mentioned in that issue):

  • Needs a project file which could get out of sync with the Package.swift
  • @_implementationOnly is underscored and is going to change in the future

This specific implementation also has this very large problem:

  • It does not solve for the problem of the OctoKit API being exposed to consumers.

I've added a script that shows how danger-swift and the Danger.framework can be built.

DavidBrunow avatar Mar 20 '23 12:03 DavidBrunow

how I can use this approach?

rarias84 avatar Apr 04 '23 09:04 rarias84

how I can use this approach?

If you are using GitHub then you cannot use the current state of this because more work would need to be done to wrap the OctoKit dependency.

If you are using a different tool, like BitBucket or GitLab, you can run the build_runner_and_framework.sh script which will create a danger_swift binary and a Danger.framework framework. I've only experimented with those being in the same directory when running Danger Swift but theoretically you could place both somewhere in your path and things would "just work".

DavidBrunow avatar Apr 07 '23 14:04 DavidBrunow