Using tuist in project requiring Xcode 10.1 does not seem to work

So, I installed tuist as per instructions, it installed 1.11.1. While I did this, I had Xcode 10.1 activated through Xcode-select (although I don’t think that matters). Basic tuist commands seem to work.

Next I attempt to run “tuist generate” for a project that I have. This project has, in its configuration (Config.swift): compatibleXcodeVersions: ["10.1"] and got:

/Users//Documents/Dev/Dolf/SFLibraries/Tuist/ProjectDescriptionHelpers/Project+Templates.swift:1:8: error: module compiled with Swift 5.1.3 cannot be imported by the Swift 4.2.1 compiler: /Users/dolf/.tuist/Versions/1.11.1/ProjectDescription.swiftmodule
import ProjectDescription
^
The ‘swiftc’ command exited with error code 1

This seems to be caused by a pre-compiled version of ProjectDescription.swift located in ~/.tuist/Versions/1.11.1/

I then tried to install things while 10.1 was selected by running: tuist uninstall 1.11.1 followed by tuist install --force 1.11.1:

The '/Applications/Xcode 10.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift' command exited with error code 1 and message:
/private/var/folders/ls/vpdknw1n5h3fvr3vpxm44zrr0000gn/T/TemporaryDirectory.Tr3VwL: error: package at '/private/var/folders/ls/vpdknw1n5h3fvr3vpxm44zrr0000gn/T/TemporaryDirectory.Tr3VwL' requires a minimum Swift tools version of 5.1.0 (currently 4.2.0)

So, at this point I am at a loss on how to do this. The idea one can configure minimum Xcode versions in the Config object, yet if that version is a bit of a distance in the past, it cannot actually work is confusing to me.

Please let me know what I am missing or doing wrong, or that it is understood that when the Xcode compiler is different, perhaps there should not be a pre-compiled version of the configuration based objects, but rather they should be compiled as part of the generate step…

Hi @dolfs,
The ProjectDescription framework where all the manifest models are defined only supports Xcode > 10.3.1. I can check out if it’s possible to lower that minimum version number but I have the feeling it might not be possible.

The reason why we don’t compile it at generation time is because generation would take a bit longer (at least the first time we run it).

Have you considered editing the projects always with the latest version of Xcode? The generated projects should be compatible with any Xcode version.

Thanks for the explanation. My first reaction is that these limitations are not present, or obvious, in the documentation. Would have saved me a lot of time…

I understand not wanting to do it at generation time, but perhaps a cache could be used? In fact, if you would store pre-compiled modules in a directory hierarchy prefixed with version number you could easily allow unlimited switching.

As far as your suggestion: I cannot quite take that approach. I normally work on an iMac running Catalina and all Xcode versions are available to me. When I travel I need to work on my (admittedly old) MacBookPro 17" which does not support Catalina, and consequently only Xcode 10.x (I might be able to hack around that, but trying to avoid it). So, in the end, not only do my project files need to be compatible (and they are, as you explained), but on the laptop I need to be able to run the tuist tools, but I can only have an Xcode 10.1 active (I might be able to move that up to 10.3.1, but I’d have to check).

For now, the way I am handling it, is to simply not list the xcode version restriction in the Config.swift. I can then select Xcode 11.5 on the mac, generate, and then test compilation etc. under either version of Xcode. At least I can get something ready to work on the laptop (where I will not be able to run tuist generate while I work).

I can see this issue becoming more relevant in the next 2 years as, during the ARM transition, people might be forced to keep using an older Xcode until they can afford to put transition issue on their schedule.

I’ve held on to this MBP 17" because until recently, with MBP 16, I could not find anything with a decent screen size for development. I may have to bite the bullet and buy a new one now, and retire the old one :grin: (and then be ready to buy an ARM based one later :frowning: