rockbruno / SwiftInfo

📊 Extract and analyze the evolution of an iOS app's code.
https://swiftrocks.com
MIT License
1.15k stars 58 forks source link

-disallow-use-new-driver for Swift 5.5 #77

Closed andre-alves closed 3 years ago

andre-alves commented 3 years ago

Context

When I try to run SwiftInfo with Xcode 13 (Swift 5.5) I receive this error (from its internal swiftc invocation):

./swiftinfo 
error: unknown argument: '-toolchain'

Swift 5.5 uses the new swift-driver by default (which apparently does not support the -toolchain arg):

swiftc -version
swift-driver version: 1.26.9 Apple Swift version 5.5 (swiftlang-1300.0.31.1 clang-1300.0.29.1)
Target: x86_64-apple-macosx11.0

We may also have more problems than that. Runner.swift uses --driver-mode=swift which is also not working (does nothing) and breaks Infofile parsing.

Solution (workaround)

Passing -disallow-use-new-driver to swiftc disables the new driver and everything works again. I tested with both Xcode 13 (Swift 5.5) and Xcode 12.5 (Swift 5.4) so it seems retro compatible.

We should eventually update to support the new driver, but I think the solution is ok for now.

revolter commented 2 years ago

It still fails with Xcode 13.2.1 (13C100), using

swift-driver version: 1.26.21 Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
Target: arm64-apple-macosx12.0
andre-alves commented 2 years ago

I'm using it with Xcode 13.2.1 and it's working fine, but I'm still fetching from my fork.

We need to release a new version of SwiftInfo with this diff.

andre-alves commented 2 years ago

I built my SwiftInfo binary using Xcode 12.5... thanks to module stability I can use it with Xcode 13, but SwiftInfo is falling to build with Xcode 13.

We probably need to merge #78 first, so we can build SwiftInfo using Xcode 13.