IBM-Swift / swift-buildpack

IBM Cloud buildpack for Swift
BSD 3-Clause "New" or "Revised" License
32 stars 31 forks source link

Compiler freezes during docker image creation #125

Closed AlexChekanov closed 4 years ago

AlexChekanov commented 4 years ago

Hi everyone! I stuck with an interesting problem. My application perfectly compiles and I can deploy it, but as soon as I add methods from one of the key class to my codable routes, the compiler freezes during the docker image creation. As far as I understand, the compiler compiles everything, regardless of the usage in the application logic. That means this class and its functionality is not an issue. Tried all Swift versions starting 5.0.2. Please find the project at git@us-south.git.cloud.ibm.com:chekanov/bridge.git or https://us-south.git.cloud.ibm.com/chekanov/bridge.git. Thank you in advance for your help!

AlexChekanov commented 4 years ago

I found the problem!

I have a Codable struct — Property, and this struct has Member, and the Member struct has [Property], which leads to a recursion. XCode compiler perfectly manages it, but Linux — freezes (and the main problem is not in the recursion itself, but in Codable conforming).

So, one of the possible solutions here is to use classes instead of structs — the Linux compiler works fine in that case.