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

Daniel Dunbar daniel at zuster.org
Mon Nov 21 15:58:03 CST 2016

swift-build-tool will currently rebuild any file if it detects a change to
the file inode or device -- my guess is that is what you are seeing here.

My intention is to eventually move to using content-based signatures to
determine the rebuild conditions (for tools where we know that is safe),
which would prevent the rebuild in this situation.

Is there a particularly reason it is important to you that this not rebuild?

 - Daniel

On Mon, Nov 21, 2016 at 1:54 PM, Ricardo N Olivieri via swift-build-dev <
swift-build-dev at swift.org> wrote:

> 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
> above?
> Regards,
>   Ricardo Olivieri
> _______________________________________________
> swift-build-dev mailing list
> swift-build-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-build-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-build-dev/attachments/20161121/2514dd6f/attachment.html>

More information about the swift-build-dev mailing list