Slide 1

Slide 1 text

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

Slide 2

Slide 2 text

• ॅॴෆఆແ৬ʢϑϦʔʣ • גࣜձࣾ ookami Ͱ Player! • Realm News • try! Swift Tokyo 2017 ओ࠵ • ʮύϯέʔΩ͞Μʯ

Slide 3

Slide 3 text

ओઓ৔͸ Instagram

Slide 4

Slide 4 text

ʙύϯέʔΩΛఴ͑ͯʙ

Slide 5

Slide 5 text

!

Slide 6

Slide 6 text

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

Slide 7

Slide 7 text

ຊ୊

Slide 8

Slide 8 text

[swift-evolution-announce] Swift 4 Package Manager Roadmap Rick Ballard @ Apple https://lists.swift.org/pipermail/swift-evolution-announce/ 2017-January/000307.html

Slide 9

Slide 9 text

! mono ͞Μͷ SwiftɾiOS ίϥϜ Swift 4 Package Manager Roadmap (Medium) https://medium.com/swift-column/swift-4-package-manager- roadmap-5c141540a251#.8xcfx078g

Slide 10

Slide 10 text

Swift 4 Package Manager Roadmap • Work We've CompletedʢSwift 3.1 ·Ͱʹ׬ྃʣ • Planned Work for Swift 4ʢSwift 4 ޲͚ͷܭըʣ • Beyond Swift 4ʢSwift 5ʁʣ

Slide 11

Slide 11 text

Swift 3.1 ·Ͱʹ׬ྃ (1/2) ! • Package Edit • Pinning • Project Generation Improvements • New Dependency Resolver

Slide 12

Slide 12 text

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

Slide 13

Slide 13 text

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

Slide 14

Slide 14 text

Swift 4 ޲͚ͷܭը (2/2) ! • Redesign the Package Manifest API • Performance Test Support • SwiftPM-as-a-Library • Configuration File Support • Multi-Package Repository Support

Slide 15

Slide 15 text

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

Slide 16

Slide 16 text

[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

Slide 17

Slide 17 text

(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;

Slide 18

Slide 18 text

(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

Slide 19

Slide 19 text

$ 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

Slide 20

Slide 20 text

$ 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

Slide 21

Slide 21 text

Α͘Θ͔Γ·ͤΜΑͶ !

Slide 22

Slide 22 text

Ͱ΋େৎ෉

Slide 23

Slide 23 text

Swift Ͱॻ͔Ε͍ͯ·͢

Slide 24

Slide 24 text

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

Slide 25

Slide 25 text

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

Slide 26

Slide 26 text

খࠁΈͰΑ͘Θ͔Βͳ͍… 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 + }

Slide 27

Slide 27 text

Xcode Ͱத਎ΛݟͯΈ·͠ΐ͏ $ swift package generate-xcodeproj

Slide 28

Slide 28 text

Ұ෦ൈਮ 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 }

Slide 29

Slide 29 text

ͳΜ͔ͩίʔυΛ௥͑͹Θ͔Γͦ͏Ͱ͢Ͷ ! /// 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] ) -> AnySequence { 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 } } }

Slide 30

Slide 30 text

pull requests for improvements outside this list are still welcome!

Slide 31

Slide 31 text

Thanks!