Open me2k opened 3 years ago
Holy cow, that was a nice find. Thanks a lot for finding this, will push a PR to fix it.
Hey guys,
I'm trying to run SwiftInfo via danger-swiftinfo but the message via danger in PR is empty.
In CI it logs the error message when executing swiftinfo via Pods: swiftinfo.run './Pods/SwiftInfo/bin/swiftinfo'
error: unknown argument: '-toolchain'
We use Azure Pipelines.
SwiftInfo version: 2.6.0
Danger-swiftinfo version: 0.1.0
Any suggestion? :)
Generating script.
Script contents:
danger --verbose
========================== Starting Command Output ===========================
error: unknown argument: '-toolchain'
{"content":"⚠️ 2 Warnings. Don't worry, everything is fixable.\n\n| | 2 Warnings |\n|---|---|\n| ⚠️ | Modified azure-pipelines.yml |\n| ⚠️ | Modified Podfile |\n\n| | 1 Message |\n|---|---|\n| 📖 | |\n\n\n\nGenerated by :no_entry_sign: [Danger]([https://danger.systems/](https://mcas-proxyweb.mcas.ms/certificate-checker?login=false&originalUrl=https%3A%2F%2Fdanger.systems.mcas.ms%2F%3FMcasTsid%3D26110&McasCSRF=849521a7a3a30e043f4af92d4343b63638dad3ca86b53b5b98f1f95a685a5a67) \"generated_by_danger\")\n"}
Results:
Warnings:
- [ ] Modified azure-pipelines.yml
- [ ] Modified Podfile
Messages:
- [ ]
Finishing: Run Danger
import SwiftInfoCore
import Foundation
FileUtils.buildLogFilePath = "./build/build_log/MyProject.log"
FileUtils.testLogFilePath = "./build/tests_log/MyProject.log"
let projectInfo = ProjectInfo(xcodeproj: "./MyProject.xcodeproj",
target: "MyProject",
configuration: isInPullRequestMode ? "Homolog": "Production",
plistPath: "./MyProject/Supporting Files/Info.plist")
let api = SwiftInfo(projectInfo: projectInfo)
let output = api.extract(IPASizeProvider.self) +
api.extract(TotalTestDurationProvider.self) +
api.extract(TargetCountProvider.self, args: .init(mode: .complainOnRemovals)) +
api.extract(TestCountProvider.self)
// Lastly, process the output.
if isInPullRequestMode {
// If called from danger-SwiftInfo, print the results to the pull request
api.print(output: output)
} else {
// If called manually, send the results to Slack...
//api.sendToSlack(output: output, webhookUrl: url)
// ...and save the output to your repo so it serves as the basis for new comparisons.
api.save(output: output)
}
Hey guys,
I did other tests using xcode 12.5 and it worked. 🥳
As of xcode 13.+ gives error when running:
./Pods/SwiftInfo/bin/swiftinfo --verbose
Error:
error: unknown argument: '-toolchain'
Hey guys,
I did other tests using xcode 12.5 and it worked. 🥳 As of xcode 13.+ gives error when running:
./Pods/SwiftInfo/bin/swiftinfo --verbose
Error:
error: unknown argument: '-toolchain'
Hey Bruno and guys 👋
I'm facing the same issue using code 13.+. However, the example app is working pretty well Did anybody find a solution for this?
When running the plug in using Swift info from the command line the danger output is empty.
As I am unable to raise a pull request against this project here is the fix for anyone that may stumble upon this:
To fix this issue, In the
/lib/danger_plugin.rb
file Replace the run block with this:The bash command is being executed without the
-pullRequest -s
parameters and therefore theInfofile.swift
using the suggested if block from the read me will only save the output to a json file and not print anything to the Danger message in the PR.