rockbruno / danger-SwiftInfo

📊Print SwiftInfo results to individual pull requests.
MIT License
29 stars 0 forks source link

Setting path to Infofile.swift #6

Closed swiftyfinch closed 3 years ago

swiftyfinch commented 3 years ago

Hello! Thanks for sharing the plugin 👍🏻

I try to use it, but have an issue with setting the path to Infofile.swift.

My folder structure:

BuildAnalytics
   * Archive
      * Infofile.swift
      * Dangerfile
   * Tests/Infofile.swift
      * Infofile.swift
      * Dangerfile
Pods
   * SwiftInfo

Then I run danger in different lanes and different jobs:

danger(dangerfile: "BuildAnalytics/Archive/Dangerfile") # Archive
danger(dangerfile: "BuildAnalytics/Tests/Dangerfile")   # Tests

In my Dangerfile:

swiftinfo.run 'Pods/SwiftInfo/bin/swiftinfo'

Build log:

[17:20:59]--------------------
[17:20:59]--- Step: danger ---
[17:20:59]--------------------
[17:20:59]$ bundle exec danger --dangerfile=BuildAnalytics/Tests/Dangerfile
[17:21:01]▸ Error: Unknown option '-u'
[17:21:01]▸ Usage: swiftinfo [--help] [--silent] [--verbose] [--print-sourcekit] [<arguments> ...]
[17:21:01]▸ See 'swiftinfo --help' for more information.
[17:21:01]▸ Results:
[17:21:01]▸ 
[17:21:01]▸ Messages:
[17:21:01]▸ - [ ]

So, I think the plugin can't find Infofile.swift. But if I run without danger plugin then everything OK:

sh "cd ../BuildAnalytics/Archive && ../../Pods/SwiftInfo/bin/swiftinfo"

Do you have any suggestions? I can't find the ability to change the directory while using Danger.

rockbruno commented 3 years ago

Hey! The problem is in the gem, we recently changed how arguments were parsed but this lib wasn't updated to follow the new rules. I'll need to push a new version for this (and SwiftInfo itself probably). Will do it soon, thanks for the report!

In the meantime you can avoid this error by using an older version of SwiftInfo (that doesn't have the argument parser)

swiftyfinch commented 3 years ago

@rockbruno thank you for your quick response! I'll try 2.3.12

swiftyfinch commented 3 years ago

@rockbruno Unfortunately, I can't use the older version 2.3.12. Seems to be I need the older Xcode version, but we already don't have it on CI.

./Infofile.swift:1:8: error: module compiled with Swift 5.3 cannot be imported by the Swift 5.3.1 compiler

So, I subscribe for updates about the new version ✈️

rockbruno commented 3 years ago

Fixed in 0.1.0, which now requires SwiftInfo 2.4.1