Open pRizz opened 8 years ago
Hi,
I know about this issue. My script works only when -Owholemodule is enabled. I suspect that your crash may be due to: rdar:22858834. At least this is what happens in my project and crashes compilation without -Owholemodule. It is a well known issue also in Xcode 7.3 betas (when you compile without -Owholemodule and use inner classes the compilation crashes on Merging Swift modules). Correct me if this is not your case.
The problem with -Owholemodule is that it is not incremental. So if you have a large project the compilation takes a lot of time, no matter if you change something in your project. I found a workaround for that problem, which works only in Xcode 7.2. First I am using my wrapper script and compile the project with -Owholemodule, then I remove this flag from compiler options and re-run compilation (the wrapper scripts has a separate path when you use it without -Owholemodule). When it is finished I can leverage incremental builds without -Owholemodule. This works until you make some bigger changes in your project (like renaming, deleting files etc.)
Cheers, Tomasz
Anyway I updated README.md. Thanks for your comment!
You're welcome Tomasz! And, yes, we do use inner classes in some spots, so that probably explains it.
The bug in swiftc which results in crash when not using -Owholemodule is not that trivial. You have more details in Xcode 7.3 beta 5r elease note (Known issues section) or you can check archive of my twitter account (@tgebarowski). I talked with Apple engineers about it. It is related to usage of inner classes from outside scope.
Performing your workaround does not work if whole module optimization is turned off for the desired target. It does work when whole module optimization is on. I would update the instructions to mention this issue. It's probably a moot point since Xcode 7.3 will come out in the next few weeks, fixing this issue anyways. I really appreciate your workaround, by the way! Thanks so much!!!