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

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

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

5eee847529e8f5ec2f634a85075fd5aa?s=128

Satoshi Hachiya

January 24, 2017
Tweet

Transcript

  1. Swift 4 Package Manager Roadmap 2017.01.24 iOS Creators' Meetup vol.3

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

    • try! Swift Tokyo 2017 ओ࠵ • ʮύϯέʔΩ͞Μʯ
  3. ओઓ৔͸ Instagram

  4. ʙύϯέʔΩΛఴ͑ͯʙ

  5. !

  6. try! Swift Tokyo 2017 ʙ$50 off discount codeΛఴ͑ͯʙ

  7. ຊ୊

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

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

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

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

    • Project Generation Improvements • New Dependency Resolver
  12. 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
  13. 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
  14. Swift 4 ޲͚ͷܭը (2/2) ! • Redesign the Package Manifest

    API • Performance Test Support • SwiftPM-as-a-Library • Configuration File Support • Multi-Package Repository Support
  15. 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
  16. [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
  17. (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;
  18. (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
  19. $ 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
  20. $ 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
  21. Α͘Θ͔Γ·ͤΜΑͶ !

  22. Ͱ΋େৎ෉

  23. Swift Ͱॻ͔Ε͍ͯ·͢

  24. ͱΓ͋͑ͣ࠷৽ͷࠩ෼ΛݟͯΈ·͠ΐ͏

  25. https://github.com/apple/swift-package-manager/compare/ 9400d20...468780f

  26. খࠁΈͰΑ͘Θ͔Βͳ͍… 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 + }
  27. Xcode Ͱத਎ΛݟͯΈ·͠ΐ͏ $ swift package generate-xcodeproj

  28. Ұ෦ൈਮ 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 }
  29. ͳΜ͔ͩίʔυΛ௥͑͹Θ͔Γͦ͏Ͱ͢Ͷ ! /// 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 } } }
  30. pull requests for improvements outside this list are still welcome!

  31. Thanks!