<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jul 13, 2016, at 1:56 AM, Honza Dvorsky <<a href="mailto:jan.dvorsky@me.com" class="">jan.dvorsky@me.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Very happy to see this proposal, thanks Ankit for pushing it forward! I can't wait to be able to hide many example executables in my packages, as I've been getting a steady stream of complaints from people being annoyed about the polluted compilation log and slower compilation times.<div class=""><br class=""></div><div class="">However I'm leaning towards keeping the default module visibility to <i class="">public</i>, not <i class="">private</i>. I appreciate all the arguments that compare targets with code in Swift, where the default is internal - and it makes sense. But the more pragmatic side of me feels that it might become a piece of boilerplate we'll have to write in our manifests for a long time, without much benefit (but with regret). And adding magic to sometimes export by default (single module packages or modules matching the packages name) IMO just complicates the conceptual model of how SwiftPM treats package manifests. I think we should be very careful with adding such nonlinear behaviors (where e.g. adding another module suddenly breaks the package's visible targets), and in this case I don't believe it's justified. (That's while completely ignoring the fact that such a change would break 100% of packages out there, which could be a toll on the good will the project seems to have right now. Not that we should never make breaking changes, I just feel we should give a good reason we're making them, potentially to allow a new feature. Which is not the case here.) </div></div></div></blockquote><div><br class=""></div>I agree, this is a big concern of mine as well.</div><div><br class=""></div><div>Ankit and I discussed this at length last night and he has updated the proposal here:</div><div> <a href="https://github.com/aciidb0mb3r/swift-evolution/blob/swiftpm-module-access-control/proposals/xxxx-swiftpm-target-access-control.md" class="">https://github.com/aciidb0mb3r/swift-evolution/blob/swiftpm-module-access-control/proposals/xxxx-swiftpm-target-access-control.md</a></div><div><br class=""></div><div><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="">That's my two cents. :)</div><div class=""><br class=""></div><div class="">Overall I'm enthusiastic about this proposal, it will solve a few real issues I'm having with my projects! </div><div class=""><br class=""></div><div class="">While I don't think we should add this to the proposal - it might be very useful to add a mode to SwiftPM that dumps the module visibility information. I think that should be added regardless of what the default visibility ends up being.</div></div></div></blockquote><div><br class=""></div><div>I agree. I would like a `swift package describe` which shows how the convention system and manifest are causing the package to be interpreted. It would show things like the targets, dependencies, etc.</div><div><br class=""></div><div> - Daniel</div><div class=""><br class=""></div><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="">Something like:</div><div class=""><i class="">$ swift package show-target-visibility</i></div><div class="">Found 3 modules</div><div class=""><br class=""></div><div class=""><b class="">Public:</b></div><div class="">Foo</div><div class=""><br class=""></div><div class=""><b class="">Private:</b></div><div class="">PrivateBar</div><div class="">ExampleFoo</div><div class=""><br class=""></div><div class="">- Honza</div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Tue, Jul 12, 2016 at 8:16 PM Ankit Agarwal via swift-build-dev <<a href="mailto:swift-build-dev@swift.org" class="">swift-build-dev@swift.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="">I have updated the proposal accommodating recent discussion<div class=""><br class=""></div><div class="">Link: <a href="https://github.com/aciidb0mb3r/swift-evolution/blob/swiftpm-module-access-control/proposals/xxxx-swiftpm-target-access-control.md" target="_blank" class="">https://github.com/aciidb0mb3r/swift-evolution/blob/swiftpm-module-access-control/proposals/xxxx-swiftpm-target-access-control.md</a></div><div class=""><br class=""></div><div class=""></div></div><div dir="ltr" class=""><div class=""><h1 style="margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px; font-size: 28px; font-family: Helvetica, arial, sans-serif; margin-top: 0px !important;" class="">SwiftPM Target Access Control</h1><ul style="margin: 15px 0px; padding-left: 30px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class=""><li style="margin:0px" class="">Proposal: <a href="https://github.com/apple/swift-evolution/blob/master/proposals/xxxx-swiftpm-target-access-control.md" style="color:rgb(65,131,196);margin-top:0px" target="_blank" class="">SE-XXXX</a></li><li style="margin:0px" class="">Author: <a href="https://github.com/aciidb0mb3r" style="color:rgb(65,131,196);margin-top:0px" target="_blank" class="">Ankit Aggarwal</a></li><li style="margin:0px" class="">Status: <strong style="margin-top:0px" class="">In Discussion</strong></li><li style="margin:0px" class="">Review manager: TBD</li></ul><h2 style="margin: 20px 0px 10px; padding: 0px; font-size: 24px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(204, 204, 204); font-family: Helvetica, arial, sans-serif;" class="">Introduction</h2><p style="margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class="">This proposal aims to address two issues:</p></div></div><div dir="ltr" class=""><div class=""><ol style="margin: 15px 0px; padding-left: 30px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class=""><li style="margin:0px" class=""><p style="margin:0px 0px 15px" class="">Control over the targets exposed (and built) when a SwiftPM package is used as a dependency i.e. the targets which are exported and can be used in other packages.</p></li><li style="margin:0px" class=""><p style="margin:0px 0px 15px" class="">Specify external target dependencies of a target.</p></li></ol><p style="margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class=""><a href="https://lists.swift.org/pipermail/swift-build-dev/Week-of-Mon-20160704/000531.html" style="color:rgb(65,131,196)" target="_blank" class="">swift-evolution thread</a></p></div></div><div dir="ltr" class=""><div class=""><h2 style="margin: 20px 0px 10px; padding: 0px; font-size: 24px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(204, 204, 204); font-family: Helvetica, arial, sans-serif;" class="">Motivation</h2><h4 style="margin: 20px 0px 10px; padding: 0px; font-size: 16px; font-family: Helvetica, arial, sans-serif;" class="">1. Control over exposed targets:</h4></div></div><div dir="ltr" class=""><div class=""><p style="margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class="">SwiftPM allows multiple targets (or modules) inside a package. Most of the time package author will want to provide one (or more) stable public/exported target which should be utilised by other packages. We should actively discourage use of targets which are not meant to be imported by other packages.</p><p style="margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class="">Additionally packages usually contain sample usage or example targets which are useful during development or testing of the package but are redundant when the package is used as a dependency. This increases compilation time for the user of the package which can be avoided.</p></div></div><div dir="ltr" class=""><div class=""><p style="margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class="">As a concrete example: Vapor has a target called <a href="https://github.com/qutheory/vapor/tree/master/Sources/Development" style="color:rgb(65,131,196)" target="_blank" class=""><code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" class="">Development</code></a>.</p></div></div><div dir="ltr" class=""><div class=""><h4 style="margin: 20px 0px 10px; padding: 0px; font-size: 16px; font-family: Helvetica, arial, sans-serif;" class="">2. Specify external target dependencies of a target:</h4><p style="margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class="">Currently all the targets of an external dependency are implicitly built and exposed to the user package. This works well for one target package but becomes unclear which targets are using which target of an external dependency.</p><p style="margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class="">Moreover user of a package may only be interested in few targets of a dependency instead of all the exposed targets. Currently there is no way to state this in <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" class="">Package.swift</code>.</p><p style="margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class="">For e.g.: One would like to use the targets <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" class="">libc</code>, <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" class="">POSIX</code>, <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" class="">Basic</code> of SwiftPM but don't want other targets to be built or exposed in their package.</p></div></div><div dir="ltr" class=""><div class=""><h2 style="margin: 20px 0px 10px; padding: 0px; font-size: 24px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(204, 204, 204); font-family: Helvetica, arial, sans-serif;" class="">Proposed Solution</h2><h4 style="margin: 20px 0px 10px; padding: 0px; font-size: 16px; font-family: Helvetica, arial, sans-serif;" class="">1. Control over exposed targets:</h4></div></div><div dir="ltr" class=""><div class=""><p style="margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class="">I propose that all targets should by default be private/unexported. Authors should explicitly mark the targets they want to expose as exported/public.</p><p style="margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class="">To mark a target as exported/public I propose <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" class="">PackageDescription</code>'s <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" class="">Target</code> gains a <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" class="">flags</code> property which would be a <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" class="">Set</code> of the following <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" class="">Flag</code> enum declared inside <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" class="">Target</code> class:</p><pre style="margin-top: 0.5em; margin-bottom: 0.5em; background-color: rgb(245, 242, 240); 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; 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(0,119,170)" class="">public</span> <span style="color:rgb(0,119,170)" class="">enum</span> <span style="color:rgb(102,153,0)" class="">Flag</span> <span style="color:rgb(153,153,153)" class="">{</span>
<span style="color:rgb(112,128,144)" class="">/// Makes the target public or "exported" for other packages to use.</span>
<span style="color:rgb(0,119,170)" class="">case</span> <span style="color:rgb(0,119,170)" class="">public</span>
<span style="color:rgb(153,153,153)" class="">}</span></code></pre><p style="margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class="">The <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" class="">Flag</code> enum will be flexible in case we need to add more attributes in future as opposed to a boolean property to mark the public nature of the target.</p><p style="margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class=""><code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" class="">exported</code> is also a choice instead of <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" class="">public</code> which matches the semantics here. However <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" class="">public</code> is equally clear in current context.</p><p style="margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class="">We can keep some obvious defaults for targets which can be implicitly public for e.g. </p><ol style="margin: 15px 0px; padding-left: 30px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class=""><li style="margin:0px" class="">Package has only one target.</li><li style="margin:0px" class="">Target with same name as package.</li></ol><p style="margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class="">Or have all targets be public (the current behaviour) until some target uses the public flag assuming full control over all the exported target. This has an advantage that only larger projects which cares about this need to maintain it.</p><p style="margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class="">However I believe private by default and explicit public declaration is the right way to go here to avoid the misuse of packages/targets which are not intended to act as a dependency and the public targets will become obvious (and documented) in the manifest file.</p><h2 style="margin: 20px 0px 10px; padding: 0px; font-size: 24px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(204, 204, 204); font-family: Helvetica, arial, sans-serif;" class=""></h2><p style="margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class="">It should be noted that this behaviour cannot be enforced by the compiler right now and there is no way to stop symbols from other modules from leaking out. For e.g. there could be a type used in the public interface which belongs to a private target.</p><p style="margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class="">Dependencies of the public targets will also leak and can be imported since they'll become transitive dependency of some target.</p><p style="margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class="">Hopefully we can enforce this using compiler feature in future.</p><p style="margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class="">Swift compiler might gain support for package-level namespaces and access control in future to solve problems like module name collision i.e. two packages have modules with same name. At that point we will probably need to rethink the manifest file.</p><h4 style="margin: 20px 0px 10px; padding: 0px; font-size: 16px; font-family: Helvetica, arial, sans-serif;" class="">2. Specify external target dependencies of a target:</h4><p style="margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class="">I propose that enum <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" class="">Target.Dependency</code> gains a new case <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" class="">External(package: String, target: String)</code> to declare dependency on an external package's target. The enum would look like this after modification:</p><pre style="margin-top: 0.5em; margin-bottom: 0.5em; background-color: rgb(245, 242, 240); 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; 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(112,128,144)" class="">/// The description for an individual target or package dependency.</span>
<span style="color:rgb(0,119,170)" class="">public</span> <span style="color:rgb(0,119,170)" class="">enum</span> <span style="color:rgb(102,153,0)" class="">Dependency</span> <span style="color:rgb(153,153,153)" class="">{</span>
<span style="color:rgb(112,128,144)" class="">/// A dependency on a target in the same project.</span>
<span style="color:rgb(0,119,170)" class="">case</span> <span style="color:rgb(221,74,104)" class="">Target</span><span style="color:rgb(153,153,153)" class="">(</span>name<span style="color:rgb(153,153,153)" class="">:</span> <span style="color:rgb(102,153,0)" class="">String</span><span style="color:rgb(153,153,153)" class="">)</span>
<span style="color:rgb(112,128,144)" class="">/// A dependency on a target in a external package.</span>
<span style="color:rgb(0,119,170)" class="">case</span> <span style="color:rgb(221,74,104)" class="">External</span><span style="color:rgb(153,153,153)" class="">(</span>package<span style="color:rgb(153,153,153)" class="">:</span> <span style="color:rgb(102,153,0)" class="">String</span><span style="color:rgb(153,153,153)" class="">,</span> target<span style="color:rgb(153,153,153)" class="">:</span> <span style="color:rgb(102,153,0)" class="">String</span><span style="color:rgb(153,153,153)" class="">)</span>
<span style="color:rgb(153,153,153)" class="">}</span></code></pre><p style="margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class="">Note that the package name is not <em class="">really</em> needed (at least currently) because the target names has to be unique across the dependency graph but it keeps the manifest file cleaner i.e. which external package this external target belongs to.</p><p style="margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class="">An external package dependency declaration implicitly becomes dependency of each target in the package. I propose this behaviour should be retained but if a target dependency contains an <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" class="">External</code> declaration then all other targets which wants to use that external dependency should explicitly state their dependency on that external package using <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" class="">External</code>.</p></div></div><div dir="ltr" class=""><div class=""><h2 style="margin: 20px 0px 10px; padding: 0px; font-size: 24px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(204, 204, 204); font-family: Helvetica, arial, sans-serif;" class="">Detailed Design</h2><h4 style="margin: 20px 0px 10px; padding: 0px; font-size: 16px; font-family: Helvetica, arial, sans-serif;" class="">1. Control over exposed targets:</h4><p style="margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class="">Consider a package with following structure: </p><pre style="margin-top: 0.5em; margin-bottom: 0.5em; background-color: rgb(245, 242, 240); 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; 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="">├── Package.swift
└── Sources
├── FooLibrary
│ └── Foo.swift
└── SampleCLI
└── main.swift</code></pre></div></div><div dir="ltr" class=""><div class=""><p style="margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class="">The manifest with a public target could look like:</p><pre style="margin-top: 0.5em; margin-bottom: 0.5em; background-color: rgb(245, 242, 240); 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; 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=""></code></pre></div></div><div dir="ltr" class=""><div class=""><pre style="margin-top: 0.5em; margin-bottom: 0.5em; background-color: rgb(245, 242, 240); 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; 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(0,119,170)" class="">import</span> <span style="color:rgb(102,153,0)" class="">PackageDescription</span>
<span style="color:rgb(0,119,170)" class="">let</span> package <span style="color:rgb(166,127,89);background-color:rgba(255,255,255,0.498039)" class="">=</span> <span style="color:rgb(221,74,104)" class="">Package</span><span style="color:rgb(153,153,153)" class="">(</span>
name<span style="color:rgb(153,153,153)" class="">:</span> <span style="color:rgb(102,153,0)" class="">"FooLibrary"</span><span style="color:rgb(153,153,153)" class="">,</span>
targets<span style="color:rgb(153,153,153)" class="">:</span> <span style="color:rgb(153,153,153)" class="">[</span></code></pre></div></div><div dir="ltr" class=""><div class=""><pre style="margin-top: 0.5em; margin-bottom: 0.5em; background-color: rgb(245, 242, 240); 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; 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(221,74,104)" class="">Target</span><span style="color:rgb(153,153,153)" class="">(</span>name<span style="color:rgb(153,153,153)" class="">:</span> <span style="color:rgb(102,153,0)" class="">"FooLibrary"</span><span style="color:rgb(153,153,153)" class="">,</span> flags<span style="color:rgb(153,153,153)" class="">:</span> <span style="color:rgb(153,153,153)" class="">[</span><span style="color:rgb(153,153,153)" class="">.</span><span style="color:rgb(0,119,170)" class="">public</span><span style="color:rgb(153,153,153)" class="">]</span><span style="color:rgb(153,153,153)" class="">)</span><span style="color:rgb(153,153,153)" class="">,</span>
<span style="color:rgb(221,74,104)" class="">Target</span><span style="color:rgb(153,153,153)" class="">(</span>name<span style="color:rgb(153,153,153)" class="">:</span> <span style="color:rgb(102,153,0)" class="">"SampleCLI"</span><span style="color:rgb(153,153,153)" class="">,</span> dependencies<span style="color:rgb(153,153,153)" class="">:</span> <span style="color:rgb(153,153,153)" class="">[</span><span style="color:rgb(102,153,0)" class="">"FooLibrary"</span><span style="color:rgb(153,153,153)" class="">]</span><span style="color:rgb(153,153,153)" class="">)</span><span style="color:rgb(153,153,153)" class="">,</span>
<span style="color:rgb(153,153,153)" class="">]</span><span style="color:rgb(153,153,153)" class="">)</span></code></pre></div></div><div dir="ltr" class=""><div class=""><p style="margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class="">When this package is used as a dependency only <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" class="">FooLibrary</code> is built and is importable.</p></div></div><div dir="ltr" class=""><div class=""><h4 style="margin: 20px 0px 10px; padding: 0px; font-size: 16px; font-family: Helvetica, arial, sans-serif;" class="">2. Specify external target dependencies of a target:</h4></div></div><div dir="ltr" class=""><div class=""><p style="margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class="">Consider a dependency with following manifest file:</p></div></div><div dir="ltr" class=""><div class=""><pre style="margin-top: 0.5em; margin-bottom: 0.5em; background-color: rgb(245, 242, 240); 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; 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(0,119,170)" class="">import</span> <span style="color:rgb(102,153,0)" class="">PackageDescription</span>
<span style="color:rgb(0,119,170)" class="">let</span> package <span style="color:rgb(166,127,89);background-color:rgba(255,255,255,0.498039)" class="">=</span> <span style="color:rgb(221,74,104)" class="">Package</span><span style="color:rgb(153,153,153)" class="">(</span>
name<span style="color:rgb(153,153,153)" class="">:</span> <span style="color:rgb(102,153,0)" class="">"FooLibrary"</span><span style="color:rgb(153,153,153)" class="">,</span>
targets<span style="color:rgb(153,153,153)" class="">:</span> <span style="color:rgb(153,153,153)" class="">[</span>
<span style="color:rgb(221,74,104)" class="">Target</span><span style="color:rgb(153,153,153)" class="">(</span>name<span style="color:rgb(153,153,153)" class="">:</span> <span style="color:rgb(102,153,0)" class="">"Foo"</span><span style="color:rgb(153,153,153)" class="">)</span><span style="color:rgb(153,153,153)" class="">,</span></code></pre></div></div><div dir="ltr" class=""><div class=""><pre style="margin-top: 0.5em; margin-bottom: 0.5em; background-color: rgb(245, 242, 240); 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; 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(221,74,104)" class="">Target</span><span style="color:rgb(153,153,153)" class="">(</span>name<span style="color:rgb(153,153,153)" class="">:</span> <span style="color:rgb(102,153,0)" class="">"Bar"</span><span style="color:rgb(153,153,153)" class="">,</span> dependencies<span style="color:rgb(153,153,153)" class="">:</span> <span style="color:rgb(153,153,153)" class="">[</span><span style="color:rgb(102,153,0)" class="">"Foo"</span><span style="color:rgb(153,153,153)" class="">]</span><span style="color:rgb(153,153,153)" class="">,</span> flags<span style="color:rgb(153,153,153)" class="">:</span> <span style="color:rgb(153,153,153)" class="">[</span><span style="color:rgb(153,153,153)" class="">.</span><span style="color:rgb(0,119,170)" class="">public</span><span style="color:rgb(153,153,153)" class="">]</span><span style="color:rgb(153,153,153)" class="">)</span><span style="color:rgb(153,153,153)" class="">,</span>
<span style="color:rgb(221,74,104)" class="">Target</span><span style="color:rgb(153,153,153)" class="">(</span>name<span style="color:rgb(153,153,153)" class="">:</span> <span style="color:rgb(102,153,0)" class="">"Baz"</span><span style="color:rgb(153,153,153)" class="">,</span> flags<span style="color:rgb(153,153,153)" class="">:</span> <span style="color:rgb(153,153,153)" class="">[</span><span style="color:rgb(153,153,153)" class="">.</span><span style="color:rgb(0,119,170)" class="">public</span><span style="color:rgb(153,153,153)" class="">]</span><span style="color:rgb(153,153,153)" class="">)</span><span style="color:rgb(153,153,153)" class="">,</span>
<span style="color:rgb(153,153,153)" class="">]</span><span style="color:rgb(153,153,153)" class="">)</span></code></pre></div></div><div dir="ltr" class=""><div class=""><p style="margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class="">To get only the <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" class="">Bar</code> target from the above package, following manifest could be written:</p></div></div><div dir="ltr" class=""><div class=""><pre style="margin-top: 0.5em; margin-bottom: 0.5em; background-color: rgb(245, 242, 240); 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; 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(0,119,170)" class="">import</span> <span style="color:rgb(102,153,0)" class="">PackageDescription</span>
<span style="color:rgb(0,119,170)" class="">let</span> package <span style="color:rgb(166,127,89);background-color:rgba(255,255,255,0.498039)" class="">=</span> <span style="color:rgb(221,74,104)" class="">Package</span><span style="color:rgb(153,153,153)" class="">(</span></code></pre></div></div><div dir="ltr" class=""><div class=""><pre style="margin-top: 0.5em; margin-bottom: 0.5em; background-color: rgb(245, 242, 240); 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; 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="">
name<span style="color:rgb(153,153,153)" class="">:</span> <span style="color:rgb(102,153,0)" class="">"BarUser"</span><span style="color:rgb(153,153,153)" class="">,</span>
targets<span style="color:rgb(153,153,153)" class="">:</span> <span style="color:rgb(153,153,153)" class="">[</span>
<span style="color:rgb(221,74,104)" class="">Target</span><span style="color:rgb(153,153,153)" class="">(</span>name<span style="color:rgb(153,153,153)" class="">:</span> <span style="color:rgb(102,153,0)" class="">"BarUser"</span><span style="color:rgb(153,153,153)" class="">,</span>
dependencies<span style="color:rgb(153,153,153)" class="">:</span> <span style="color:rgb(153,153,153)" class="">[</span><span style="color:rgb(153,153,153)" class="">.</span><span style="color:rgb(221,74,104)" class="">External</span><span style="color:rgb(153,153,153)" class="">(</span>package<span style="color:rgb(153,153,153)" class="">:</span> <span style="color:rgb(102,153,0)" class="">"FooLibrary"</span><span style="color:rgb(153,153,153)" class="">,</span> target<span style="color:rgb(153,153,153)" class="">:</span> <span style="color:rgb(102,153,0)" class="">"Bar"</span><span style="color:rgb(153,153,153)" class="">)</span>
<span style="color:rgb(153,153,153)" class="">]</span><span style="color:rgb(153,153,153)" class="">)</span>
<span style="color:rgb(153,153,153)" class="">]</span><span style="color:rgb(153,153,153)" class="">,</span></code></pre></div></div><div dir="ltr" class=""><div class=""><pre style="margin-top: 0.5em; margin-bottom: 0.5em; background-color: rgb(245, 242, 240); 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; 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="">
dependencies<span style="color:rgb(153,153,153)" class="">:</span> <span style="color:rgb(153,153,153)" class="">[</span>
<span style="color:rgb(153,153,153)" class="">.</span><span style="color:rgb(221,74,104)" class="">Package</span><span style="color:rgb(153,153,153)" class="">(</span>
url<span style="color:rgb(153,153,153)" class="">:</span> <span style="color:rgb(102,153,0)" class="">"../FooLibrary"</span><span style="color:rgb(153,153,153)" class="">,</span></code></pre></div></div><div dir="ltr" class=""><div class=""><pre style="margin-top: 0.5em; margin-bottom: 0.5em; background-color: rgb(245, 242, 240); 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; 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="">
majorVersion<span style="color:rgb(153,153,153)" class="">:</span> <span style="color:rgb(153,0,85)" class="">1</span><span style="color:rgb(153,153,153)" class="">)</span>
<span style="color:rgb(153,153,153)" class="">]</span><span style="color:rgb(153,153,153)" class="">)</span></code></pre><p style="margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class="">Note: In this case since <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" class="">Bar</code> depends on <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" class="">Foo</code>, <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" class="">Foo</code> will be also be implicitly built but <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" class="">Baz</code> need not be compiled at all.</p><p style="margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class="">Also Note: If the external dependency is not declared then both <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" class="">Bar</code> and <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" class="">Baz</code> will be available to <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" class="">BarUser</code>.</p><h2 style="margin: 20px 0px 10px; padding: 0px; font-size: 24px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(204, 204, 204); font-family: Helvetica, arial, sans-serif;" class="">Impact on Existing Code</h2></div></div><div dir="ltr" class=""><div class=""><h4 style="margin: 20px 0px 10px; padding: 0px; font-size: 16px; font-family: Helvetica, arial, sans-serif;" class="">1. Control over exposed targets:</h4></div></div><div dir="ltr" class=""><div class=""><p style="margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class="">All targets will become private by default so package authors will need to mark the targets they want to expose as public.</p><h4 style="margin: 20px 0px 10px; padding: 0px; font-size: 16px; font-family: Helvetica, arial, sans-serif;" class="">2. Specify external target dependencies of a target:</h4><p style="margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class="">None as all the public targets will still be dependencies to the overall package when <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" class="">External</code> is not used.</p></div></div><div dir="ltr" class=""><div class=""><h2 style="margin: 20px 0px 10px; padding: 0px; font-size: 24px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(204, 204, 204); font-family: Helvetica, arial, sans-serif;" class="">Alternatives Considered</h2><p style="margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px;" class="">None at this time.</p></div></div><div dir="ltr" class=""><div class=""></div></div>
_______________________________________________<br class="">
swift-build-dev mailing list<br class="">
<a href="mailto:swift-build-dev@swift.org" target="_blank" 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="">
</blockquote></div>
</div></blockquote></div><br class=""></body></html>