[swift-build-dev] SwiftPM recompilation - Packages folder

Ricardo N Olivieri ricardo.olivieri at us.ibm.com
Mon Nov 21 15:54:16 CST 2016

Hello all, 

I was wondering if someone could shed some light on how SwiftPM determines 
if it needs to compile again any of the source code under the Packages 
folder. I had thought that the modified timestamp attribute of any source 
code files under the Packages folder was the key for determining if any of 
the Swift package dependencies should be recompiled. However, it seems 
SwiftPM uses additional criteria to make this determination. Here’s the 
test we executed: 

1) At T0, we executed swift build. As expected all Swift package 
dependencies were cloned and compiled along with the application’s code. 

2) At T1, we executed swift build again and nothing was recompiled, as 
expected since no code changes were made. 

3) At T2, we made a copy of the Packages folder and place this copy in a 
location outside the repo’s directory. We then deleted the Packages folder 
from the repo’s directory, and, finally, we copied the Packages folder 
back to its original location in the repo’s directory. 

4) At T3, we executed again swift build and noticed that SwiftPM 
recompiled each one of the Swift package dependencies in the Packages 
folder, even though no code changes were made. We also double checked that 
the modified and creation timestamps for the Packages folder and folders 
and files in it were not changed. After doing so, we concluded that though 
copying the Packages folder back to the application’s repo did keep the 
original creation and modified timestamp values of all files and folders, 
SwiftPM still recompiled all of the dependencies in the Packages folder. 

Does anyone know why we are seeing in SwiftPM the behavior described 

   Ricardo Olivieri

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-build-dev/attachments/20161121/47c81120/attachment.html>

More information about the swift-build-dev mailing list