<div dir="ltr">Hi,<div><br></div><div>Thank you all for the feedback so far. I have updated the proposal: <a href="https://github.com/aciidb0mb3r/swift-evolution/blob/manifest-api-redesign/proposals/xxxx-package-manager-manifest-api-redesign.md">https://github.com/aciidb0mb3r/swift-evolution/blob/manifest-api-redesign/proposals/xxxx-package-manager-manifest-api-redesign.md</a></div><div><br></div><div>The major changes are:</div><div><br></div><div>* Drop SystemPackageProvider struct upgrade.</div><div>* Drop the identity rule.<br></div><div>* Targets and Products will use factory methods.</div><div>* Rename VersionSetSpecifier to Requirement (because we also support revision and branches and not just versions).</div><div>* Add a section on example manifests.<br></div><div><br></div><div>Note that there are collapsed examples and diffs in each proposed change. Click &quot;view example&quot; to expand the examples.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 1, 2017 at 3:37 AM, Jens Nerup via swift-build-dev <span dir="ltr">&lt;<a href="mailto:swift-build-dev@swift.org" target="_blank">swift-build-dev@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div>Hi Daniel,</div><div><br></div><div>Thanks for the reply. Sorry I wasn&#39;t clear - by removal I actually meant remove pkgConfig from the Package, and introduce it in a custom build configuration (associated with a Target). I think pkgConfig and custom build configurations may fit nicely together. And you are absolutely right this is probably best suited for a follow on to the current manifest API redesign. Let&#39;s discuss that later and once again thank you for your quick reply.</div>
</div><div><br class="m_-8627420445072186650webkit-block-placeholder"></div><div>Regards,</div><div><br></div><div>Jens</div><div><div class="h5">
<br><div><blockquote type="cite"><div>On 28 Feb 2017, at 17.05, Daniel Dunbar &lt;<a href="mailto:daniel_dunbar@apple.com" target="_blank">daniel_dunbar@apple.com</a>&gt; wrote:</div><br class="m_-8627420445072186650Apple-interchange-newline"><div><div style="word-wrap:break-word"><br><div><blockquote type="cite"><div>On Feb 28, 2017, at 12:28 AM, Jens Nerup &lt;<a href="mailto:jens@makecph.com" target="_blank">jens@makecph.com</a>&gt; wrote:</div><br class="m_-8627420445072186650Apple-interchange-newline"><div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div>Hello Daniel,</div><div><br></div><div>In general I’m really happy with the changes in the proposal and especially after you have incorporated the comments from David (Thanks David). In the proposal it is stated that the exclude section may be eliminated as soon as we have custom layouts. My question is: would pkgConfig be a candidate for removal as soon as we have support for custom build configurations?</div></div></div></blockquote><div><br></div>I don&#39;t think so, I don&#39;t think custom build configurations will be a replacement for the pkgConfig functionality, which is trying to gather settings from *outside* the package.</div><div><br></div><div>I agree with the sentiment that it is an awkward thing to have the system module map package initializer, but unfortunately I think we may have to live with it for the time being. We have briefly discussed making it be a target not a package thing, and perhaps the move to using `.target()` should actually encourage us to do that, but that is probably something best done as a follow on to the manifest API redesign (as with exclude) given its limited scope.</div><div><br></div><div> - Daniel</div><div><br><blockquote type="cite"><div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div><br></div><div>Regards,</div><div><br></div><div>Jens</div></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><blockquote type="cite"><div>On 28 Feb 2017, at 01.50, Daniel Dunbar via swift-build-dev &lt;<a href="mailto:swift-build-dev@swift.org" target="_blank">swift-build-dev@swift.org</a>&gt; wrote:</div><br class="m_-8627420445072186650Apple-interchange-newline"><div><div style="word-wrap:break-word">Hi David,<div><br></div><div>We discussed the leading-dot &amp; capitalization issue today again... this was already something we weren&#39;t really happy about, but had chosen to live with (using the &quot;identity&quot; rule to determine what was a type and what wasn&#39;t). However, as we talked it over more we:</div><div>1. Felt that for the product types, using .library vs .Library would be reasonable and consistent with a user model of thinking of these like enums (even though they won&#39;t actually be in practice, we will use factory functions on Product to make the dot work and keep the space extensible).</div><div>2. Realized that using .target would be a useful change to make now if we ever ended up needing to make the Targets array polymorphic (not something we plan to do now, but it never hurts to have it be extensible).</div><div>so we decided to go ahead and revise to a model where we use leading-dot + lowercase for everything (except Package), including reverting SystemPackageProvider to the `.brew(...)` style syntax.</div><div><br></div><div>Thanks for the feedback!</div><div> - Daniel</div><div><br><div><blockquote type="cite"><div>On Feb 27, 2017, at 2:21 AM, Ankit Aggarwal via swift-build-dev &lt;<a href="mailto:swift-build-dev@swift.org" target="_blank">swift-build-dev@swift.org</a>&gt; wrote:</div><br class="m_-8627420445072186650Apple-interchange-newline"><div><div dir="ltr" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">Hi David,<div><br></div><div>Thanks for the feedback! Comments inline:</div><div><br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Feb 26, 2017 at 5:08 AM, David Hart via swift-build-dev<span class="m_-8627420445072186650Apple-converted-space"> </span><span dir="ltr">&lt;<a href="mailto:swift-build-dev@swift.org" target="_blank">swift-build-<wbr>dev@swift.org</a>&gt;</span><span class="m_-8627420445072186650Apple-converted-space"> </span>wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="auto"><div>Was looking forward to this :) here are my comments:</div><div><div class="m_-8627420445072186650gmail-h5"><div><br>On 25 Feb 2017, at 01:35, Rick Ballard via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><span>Hi all,</span><br><span></span><br><span>Ankit, Daniel, Anders, Boris and I have a draft proposal in progress for a Package.swift manifest API redesign for the Package Manager. We&#39;ll welcome comments or discussion at this time. My hope is that we can get this polished up and ready for evolution within the next week or so, but we&#39;ll see how the conversation goes!</span><br><span></span><br><span>You can see the proposal in progress at<span class="m_-8627420445072186650Apple-converted-space"> </span><a href="https://github.com/aciidb0mb3r/swift-evolution/blob/manifest-api-redesign/proposals/xxxx-package-manager-manifest-api-redesign.md" target="_blank">https://github.com/aciidb0m<wbr>b3r/swift-evolution/blob/<wbr>manifest-api-redesign/proposal<wbr>s/xxxx-package-manager-<wbr>manifest-api-redesign.md</a>. I&#39;m also including the current version inline in this email.</span><br><span></span><br><span>Thanks,</span><br><span></span><br><span>   - Rick</span><br><span></span><br><span># Package Manager Manifest API Redesign</span><br><span></span><br><span>* Proposal: [SE-XXXX](<a href="http://xxxx-package-manager-manifest-api-redesign.md/" target="_blank">xxxx-package-manager<wbr>-manifest-api-redesign.md</a>)</span><br><span>* Author: [Ankit Aggarwal](<a href="https://github.com/aciidb0mb3r" target="_blank">https://github.com/a<wbr>ciidb0mb3r</a>)</span><br><span>* Review Manager: TBD</span><br><span>* Status: **Discussion**</span><br><span></span><br><span>## Introduction</span><br><span></span><br><span>This is a proposal for redesigning the `Package.swift` manifest APIs provided</span><br><span>by Swift Package Manager.  </span><br><span>This proposal only redesigns the existing public APIs and does not add any</span><br><span>new functionality; any API to be added for new functionality will happen in</span><br><span>separate proposals.</span><br><span></span><br><span>## Motivation</span><br><span></span><br><span>The `Package.swift` manifest APIs were designed prior to the [API Design</span><br><span>Guidelines] (<a href="https://swift.org/documentation/api-design-guidelines/" target="_blank">https://swift.org/documentati<wbr>on/api-design-guidelines/</a>), and their</span><br><span>design was not reviewed by the evolution process. Additionally, there are</span><br><span>several small areas which can be cleaned up to make the overall API more</span><br><span>&quot;Swifty&quot;.</span><br><span></span><br><span>We would like to redesign these APIs as necessary to provide clean,</span><br><span>conventions-compliant APIs that we can rely on in the future. Because we</span><br><span>anticipate that the user community for the Swift Package Manager will grow</span><br><span>considerably in Swift 4, we would like to make these changes now, before</span><br><span>more packages are created using the old API.</span><br><span></span><br><span>## Proposed solution</span><br><span></span><br><span>Note: Access modifier is omitted from the diffs and examples for brevity. The</span><br><span>access modifier is `public` for all APIs unless specified.</span><br><span></span><br><span>* Remove `successor()` and `predecessor()` from `Version`.</span><br><span></span><br><span>   These methods neither have well defined semantics nor are used a lot</span><br><span>   (internally or publicly). For e.g., the current implementation of</span><br><span>   `successor()` always just increases the patch version.</span><br><span></span><br><span></span><br><span>   &lt;details&gt;</span><br><span>     &lt;summary&gt;View diff&lt;/summary&gt;</span><br><span>     &lt;p&gt;</span><br><span>   ```diff</span><br><span>   struct Version {</span><br><span>   -    func successor() -&gt; Version</span><br><span></span><br><span>   -    func predecessor() -&gt; Version</span><br><span>   }</span><br><span>   ```</span><br><span>   &lt;/p&gt;&lt;/details&gt;</span><br><span></span><br><span>* Make all properties of `Package` and `Target` mutable.</span><br><span></span><br><span>   Currently, `Package` has three immutable and four mutable properties, and</span><br><span>   `Target` has one immutable and one mutable property. We propose to make all</span><br><span>   properties mutable to allow complex customization on the package object</span><br><span>   after initial declaration.</span><br><span></span><br><span>   &lt;details&gt;</span><br><span>     &lt;summary&gt;View diff and example&lt;/summary&gt;</span><br><span>     &lt;p&gt;</span><br><span></span><br><span>     Diff:</span><br><span>   ```diff</span><br><span>   final class Target {</span><br><span>   -    let name: String</span><br><span>   +    var name: String</span><br><span>   }</span><br><span></span><br><span>   final class Package {</span><br><span>   -    let name: String</span><br><span>   +    var name: String</span><br><span></span><br><span>   -    let pkgConfig: String?</span><br><span>   +    var pkgConfig: String?</span><br><span></span><br><span>   -    let providers: [SystemPackageProvider]?</span><br><span>   +    var providers: [SystemPackageProvider]?</span><br><span>   }</span><br><span>   ```</span><br><span></span><br><span>   Example:</span><br><span>   ```swift</span><br><span>   let package = Package(</span><br><span>       name: &quot;FooPackage&quot;,</span><br><span>       targets: [</span><br><span>           Target(name: &quot;Foo&quot;, dependencies: [&quot;Bar&quot;]),</span><br><span>       ]</span><br><span>   )</span><br><span></span><br><span>   #if os(Linux)</span><br><span>   package.targets[0].dependen<wbr>cies = [&quot;BarLinux&quot;]</span><br><span>   #endif</span><br><span>   ```</span><br><span>   &lt;/p&gt;&lt;/details&gt;</span><br><span></span><br><span>* Change `Target.Dependency` enum cases to lowerCamelCase.</span><br><span></span><br><span>   According to API design guidelines, everything other than types should be in lowerCamelCase.</span><br><span></span><br><span>   &lt;details&gt;</span><br><span>     &lt;summary&gt;View diff and example&lt;/summary&gt;</span><br><span>     &lt;p&gt;</span><br><span></span><br><span>    Diff:</span><br><span>   ```diff</span><br><span>   enum Dependency {</span><br><span>   -    case Target(name: String)</span><br><span>   +    case target(name: String)</span><br><span></span><br><span>   -    case Product(name: String, package: String?)</span><br><span>   +    case product(name: String, package: String?)</span><br><span></span><br><span>   -    case ByName(name: String)</span><br><span>   +    case byName(name: String)</span><br><span>   }</span><br><span>   ```</span><br><span></span><br><span>   Example:</span><br><span>   ```diff</span><br><span>   let package = Package(</span><br><span>       name: &quot;FooPackage&quot;,</span><br><span>       targets: [</span><br><span>           Target(</span><br><span>               name: &quot;Foo&quot;,<span class="m_-8627420445072186650Apple-converted-space"> </span></span><br><span>               dependencies: [</span><br><span>   -                .Target(name: &quot;Bar&quot;),</span><br><span>   +                .target(name: &quot;Bar&quot;),</span><br><span></span><br><span>   -                .Product(name: &quot;SwiftyJSON&quot;, package: &quot;SwiftyJSON&quot;),</span><br><span>   +                .product(name: &quot;SwiftyJSON&quot;, package: &quot;SwiftyJSON&quot;),</span><br><span>               ]</span><br><span>           ),</span><br><span>       ]</span><br><span>   )</span><br><span>   ```</span><br><span>   &lt;/p&gt;&lt;/details&gt;</span><br><span></span><br><span>* Add default parameter to the enum case `Target.Dependency.product`.</span><br><span></span><br><span>   The associated value `package` in the (enum) case `product`, is an optional</span><br><span>   `String`. It should have the default value `nil` so clients don&#39;t need to</span><br><span>   write it if they prefer using explicit enum cases but don&#39;t want to specify</span><br><span>   the package name i.e. it should be possible to write `.product(name:</span><br><span>   &quot;Foo&quot;)` instead of `.product(name: &quot;Foo&quot;, package: nil)`.</span><br><span></span><br><span>   If</span><br><span>   [SE-0155](<a href="https://github.com/apple/swift-evolution/blob/master/proposals/0155-normalize-enum-case-representation.md" target="_blank">https://github.co<wbr>m/apple/swift-evolution/blob/<wbr>master/proposals/0155-normaliz<wbr>e-enum-case-representation.md</a>)</span><br><span>   is accepted, we can directly add a default value. Otherwise, we will use a</span><br><span>   static factory method to provide default value for `package`.</span><br><span></span><br><span>* Upgrade `SystemPackageProvider` enum to a struct.</span><br><span></span><br><span>   This enum allows SwiftPM System Packages to emit hints in case of build</span><br><span>   failures due to absence of a system package. Currently, only one system</span><br><span>   package per system packager can be specified. We propose to allow</span><br><span>   specifying multiple system packages by replacing the enum with this struct:</span><br><span></span><br><span>   ```swift</span><br><span>   public struct SystemPackageProvider {</span><br><span>       enum PackageManager {</span><br><span>           case apt</span><br><span>           case brew</span><br><span>       }</span><br><span></span><br><span>       /// The system package manager.</span><br><span>       let packageManager: PackageManager<span class="m_-8627420445072186650Apple-converted-space"> </span></span><br><span></span><br><span>       /// The array of system packages.</span><br><span>       let packages: [String]</span><br><span></span><br><span>       init(_ packageManager: PackageManager, packages: [String])</span><br><span>   }</span><br><span>   ```</span><br><span></span><br><span>   &lt;details&gt;</span><br><span>     &lt;summary&gt;View diff and example&lt;/summary&gt;</span><br><span>     &lt;p&gt;</span><br><span></span><br><span>    Diff:</span><br><span>   ```diff</span><br><span>   -enum SystemPackageProvider {</span><br><span>   -    case Brew(String)</span><br><span>   -    case Apt(String)</span><br><span>   -}</span><br><span></span><br><span>   +struct SystemPackageProvider {</span><br><span>   +    enum PackageManager {</span><br><span>   +        case apt</span><br><span>   +        case brew</span><br><span>   +    }</span><br><span>   +</span><br><span>   +    /// The system package manager.</span><br><span>   +    let packageManager: PackageManager<span class="m_-8627420445072186650Apple-converted-space"> </span></span><br><span>   +</span><br><span>   +    /// The array of system packages.</span><br><span>   +    let packages: [String]</span><br><span>   +</span><br><span>   +    init(_ packageManager: PackageManager, packages: [String])</span><br><span>   +}</span><br><span>   ```</span><br><span></span><br><span>   Example:</span><br><span></span><br><span>   ```diff</span><br><span>   let package = Package(</span><br><span>       name: &quot;Copenssl&quot;,</span><br><span>       pkgConfig: &quot;openssl&quot;,</span><br><span>       providers: [</span><br><span>   -        .Brew(&quot;openssl&quot;),</span><br><span>   +        SystemPackageProvider(.<wbr>brew, packages: [&quot;openssl&quot;]),</span><br><span></span><br><span>   -        .Apt(&quot;openssl-dev&quot;),</span><br><span>   +        SystemPackageProvider(.<wbr>apt, packages: [&quot;openssl&quot;, &quot;libssl-dev&quot;]),</span><br><span>       ]</span><br><span>   )</span><br><span>   ```</span><br><span>   &lt;/p&gt;&lt;/details&gt;</span><br></div></blockquote><div><br></div></div></div><div>Why not keep the enum and change the associated type to a String array?</div><span class="m_-8627420445072186650gmail-"><br></span></div></blockquote><div><br></div><div>True, we could do that but we&#39;d be repeating that information in every SystemPackager we add. Converting to a struct makes it easier to scale.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="auto"><span class="m_-8627420445072186650gmail-"><blockquote type="cite"><div><span>* Remove implicit target dependency rule for test targets.</span><br><span></span><br><span>   There is an implicit test target dependency rule: a test target &quot;FooTests&quot;</span><br><span>   implicity depends on a target &quot;Foo&quot;, if &quot;Foo&quot; exists and &quot;FooTests&quot; doesn&#39;t</span><br><span>   explicitly declare any dependency. We propose to remove this rule because:</span><br><span></span><br><span>   1. It is a non obvious &quot;magic&quot; rule that has to be learned.</span><br><span>   2. It is not possible for &quot;FooTests&quot; to remove dependency on &quot;Foo&quot; while</span><br><span>      having no other (target) dependency.</span><br><span>   3. It makes real dependencies less discoverable.</span><br><span>   4. It may cause issues when we get support for mechanically editing target</span><br><span>      dependencies.</span><br><span></span><br><span>* Introduce an &quot;identity rule&quot; to determine if an API should use an initializer</span><br><span> or a factory method:</span><br></div></blockquote><div><br></div></span><div>Could you explain this rule in more detail. What is an identity in this case? I&#39;m confused.</div></div></blockquote><div><br></div><div><br></div><div>This is similar to the rule we use to decide if something should be a struct or a class. If you&#39;re forming a concrete object, that would be an identity. Consider these two examples:</div><div><br></div><div>1. Target and its dependencies:</div><div><br></div><div>    Target(name: &quot;Foo&quot;, dependencies: [.target(name: &quot;Bar&quot;)])</div><div><br></div><div>Here the target Foo is being constructed, so an initializer is used. The target Bar is being referred in Foo&#39;s dependencies so that uses a factory method.</div><div><br></div><div>2. Product and product dependencies in targets:</div><div><br></div><div>When constructing the product, the initializer should be used:</div><div>    .Library(name: &quot;FooLib&quot;, targets: [&quot;Foo&quot;, &quot;Utility&quot;])</div><div><br></div><div>And while referring to the product, like in target dependency, factory method should be used:</div><div>    Target(name: &quot;Foo&quot;, dependencies: [.product(name: &quot;FooLib&quot;)])<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="auto"><div><div class="m_-8627420445072186650gmail-h5"><blockquote type="cite"><div><span>   Under this rule, an entity having an identity, will use a type initializer</span><br><span>   and everything else will use factory methods. `Package`, `Target` and</span><br><span>   `Product` are identities. However, a product referenced in a target</span><br><span>   dependency is not an identity.</span><br><span></span><br><span>   This means the `Product` enum should be converted into an identity. We</span><br><span>   propose to introduce a `Product` class with two subclasses: `Executable`</span><br><span>   and `Library`.  These subclasses will be nested inside `Product` class</span><br><span>   instead of being a top level declaration in the module.  The major</span><br><span>   advantage of nesting is that we get a namespace for products and it is easy</span><br><span>   to find all the supported products when the product types grows to a large</span><br><span>   number. A downside of nesting is that the product initializers will have to</span><br><span>   used with the dot notation (e.g.: `.Executable(name: &quot;tool&quot;, targets:</span><br><span>   [&quot;tool&quot;])`) which is a little awkward because we expect factory methods to</span><br><span>   use the dots.</span><br><span></span><br><span>   They will be defined as follow:</span><br><span></span><br><span>   ```swift</span><br><span>   /// Represents a product.</span><br><span>   class Product {</span><br><span></span><br><span>       /// The name of the product.</span><br><span>       let name: String</span><br><span></span><br><span>       /// The names of the targets in this product.</span><br><span>       let targets: [String]</span><br><span></span><br><span>       private init(name: String, targets: [String]) {</span><br><span>           <a href="http://self.name/" target="_blank">self.name</a><span class="m_-8627420445072186650Apple-converted-space"> </span>= name</span><br><span>           self.targets = targets</span><br><span>       }</span><br><span></span><br><span>       /// Represents an executable product.</span><br><span>       final class Executable: Product {</span><br><span></span><br><span>           /// Creates an executable product with given name and targets.</span><br><span>           override init(name: String, targets: [String])</span><br><span>       }</span><br><span></span><br><span>       /// Represents a library product.</span><br><span>       final class Library: Product {</span><br><span>           /// The type of library product.</span><br><span>           enum LibraryType: String {</span><br><span>               case `static`</span><br><span>               case `dynamic`</span><br><span>           }</span><br><span></span><br><span>           /// The type of the library.</span><br><span>           ///</span><br><span>           /// If the type is unspecified, package manager will automatically choose a type.</span><br><span>           let type: LibraryType?</span><br><span></span><br><span>           /// Creates a library product.</span><br><span>           init(name: String, type: LibraryType? = nil, targets: [String])</span><br><span>       }</span><br><span>   }</span><br><span>   ```</span><br><span></span><br><span>   &lt;details&gt;</span><br><span>     &lt;summary&gt;View example&lt;/summary&gt;</span><br><span>     &lt;p&gt;</span><br><span></span><br><span>   Example:</span><br><span></span><br><span>   ```swift</span><br><span>   let package = Package(</span><br><span>       name: &quot;Foo&quot;,</span><br><span>       target: [</span><br><span>           Target(name: &quot;Foo&quot;, dependencies: [&quot;Utility&quot;]),</span><br><span>           Target(name: &quot;tool&quot;, dependencies: [&quot;Foo&quot;]),</span><br><span>       ],</span><br><span>       products: [</span><br><span>           .Executable(name: &quot;tool&quot;, targets: [&quot;tool&quot;]),<span class="m_-8627420445072186650Apple-converted-space"> </span></span><br><span>           .Library(name: &quot;Foo&quot;, targets: [&quot;Foo&quot;]),<span class="m_-8627420445072186650Apple-converted-space"> </span></span><br><span>           .Library(name: &quot;FooDy&quot;, type: .dynamic, targets: [&quot;Foo&quot;]),<span class="m_-8627420445072186650Apple-converted-space"> </span></span><br><span>       ]</span><br><span>   )</span><br><span>   ```</span><br><span>   &lt;/p&gt;&lt;/details&gt;</span><br></div></blockquote><div><br></div></div></div><div>This API looks very weird: the leading dog is usually used for enum cases and static members. Using it with a type means that the capitalization looks very out of place.</div><div><div class="m_-8627420445072186650gmail-h5"><br></div></div></div></blockquote><div><br></div><div>Yes, as mentioned in the proposal we think the dot and capitalization following it looks out of place here but we really think that the products should be under a namespace because the types supported product might grow to a substantial number in future. Adding namespace using nesting solves this issue nicely. </div><div><br></div><div>Another advantage would be getting free autocomplete support for products in IDEs or text editors which supports SourceKit. Right now there is none which supports autocomplete for the manifest file but since SourceKit is cross platform, it should be possible to create a plugin in future.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="auto"><div><div class="m_-8627420445072186650gmail-h5"><blockquote type="cite"><div><span>* Special syntax for version initializers.</span><br><span></span><br><span>   A simplified summary of what is commonly supported in other package managers:</span><br><span></span><br><span>   | Package Manager | x-ranges      | tilde (`~` or `~&gt;`)     | caret (`^`)   |</span><br><span>   |-----------------|--------<wbr>-------|----------------------<wbr>---|---------------|</span><br><span>   | npm             | Supported     | Allows patch-level changes if a minor version is specified on the comparator. Allows minor-level changes if not.  | patch and minor updates |</span><br><span>   | Cargo           | Supported     | Same as above           | Same as above |</span><br><span>   | CocoaPods       | Not supported | Same as above           | Not supported |</span><br><span>   | Carthage        | Not supported | patch and minor updates | Not supported |</span><br><span></span><br><span>   Some general observations:</span><br><span></span><br><span>   * Every package manager we looked at for this supports the tilde `~` operator in some form.</span><br><span>   * The widely accepted suggestion on how to constrain your versions is &quot;use</span><br><span>     `~&gt;`, it does the right thing&quot;.</span><br><span>   * It&#39;s not clear to us why this has so much traction as &quot;the right thing&quot;, as it can</span><br><span>     prevent upgrades that should be compatible (one minor version to next minor version).</span><br><span>   * Most users may not really understand `~`, and just use it per recommendations.</span><br><span>     See e.g. how Google created a [6-minute instructional video](<a href="https://www.youtube.com/watch?v=x4ARXyovvPc" target="_blank">https://www.youtube.com<wbr>/watch?v=x4ARXyovvPc</a>)</span><br><span>     about this operator for CocoaPods.</span><br><span>   * A lot of people even explicitly set a single exact version simply because</span><br><span>     they don&#39;t know better. This leads to &quot;dependency hell&quot; (unresolvable dependencies</span><br><span>     due to conflicting requirements for a package in the dependency graph).</span><br><span>   * The Swift Package Manager will probably have many novice users, because it</span><br><span>     comes built-in to Swift.</span><br><span>   * We think caret `^` has the right behaviour most of the time. That is, you</span><br><span>     should be able to specify a minimum version, and you should be willing to let</span><br><span>     your package use anything after that up to the next major version. This policy</span><br><span>     works if packages correctly follow semantic versioning, and it prevents &quot;dependency</span><br><span>     hell&quot; by expressing permissive constraints.</span><br><span>   * We also think caret `^` is syntactically non-obvious, and we&#39;d prefer a syntax</span><br><span>     that doesn&#39;t require reading a manual for novices to understand, even if that</span><br><span>     means we break with the syntactic convention established by the other package managers which</span><br><span>     support caret `^`.</span><br><span>   * We&#39;d like a convenient syntax for caret `^`, but to still support the use</span><br><span>     case that tilde `~` is used for; but tilde `~` (or a single exact version) should</span><br><span>     be less convenient than caret `^`, to encourge permissive dependency constraints.</span><br><span></span><br><span>   What we propose:</span><br><span></span><br><span>   * We will introduce a factory method which takes a lower bound version and</span><br><span>     forms a range that goes upto the next major version (i.e. caret).</span><br><span></span><br><span>     ```swift</span><br><span>     // 1.0.0 ..&lt; 2.0.0</span><br><span>     .package(url: &quot;/SwiftyJSON&quot;, from: &quot;1.0.0&quot;),</span><br><span></span><br><span>     // 1.2.0 ..&lt; 2.0.0</span><br><span>     .package(url: &quot;/SwiftyJSON&quot;, from: &quot;1.2.0&quot;),</span><br><span></span><br><span>     // 1.5.8 ..&lt; 2.0.0</span><br><span>     .package(url: &quot;/SwiftyJSON&quot;, from: &quot;1.5.8&quot;),</span><br><span>     ```</span><br><span></span><br><span>   * We will introduce a factory method which takes `VersionSetSpecifier`, to</span><br><span>     conveniently specify common ranges.</span><br><span></span><br><span>     `VersionSetSpecifier` is an enum defined as follows:</span><br><span></span><br><span>     ```swift</span><br><span>     enum VersionSetSpecifier {</span><br><span>         case exact(Version)</span><br><span>         case range(Range&lt;Version&gt;)</span><br><span></span><br><span>         /// Creates a specifier for an exact version.</span><br><span>         static func only(_ version: Version) -&gt; VersionSetSpecifier</span><br><span></span><br><span>         /// Creates a specified for a range starting at the given lower bound</span><br><span>         /// and going upto next major version.</span><br><span>         static func uptoNextMajor(_ version: Version) -&gt; VersionSetSpecifier</span><br><span></span><br><span>         /// Creates a specified for a range starting at the given lower bound</span><br><span>         /// and going upto next minor version.</span><br><span>         static func uptoNextMinor(_ version: Version) -&gt; VersionSetSpecifier</span><br><span>     }</span><br><span>     ```</span><br><span></span><br><span>     Examples:</span><br><span></span><br><span>     ```swift</span><br><span>     // 1.5.8 ..&lt; 2.0.0</span><br><span>     .package(url: &quot;/SwiftyJSON&quot;, .uptoNextMajor(&quot;1.5.8&quot;)),</span><br><span></span><br><span>     // 1.5.8 ..&lt; 1.6.0</span><br><span>     .package(url: &quot;/SwiftyJSON&quot;, .uptoNextMinor(&quot;1.5.8&quot;)),</span><br><span></span><br><span>     // 1.5.8</span><br><span>     .package(url: &quot;/SwiftyJSON&quot;, .only(&quot;1.5.8&quot;)),</span><br><span>     ```</span><br><span></span><br><span>   * This will also give us ability to add more complex features in future:</span><br><span></span><br><span>     Examples:</span><br><blockquote type="cite"><span>Note that we&#39;re not actually proposing these as part of this proposal.</span><br></blockquote><span></span><br><span>     ```swift</span><br><span>     .package(url: &quot;/SwiftyJSON&quot;, .uptoNextMajor(&quot;1.5.8&quot;).exclud<wbr>ing(&quot;1.6.4&quot;)),</span><br><span></span><br><span>     .package(url: &quot;/SwiftyJSON&quot;, .only(&quot;1.5.8&quot;, &quot;1.6.3&quot;)),</span><br><span></span><br><span>     ```</span><br><span></span><br><span>   * We will introduce a factory method which takes `Range&lt;Version&gt;`, to specify</span><br><span>     arbitrary open range.</span><br><span></span><br><span>     ```swift</span><br><span>     // Constraint to an arbitrary open range.</span><br><span>     .package(url: &quot;/SwiftyJSON&quot;, &quot;1.2.3&quot;..&lt;&quot;1.2.6&quot;),</span><br><span>     ```</span><br><span></span><br><span>   * We will introduce a factory method which takes `ClosedRange&lt;Version&gt;`, to specify</span><br><span>     arbitrary closed range.</span><br><span></span><br><span>     ```swift</span><br><span>     // Constraint to an arbitrary closed range.</span><br><span>     .package(url: &quot;/SwiftyJSON&quot;, &quot;1.2.3&quot;...&quot;1.2.8&quot;),</span><br><span>     ```</span><br><span></span><br><span>   * We will remove all of the current factory methods:</span><br><span></span><br><span>     ```swift</span><br><span>     // Constraint to a major version.</span><br><span>     .Package(url: &quot;/SwiftyJSON&quot;, majorVersion: 1),</span><br><span></span><br><span>     // Constraint to a major and minor version.</span><br><span>     .Package(url: &quot;/SwiftyJSON&quot;, majorVersion: 1, minor: 2),</span><br><span></span><br><span>     // Constraint to an exact version.</span><br><span>     .Package(url: &quot;/SwiftyJSON&quot;, &quot;1.2.3&quot;),</span><br><span></span><br><span>     // Constraint to an arbitrary range.</span><br><span>     .Package(url: &quot;/SwiftyJSON&quot;, versions: &quot;1.2.3&quot;..&lt;&quot;1.2.6&quot;),</span><br><span></span><br><span>     // Constraint to an arbitrary closed range.</span><br><span>     .Package(url: &quot;/SwiftyJSON&quot;, versions: &quot;1.2.3&quot;...&quot;1.2.8&quot;),</span><br><span>     ```</span><br></div></blockquote><div><br></div></div></div><div>I&#39;m ver happy with the versioning part of this proposal :-)</div><span class="m_-8627420445072186650gmail-"><br></span></div></blockquote><div><br></div><div>Great! </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="auto"><span class="m_-8627420445072186650gmail-"><blockquote type="cite"><div><span>* Adjust order of parameters on `Package` class:</span><br><span></span><br><span>   We propose to reorder the parameters of `Package` class to: `name`,</span><br><span>   `pkgConfig`, `products`, `dependencies`, `targets`, `compatibleSwiftVersions`.</span><br><span></span><br><span>   The rationale behind this reorder is that the most interesting parts of a</span><br><span>   package are its product and dependencies, so they should be at the top.</span><br><span>   Targets are usually important during development of the package.  Placing</span><br><span>   them at the end keeps it easier for the developer to jump to end of the</span><br><span>   file to access them. Note that the compatibleSwiftVersions property will likely</span><br><span>   be removed once we support Build Settings, but that will be discussed in a separate proposal.</span><br></div></blockquote><div><br></div></span><div>I would have liked this proposal to suggest modifying the API so the order is insignificant. While ordering feels important for me when calling a function or initializer with few arguments (like .package(url: &quot;&quot;, from: &quot;1.4.5&quot;)), the arguments to the Package function seem like a list of configuration options and shouldn&#39;t have a fixed order. My suggestion was to remove all arguments but the name and adds a configuration closure:</div><div><br></div><div>let package = Package(name: &quot;paper&quot;) {</div><div>   <span class="m_-8627420445072186650Apple-converted-space"> </span>$0.products = [...]</div><div>   <span class="m_-8627420445072186650Apple-converted-space"> </span>$0.dependencies = [...]</div><div>}</div><br></div></blockquote><div><br></div><div>It will be possible to avoid using the initializer because all the properties will be made mutable. However I think if majority of packages uses the initializer and thus have a consistent ordering, it will be easier for other developers to read manifests on Github (or similar).</div><div><br></div><div>PS: The closure syntax can also be added using extension in the manifest itself if someone really wants to use it.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="auto"><blockquote type="cite"><div><div><div class="m_-8627420445072186650gmail-h5"><span>   &lt;details&gt;</span><br><span>     &lt;summary&gt;View example&lt;/summary&gt;</span><br><span>     &lt;p&gt;</span><br><span></span><br><span>   Example:</span><br><span></span><br><span>   ```swift</span><br><span>   let package = Package(</span><br><span>       name: &quot;Paper&quot;,</span><br><span>       products: [</span><br><span>           .Executable(name: &quot;tool&quot;, targets: [&quot;tool&quot;]),</span><br><span>           .Libary(name: &quot;Paper&quot;, type: .static, targets: [&quot;Paper&quot;]),</span><br><span>           .Libary(name: &quot;PaperDy&quot;, type: .dynamic, targets: [&quot;Paper&quot;]),</span><br><span>       ],</span><br><span>       dependencies: [</span><br><span>           .package(url: &quot;<a href="http://github.com/SwiftyJSON" target="_blank">http://github.com/SwiftyJSON</a>&quot;<wbr>, from: &quot;1.2.3&quot;),</span><br><span>           .package(url: &quot;../CHTTPParser&quot;, .uptoNextMinor(&quot;2.2.0&quot;)),</span><br><span>           .package(url: &quot;<a href="http://some/other/lib" target="_blank">http://some/other/lib</a>&quot;, .only(&quot;1.2.3&quot;)),</span><br><span>       ]</span><br><span>       targets: [</span><br><span>           Target(</span><br><span>               name: &quot;tool&quot;,</span><br><span>               dependencies: [</span><br><span>                   &quot;Paper&quot;,</span><br><span>                   &quot;SwiftyJSON<wbr>&quot;</span><br><span>               ]),</span><br><span>           Target(</span><br><span>               name: &quot;Paper&quot;,</span><br><span>               dependencies: [</span><br><span>                   &quot;Basic&quot;,</span><br><span>                   .target(nam<wbr>e: &quot;Utility&quot;),</span><br><span>                   .product(na<wbr>me: &quot;CHTTPParser&quot;),</span><br><span>               ])</span><br><span>       ]</span><br><span>   )</span><br><span>   ```</span><br><span>   &lt;/p&gt;&lt;/details&gt;</span><br><span></span><br><span>* Eliminate exclude in future (via custom layouts feature).</span><br><span></span><br><span>   We expect to remove the `exclude` property after we get support for custom</span><br><span>   layouts. The exact details will be in the proposal of that feature.</span><br><span></span><br><span>## Impact on existing code</span><br><span></span><br><span>The above changes will be implemented only in the new Package Description v4</span><br><span>library. The v4 runtime library will release with Swift 4 and packages will be</span><br><span>able to opt-in into it as described by</span><br><span>[SE-0152](<a href="https://github.com/apple/swift-evolution/blob/master/proposals/0152-package-manager-tools-version.md" target="_blank">https://github.com/a<wbr>pple/swift-evolution/blob/mast<wbr>er/proposals/0152-package-mana<wbr>ger-tools-version.md</a>).</span><br><span></span><br><span>There will be no automatic migration feature for updating the manifests from v3</span><br><span>to v4. To indicate the replacements of old APIs, we will annotate them using</span><br><span>the `@unavailable` attribute where possible. Unfortunately, this will not cover</span><br><span>all the changes for e.g. rename of the target dependency enum cases.</span><br><span></span><br><span>All new packages created with `swift package init` command in Swift 4 tools</span><br><span>will by default to use the v4 manifest. It will be possible to switch to v3</span><br><span>manifest version by changing the tools version using `swift package</span><br><span>tools-version --set 3.1`.  However, the manifest will needed to be adjusted to</span><br><span>use the older APIs manually.</span><br><span></span><br><span>Unless declared in the manifest, existing packages automatically default</span><br><span>to the Swift 3 minimum tools version; since the Swift 4 tools will also include</span><br><span>the v3 manifest API, they will build as expected.</span><br><span></span><br><span>A package which needs to support both Swift 3 and Swift 4 tools will need to</span><br><span>stay on the v3 manifest API and support the Swift 3 language version for its</span><br><span>sources, using the API described in the proposal</span><br><span>[SE-0151](<a href="https://github.com/apple/swift-evolution/blob/master/proposals/0151-package-manager-swift-language-compatibility-version.md" target="_blank">https://github.com/a<wbr>pple/swift-evolution/blob/mast<wbr>er/proposals/0151-package-mana<wbr>ger-swift-language-compatibili<wbr>ty-version.md</a>).</span><br><span></span><br><span>An existing package which wants to use the new v4 manifest APIs will need to bump its</span><br><span>minimum tools version to 4.0 or later using the command `$ swift package tools-version</span><br><span>--set-current`, and then modify the manifest file with the changes described in</span><br><span>this proposal.</span><br><span></span><br><span>## Alternatives considered</span><br><span></span><br><span>* Add variadic overloads.</span><br><span></span><br><span>   Adding variadic overload allows omitting parenthesis which leads to less</span><br><span>   cognitive load on eyes, especially when there is only one value which needs</span><br><span>   to be specified. For e.g.:</span><br><span></span><br><span>       Target(name: &quot;Foo&quot;, dependencies: &quot;Bar&quot;)</span><br><span></span><br><span>   might looked better than:</span><br><span></span><br><span>       Target(name: &quot;Foo&quot;, dependencies: [&quot;Bar&quot;])</span><br><span></span><br><span>   However, plurals words like `dependencies` and `targets` imply a collection</span><br><span>   which implies brackets. It also makes the grammar wrong. Therefore, we</span><br><span>   reject this option.</span><br><span></span><br><span>* Version exclusion.</span><br><span></span><br><span>   It is not uncommon to have a specific package version break something, and</span><br><span>   it is undesirable to &quot;fix&quot; this by adjusting the range to exclude it</span><br><span>   because this overly constrains the graph and can prevent picking up the</span><br><span>   version with the fix.</span><br><span></span><br><span>   This is desirable but it should be proposed separately.</span><br><span></span><br><span>* Inline package declaration.</span><br><span></span><br><span>   We should probably support declaring a package dependency anywhere we</span><br><span>   support spelling a package name. It is very common to only have one target</span><br><span>   require a dependency, and annoying to have to specify the name twice.</span><br><span></span><br><span>   This is desirable but it should be proposed separately.</span><br><span></span><br><span>______________________________<wbr>_________________</span><br></div></div><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailma<wbr>n/listinfo/swift-evolution</a></span><br></div></blockquote><br><div>One thing that still really bothers me about the API is the inconsistency in leading dots and capitalization. Should a novice (or an expert) have to remember the following different writings:</div><div><span class="m_-8627420445072186650gmail-"><br><div><font><span style="background-color:rgba(255,255,255,0)">Target(name: &quot;Foo&quot;, dependencies: [&quot;Utility&quot;])</span></font></div></span><span class="m_-8627420445072186650gmail-"><div><span style="background-color:rgba(255,255,255,0)">.package(url: &quot;<a href="http://github.com/SwiftyJSON" target="_blank">http://github.com/SwiftyJSON</a>&quot;<wbr>, from: &quot;1.2.3&quot;)</span></div></span></div><div><div><span style="background-color:rgba(255,255,255,0)">.Library(name: &quot;Paper&quot;, type: .static, targets: [&quot;Paper&quot;])</span></div></div><div><span style="background-color:rgba(255,255,255,0)"><br></span></div><div><span style="background-color:rgba(255,255,255,0)">I understand the arguments brought forward in the proposal. But from a package author point of view, it&#39;s not obvious why Target is capitalized, why package is lowercase with a leading dot and why Library is capitalized with a leading dot. It looks confusing and inconsistent, which makes it less pleasant to read and harder to remember.</span></div><div><span style="background-color:rgba(255,255,255,0)"><br></span></div><div><span style="background-color:rgba(255,255,255,0)">Could we push for more consistency by having everything b lowercased with a leading dot? It does force us to introduce a Target factory method, to revert SystemPackageProvider back to an enum, to revert products back to an enum. But I think it&#39;s worth it.</span></div></div></blockquote></div><br></div></div><div class="gmail_extra">It is true that it might not be obvious when to use what initially, but we think this is a good rule to create a distinction between constructing things and referring to things. A downside of lowercasing everything would be: it might seem like the references support all the parameters that constructor supports. e.g. .target(name: &quot;Foo&quot;, dependencies: [ .target(name: &quot;Bar&quot;, dependencies: [&quot;Baz&quot;]) ])</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div></div><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">______________________________<wbr>_________________</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">swift-build-dev mailing list</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="mailto:swift-build-dev@swift.org" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">swift-build-dev@swift.org</a><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="https://lists.swift.org/mailman/listinfo/swift-build-dev" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-build-<wbr>dev</a></div></blockquote></div><br></div></div>______________________________<wbr>_________________<br>swift-build-dev mailing list<br><a href="mailto:swift-build-dev@swift.org" target="_blank">swift-build-dev@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-build-dev" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-build-<wbr>dev</a></div></blockquote></div></div></blockquote></div><br></div></div></blockquote></div><br></div></div></div><br>______________________________<wbr>_________________<br>
swift-build-dev mailing list<br>
<a href="mailto:swift-build-dev@swift.org">swift-build-dev@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-build-dev" rel="noreferrer" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-build-<wbr>dev</a><br>
<br></blockquote></div><br></div>