Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Swift 4 Package Manager Roadmap 〜パンケーキを添えて〜

Swift 4 Package Manager Roadmap 〜パンケーキを添えて〜

iOS Creators' Meetup vol.3
https://oi-study.connpass.com/event/48050/

Satoshi Hachiya

January 24, 2017
Tweet

More Decks by Satoshi Hachiya

Other Decks in Programming

Transcript

  1. • ॅॴෆఆແ৬ʢϑϦʔʣ • גࣜձࣾ ookami Ͱ Player! • Realm News

    • try! Swift Tokyo 2017 ओ࠵ • ʮύϯέʔΩ͞Μʯ
  2. !

  3. [swift-evolution-announce] Swift 4 Package Manager Roadmap Rick Ballard @ Apple

    https://lists.swift.org/pipermail/swift-evolution-announce/ 2017-January/000307.html
  4. ! mono ͞Μͷ SwiftɾiOS ίϥϜ Swift 4 Package Manager Roadmap

    (Medium) https://medium.com/swift-column/swift-4-package-manager- roadmap-5c141540a251#.8xcfx078g
  5. Swift 4 Package Manager Roadmap • Work We've CompletedʢSwift 3.1

    ·Ͱʹ׬ྃʣ • Planned Work for Swift 4ʢSwift 4 ޲͚ͷܭըʣ • Beyond Swift 4ʢSwift 5ʁʣ
  6. Swift 3.1 ·Ͱʹ׬ྃ (1/2) ! • Package Edit • Pinning

    • Project Generation Improvements • New Dependency Resolver
  7. Swift 3.1 ·Ͱʹ׬ྃ (2/2) ! • Cycle Detection and Incremental

    Build Correctness • Parallel Cloning (soonʣ • swift-DEVELOPMENT-SNAPSHOT-2017-01-23-aʁ • Improved Test Coverage and Infrastructure
  8. Swift 4 ޲͚ͷܭը (1/2) ! • Swift Versioning Support •

    Product Types • Support for Top-of-Tree and Branch-Based Package Development • Overriding Package Conventions • Support Build Settings
  9. Swift 4 ޲͚ͷܭը (2/2) ! • Redesign the Package Manifest

    API • Performance Test Support • SwiftPM-as-a-Library • Configuration File Support • Multi-Package Repository Support
  10. Swift 5 ʁ! • Centralized package index • Support for

    package resources (such as image assets) • License and metadata support • Explicit support for handling source control forking • Generic mechanism for invoking build tools that the package manager doesn’t natively support
  11. [swift-build-dev] Swift 4 Package Manager Roadmap https://lists.swift.org/pipermail/swift-build-dev/Week-of- Mon-20170123/000829.html SwiftPM Roadmap

    Q&A on Tuesday, January 24th, 10-11am PST https://lists.swift.org/pipermail/swift-build-dev/Week-of- Mon-20170123/000830.html
  12. (Unofficial) SwiftPM Slack ೔ຊ࣌ؒ1݄25೔(ਫ)ະ໌ 3:00ʙ4:00 Tomorrow (Tuesday, January 24th), from

    10-11am PST, package manager developers will be available for a dedicated hour in the (unofficial) SwiftPM Slack channel to answer questions about this roadmap;
  13. (unofficial) SwiftPM Slack channel Ankit Aggarwal [3:37 PM] @channel You

    can now use --enable-prefetching to clone dependencies in parallel (e.g. $ swift build --enable- prefetching or $ swift package --enable-prefetching update). The issues around dependency resolution with edit mode are also fixed. Grab a master or 3.1 branch snapshot from https://swift.org/download/#snapshots
  14. $ swift build --help OVERVIEW: Build sources into binary products

    USAGE: swift build [options] OPTIONS: --build-path Specify build/cache directory [default: ./.build] --chdir, -C Change working directory before any other operation --color Specify color mode (auto|always|never) [default: auto] --configuration, -c Build with configuration (debug|release) [default: debug] --enable-prefetching Enable prefetching in resolver --verbose, -v Increase verbosity of informational output -Xcc Pass flag through to all C compiler invocations -Xlinker Pass flag through to all linker invocations -Xswiftc Pass flag through to all Swift compiler invocations
  15. $ swift package --help OVERVIEW: Perform operations on Swift packages

    USAGE: swift package [options] subcommand OPTIONS: --build-path Specify build/cache directory [default: ./.build] --chdir, -C Change working directory before any other operation --color Specify color mode (auto|always|never) [default: auto] --enable-prefetching Enable prefetching in resolver --verbose, -v Increase verbosity of informational output -Xcc Pass flag through to all C compiler invocations -Xlinker Pass flag through to all linker invocations -Xswiftc Pass flag through to all Swift compiler invocations
  16. খࠁΈͰΑ͘Θ͔Βͳ͍… Sources/Workspace/Workspace.swift - // If the dependency is in editable

    state, do not pin it. - guard !dependency.isInEditableState else { - delegate.warning(message: "not pinning \(package) because it is being edited.") - continue + + // Get the managed dependency. + var dependency = dependencyManifest.dependency + + // For editable dependencies, pin the underlying dependency if we have them. + if dependency.isInEditableState { + if let basedOn = dependency.basedOn { + dependency = basedOn + } else { + delegate.warning(message: "not pinning \(package). It is being edited but is no longer needed.") + continue + }
  17. Ұ෦ൈਮ Sources/PackageGraph/DependencyResolver.swift /// Should resolver prefetch the containers. private let

    enablePrefetching: Bool /// Contains any error encountered during dependency resolution. // FIXME: @testable private var error: Swift.Error? public init(_ provider: Provider, _ delegate: Delegate, enablePrefetching: Bool = false) { self.provider = provider self.delegate = delegate self.enablePrefetching = enablePrefetching }
  18. ͳΜ͔ͩίʔυΛ௥͑͹Θ͔Γͦ͏Ͱ͢Ͷ ! /// Find all solutions for `constraints` with the

    results merged into the `assignment`. /// /// - Parameters: /// - constraints: The input list of constraints to solve. /// - assignment: The assignment to merge the result into. /// - allConstraints: An additional set of constraints on the viable solutions. /// - allExclusions: A set of package assignments to exclude from consideration. /// - Returns: A sequence of all valid satisfying assignment, in order of preference. private func merge( constraints: [Constraint], into assignment: AssignmentSet, subjectTo allConstraints: ConstraintSet, excluding allExclusions: [Identifier: Set<Version>] ) -> AnySequence<AssignmentSet> { var allConstraints = allConstraints if enablePrefetching { // Ask all of these containers upfront to do async cloning. for constraint in constraints { provider.getContainer(for: constraint.identifier) { _ in } } }