Embassy icon indicating copy to clipboard operation
Embassy copied to clipboard

`stopAndWait` hangs when -whole-module-optimization is turned on

Open dominicfreeston opened this issue 7 years ago • 2 comments

This can be confirmed by turning on Swift Whole Module Optimisation for the Debug Configuration in the Build Settings, and running the tests.

I realise this is quite likely to be a Swift compiler bug, but having it recorded here might save someone some valuable time, and maybe there's a way to avoid this I'm not aware of.

Some context

We setup Embassy/Ambassador as the server for our UI tests and everything was working fine until it was running on our CI, where it would just hand endlessly. I eventually realised that this was because we were using a different Configuration and Cocoapods creates new Configurations to match any you added, but the pods themselves have settings that match those of their default Release config, with Whole Module Optimisation turned on.

A 'solution'

We've worked around the issue using the following Cocoapods post_install script (with inspiration taken from this old Cocoapods thread):

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == 'Embassy'
      target.build_configurations.each do |config|
          config.build_settings['SWIFT_OPTIMIZATION_LEVEL'] = '-Onone'
      end
    end
  end
end

dominicfreeston avatar May 03 '17 13:05 dominicfreeston

@dominicfreeston

Hi Dominic,

thanks for the report, that's a very interesting finding. I will look into that when I have time. I saw there is another issue open for similar hanging issue #30, not sure is that the same one, but will look into that later altogether.

fangpenlin avatar May 04 '17 00:05 fangpenlin

@dominicfreeston @fangpenlin Thanks for the workaround solution but what can we do when we are using Carthage?

iNima avatar May 08 '18 00:05 iNima