<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=""><div class=""><blockquote type="cite" class=""><div dir="ltr" class=""><div class=""><p style="margin-right: 0px; margin-bottom: 15px; margin-left: 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px; margin-top: 0px !important;" class="">From what I understand, swiftpm will generate a module with structs of each dep with their version meta data, something like: </p></div></div></blockquote></div>- Yes that’s right. <div class="">But there is a problem with this layout. App -> Dependency -> InnerDependency. If we generate PackageVersions as top level structs then App (a root package) would have access to an InnerDependency of its own dependency, but it shouldn’t</div><div class=""><div class=""><div class=""><blockquote type="cite" class=""><div dir="ltr" class=""><div class=""><p style="margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class="">And then somewhere in the package you can dump/use the version info like this:</p></div></div></blockquote><div class=""><div dir="ltr" class=""><div class=""><p style="margin: 15px 0px;" class=""><span style="font-family: Helvetica; font-size: 12px;" class="">- Yes, you will be able to import </span>PackageVersions and use it. <br class=""></p><div class=""><pre class=" language-swift" style="-webkit-print-color-adjust: exact; margin-top: 0.5em; margin-bottom: 0.5em; background-color: rgb(45, 45, 45); border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 1.5; overflow: auto; padding: 1em; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; color: rgb(204, 204, 204); font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; word-break: normal; word-wrap: normal; tab-size: 4; -webkit-hyphens: none;"><code class=" language-swift" style="-webkit-print-color-adjust: exact; margin: 0px; padding: 0px; border: none; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-image: none; font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; word-spacing: normal; word-break: normal; word-wrap: normal; line-height: 1.5; tab-size: 4; -webkit-hyphens: none;"><span class="token function" style="-webkit-print-color-adjust: exact; color: rgb(240, 141, 73);">print</span><span class="token punctuation" style="-webkit-print-color-adjust: exact;">(</span><span class="token string" style="-webkit-print-color-adjust: exact; color: rgb(126, 198, 153);">"<span class="token interpolation" style="-webkit-print-color-adjust: exact;"><span class="token delimiter variable" style="-webkit-print-color-adjust: exact;">\(</span><span class="token builtin" style="-webkit-print-color-adjust: exact; color: rgb(204, 153, 205);">PackageVersions</span><span class="token punctuation" style="-webkit-print-color-adjust: exact; color: rgb(204, 204, 204);">.</span><span class="token builtin" style="-webkit-print-color-adjust: exact; color: rgb(204, 153, 205);">MyPackage</span><span class="token delimiter variable" style="-webkit-print-color-adjust: exact;">)</span></span>"</span><span class="token punctuation" style="-webkit-print-color-adjust: exact;">)</span> <span class="token comment" spellcheck="true" style="-webkit-print-color-adjust: exact; color: rgb(153, 153, 153);">// ok, own version data </span><br class=""></code></pre></div><div class=""><br class=""></div><div class="">But should you be able to use only your own VersionData or your dependencies as well? </div><div class="">If you will be able to access dependencies VersionData, then you could write code like that (which I think from Max’s comments is something we don’t want).</div><div class=""><pre class=" language-swift" style="-webkit-print-color-adjust: exact; margin-top: 0.5em; margin-bottom: 0.5em; background-color: rgb(45, 45, 45); border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 1.5; overflow: auto; padding: 1em; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; color: rgb(204, 204, 204); font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; word-break: normal; word-wrap: normal; tab-size: 4; -webkit-hyphens: none;"><code class=" language-swift" style="-webkit-print-color-adjust: exact; margin: 0px; padding: 0px; border: none; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-image: none; font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; word-spacing: normal; word-break: normal; word-wrap: normal; line-height: 1.5; tab-size: 4; -webkit-hyphens: none;"><span class="token keyword" style="-webkit-print-color-adjust: exact; color: rgb(204, 153, 205);">if</span> <span class="token builtin" style="-webkit-print-color-adjust: exact; color: rgb(204, 153, 205);">PackageVersions</span><span class="token punctuation" style="-webkit-print-color-adjust: exact;">.</span><span class="token builtin" style="-webkit-print-color-adjust: exact; color: rgb(204, 153, 205);">FirstDependency</span><span class="token punctuation" style="-webkit-print-color-adjust: exact;">.</span>version<span class="token punctuation" style="-webkit-print-color-adjust: exact;">.</span>major <span class="token operator" style="-webkit-print-color-adjust: exact; color: rgb(103, 205, 204);">></span> <span class="token number" style="-webkit-print-color-adjust: exact; color: rgb(240, 141, 73);">1</span> <span class="token punctuation" style="-webkit-print-color-adjust: exact;">{</span>
<span class="token comment" spellcheck="true" style="-webkit-print-color-adjust: exact; color: rgb(153, 153, 153);">//do smt</span>
<span class="token punctuation" style="-webkit-print-color-adjust: exact;">}</span></code></pre><div class=""><br class=""></div></div><div class="">- Kostiantyn </div><div class=""><br class=""></div></div></div></div><div><blockquote type="cite" class=""><div class="">On 08 Jul 2016, at 11:05, Ankit Agarwal <<a href="mailto:ankit@ankit.im" class="">ankit@ankit.im</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class=""><p style="margin-right: 0px; margin-bottom: 15px; margin-left: 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px; margin-top: 0px !important;" class="">From what I understand, swiftpm will generate a module with structs of each dep with their version meta data, something like: </p><pre style="margin-top:0.5em;margin-bottom:0.5em;background-color:rgb(45,45,45);border:1px solid rgb(204,204,204);font-size:13px;line-height:1.5;overflow:auto;padding:1em;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;color:rgb(204,204,204);font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;direction:ltr;word-wrap:normal" class=""><code style="margin:0px;padding:0px;border:none;background-color:transparent;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;direction:ltr;word-spacing:normal;word-wrap:normal;line-height:1.5" class=""><span style="color:rgb(153,153,153)" class="">// Module PackageVersions</span>
<span style="color:rgb(204,153,205)" class="">public</span> <span style="color:rgb(204,153,205)" class="">struct</span> <span style="color:rgb(204,153,205)" class="">FirstDependency</span> <span style="" class="">{</span>
<span style="color:rgb(153,153,153)" class="">// meta data</span>
<span style="" class="">}</span>
<span style="color:rgb(204,153,205)" class="">public</span> <span style="color:rgb(204,153,205)" class="">struct</span> <span style="color:rgb(204,153,205)" class="">SecondDependency</span> <span style="" class="">{</span>
<span style="color:rgb(153,153,153)" class="">// meta data</span>
<span style="" class="">}</span>
<span style="color:rgb(204,153,205)" class="">public</span> <span style="color:rgb(204,153,205)" class="">struct</span> <span style="color:rgb(204,153,205)" class="">MyPackage</span> <span style="" class="">{</span>
<span style="color:rgb(153,153,153)" class="">// meta data</span>
<span style="" class="">}</span></code></pre><p style="margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class="">And then somewhere in the package you can dump/use the version info like this:</p><pre style="margin-top:0.5em;margin-bottom:0.5em;background-color:rgb(45,45,45);border:1px solid rgb(204,204,204);font-size:13px;line-height:1.5;overflow:auto;padding:1em;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;color:rgb(204,204,204);font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;direction:ltr;word-wrap:normal" class=""><code style="margin:0px;padding:0px;border:none;background-color:transparent;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;direction:ltr;word-spacing:normal;word-wrap:normal;line-height:1.5" class=""><span style="color:rgb(153,153,153)" class="">// Somewhere in MyPackage</span>
<span style="color:rgb(204,153,205)" class="">import</span> <span style="color:rgb(204,153,205)" class="">PackageVersions</span>
<span style="color:rgb(240,141,73)" class="">print</span><span style="" class="">(</span><span style="color:rgb(126,198,153)" class="">"<span style="" class=""><span style="" class="">\(</span><span style="color:rgb(204,153,205)" class="">PackageVersions</span><span style="color:rgb(204,204,204)" class="">.</span><span style="color:rgb(204,153,205)" class="">FirstDependency</span><span style="" class="">)</span></span>"</span><span style="" class="">)</span></code></pre><p style="margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class=""><br class=""></p><p style="margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class="">Sounds good but if its only generated for root package what happens when that root package is being used as a dependency somewhere?<br class=""></p></div><div class=""><br class=""></div><div class=""><br class=""></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Mon, Jul 4, 2016 at 9:32 PM, Kostiantyn Koval via swift-build-dev <span dir="ltr" class=""><<a href="mailto:swift-build-dev@swift.org" target="_blank" class="">swift-build-dev@swift.org</a>></span> wrote:<br class=""><blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex" class="gmail_quote"><div style="word-wrap:break-word" class="">Hello Swift Package Manager contributors<div class=""><br class=""></div><div class="">We have been working on a <b class="">PackageVersions </b>feature and we would like to hear your feedback and ideas.</div><div class=""><br class=""></div><div class=""><b class="">Idea:</b></div><div class="">We would like to generate Version information about package. The package would be able to import <b class="">PackageVersions </b>module and use that information.</div><div class=""><br class=""></div><div class=""><b class="">Use case:</b></div><div class="">A web server product provides diagnostics when it fails to connect to its port, part of this diagnostics is a dump of the version information for the socket library it uses.<br class=""></div><div class="">Real uses case - <a href="https://github.com/IBM-Swift/Kitura/pull/352/files" target="_blank" class="">https://github.com/IBM-Swift/Kitura/pull/352/files</a></div><div class=""><br class=""></div><div class=""><b class="">Format:</b></div><div class="">- url: a git origin of a package or local path if there is no git (package not published yet),</div><div class="">- package version</div><div class="">- version string representation</div><div class="">- SHA of of a commit made after checked <span style="font-family:Menlo;font-size:11px" class="">version</span></div><div class="">- modified, are there any uncommitted changes to the package.</div><div class=""><br class=""></div><div class=""><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(180,38,26)" class=""><span style="color:#0433ff" class="">public</span><span style="" class=""> </span><span style="color:#0433ff" class="">let</span><span style="" class=""> url: </span><span style="color:#3495af" class="">String</span><span style="" class=""> = </span>"<a href="https://github.com/apple/swift-package-manager.git" target="_blank" class="">https://github.com/apple/swift-package-manager.git</a>"</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="color:#0433ff" class="">public</span><span class=""> </span><span style="color:#0433ff" class="">let</span><span class=""> version: (major: </span><span style="color:#3495af" class="">Int</span><span class="">, minor: </span><span style="color:#3495af" class="">Int</span><span class="">, patch: </span><span style="color:#3495af" class="">Int</span><span class="">, prereleaseIdentifiers: [</span><span style="color:#3495af" class="">String</span><span class="">], buildMetadata: </span><span style="color:#3495af" class="">String</span><span class="">?) = (0, 2, 2, [], </span><span style="color:#0433ff" class="">nil</span><span class="">)</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="color:#0433ff" class="">public</span><span class=""> </span><span style="color:#0433ff" class="">let</span><span class=""> versionString: </span><span style="color:#3495af" class="">String</span><span class=""> = </span><span style="color:#b4261a" class="">"0.2.2"</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="color:#0433ff" class="">public</span><span class=""> </span><span style="color:#0433ff" class="">let</span><span class=""> sha: </span><span style="color:#3495af" class="">String</span><span class="">? = </span><span style="color:#b4261a" class="">"</span><span style="color:#b4261a" class="">154cf23f74efa6c596bd25f4caa5a3bd20c78c4f"</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="color:#0433ff" class="">public</span><span class=""> </span><span style="color:#0433ff" class="">let</span><span class=""> modified: </span><span style="color:#3495af" class="">Bool</span><span class=""> = </span><span style="color:#0433ff" class="">true </span></div></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><br class=""></div><div class="">Concerns and questions:</div><div class=""><div class="">- "We think that this should only be generated for the root-package, the rationale here is that we don't want packages writing code like if<b class=""> version.major > 2</b> as this should be a compile time language feature and Swift core are already on board with this idea.”</div></div><div class="">- Should a package have access to own dependencies VersionData information ?</div><div class=""> </div><div class="">You can find more information here.</div><div class=""><a href="https://github.com/apple/swift-package-manager/pull/122" target="_blank" class="">https://github.com/apple/swift-package-manager/pull/122</a></div><div class=""><a href="https://bugs.swift.org/browse/SR-473" target="_blank" class="">https://bugs.swift.org/browse/SR-473</a></div><div class=""><br class=""></div><div class="">Looking forward for your feedback</div><span class="HOEnZb"><font color="#888888" class=""><div class="">- Kostiantyn</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div>
</font></span></div><br class="">_______________________________________________<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="">
<a href="https://lists.swift.org/mailman/listinfo/swift-build-dev" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-build-dev</a><br class="">
<br class=""></blockquote></div><br class=""><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div data-smartmail="gmail_signature" class="gmail_signature">Ankit<br class=""><br class=""></div>
</div>
</div></blockquote></div><br class=""></div></div></div></body></html>