<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi,<div class=""><br class=""></div><div class="">I think this makes sense and is very useful. The fetch part does sound like a bug and should be an easy fix (hopefully).</div><div class=""><br class=""></div><div class="">Instead of preset we could add a flag to swift build for e.g. --dependencies or --deps-only. This would automatically give you all the other build options.</div><div class="">$ swift build --deps-only</div><div class=""><br class=""></div><div class="">This might be a bit tricky to do but should be possible by only reading the product target dependencies in the root manifest. What do others think?</div><div class=""><br class=""></div><div class=""><div class=""><div><blockquote type="cite" class=""><div class="">On 27-Jan-2017, at 6:48 PM, swizzlr via swift-build-dev <<a href="mailto:swift-build-dev@swift.org" class="">swift-build-dev@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Sometimes it is desirable to run a sequence of commands and cache the output of those commands as a filesystem snapshot in CI. This is especially relevant to swift packages, where compilation times are relatively long, but the dependencies don’t change often.</div><div class=""><br class=""></div><div class="">In particular, Docker users will often do something like so (though this can be applied to Travis and other CI solutions).</div><div class=""><br class=""></div><div class=""><div class="">FROM swift</div><div class=""><br class=""></div><div class="">WORKDIR /code</div><div class=""><br class=""></div><div class="">COPY Package.swift /code/</div><div class="">RUN swift build -c release # This fails because of point 2, below</div></div><div class=""># Changes to `Sources` will not trigger refetch or recompilation of dependencies</div><div class=""><div class="">COPY ./Sources /code/Sources</div><div class="">RUN swift build -c release</div><div class="">EXPOSE 8000</div><div class="">CMD .build/release/App</div></div><div class=""><br class=""></div><div class="">Unfortunately, the above fails in certain scenarios:</div><div class=""><br class=""></div>1. `swift package fetch` will break if the target source layout doesn’t match. This bug is described in <a href="https://bugs.swift.org/browse/SR-3756" class="">https://bugs.swift.org/browse/SR-3756</a><div class="">2. `swift build` will correctly fail if it cannot find sources matching the source layout described in Package.swift. This is a feature, not a bug.</div><div class=""><br class=""></div><div class="">I propose making this workflow easier with `swift package preheat` – a command which will fetch ONLY dependencies specified in Package.swift, and optionally (with the option —build) compile those dependencies, but not the main Package.</div><div class=""><br class=""></div><div class="">This would also be great for bootstrapping a project with a lot of dependencies, or with deps that have long compilation times.</div><div class=""><br class=""></div><div class="">This command should also support specifying a build configuration, so that we can cache both debug and release builds at the same time to accelerate development iteration.</div><div class=""><br class=""></div><div class="">Are there any comments, concerns, objections or +1s to this?</div><div class=""><br class=""></div><div class="">Tom<br class=""><div class=""><br class=""></div></div></div>_______________________________________________<br class="">swift-build-dev mailing list<br class=""><a href="mailto:swift-build-dev@swift.org" class="">swift-build-dev@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-build-dev<br class=""></div></blockquote></div><br class=""></div></div></body></html>