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

新しいビルドツールScipioのご紹介

giginet
February 21, 2023

 新しいビルドツールScipioのご紹介

giginet

February 21, 2023
Tweet

More Decks by giginet

Other Decks in Programming

Transcript

  1. ୭ʁ • @giginet • LINEגࣜձࣾ Developer Experience։ൃνʔϜ • ex ΫοΫύουגࣜձࣾ

    ϞόΠϧج൫෦ • ٕज़ސ໰ • ϚωʔϑΥϫʔυ, peep, ϢϏϨδ • OSSϝϯςφ • Carthage, XcodeGen, fastlaneͳͲ • ࠷ۙ͸ϗάϫʔπϨΨγʔ΍ͬͯ·͢ • ྈ͸εϦβϦϯ
  2. ͳʹ͕Ͱ͖Δͷʁ • Swift Package Manager(SwiftPM)ʹΑΔґଘղܾ • γϛϡϨʔλϏϧυɺStatic FrameworkαϙʔτɺσόοάγϯϘ ϧରԠ •

    ϚϧνϓϥοτϑΥʔϜରԠ • ϦιʔεόϯυϧରԠ • ΩϟογϡγεςϜ • Ϗϧυ͕ඞཁ͔൑அͯ͠ඞཁͳͱ͖͚ͩϦϏϧυ • ϦϞʔτΩϟογϡ • ύοέʔδຖͷϏϧυઃఆͷ஫ೖ
  3. // swift-tools-version: 5.7 import PackageDescription let package = Package( name:

    "Dependencies", platforms: [.iOS(.v13),], dependencies: [ .package(url: "https://github.com/apple/swift-log.git", from: "1.4.4"), .package(url: "https://github.com/apple/swift-collections.git", .upToNextMinor(from: "1.0.0")), ], targets: [ .target( name: "Dependencies", dependencies: [ .product(name: "Logging", package: "swift-log"), .product(name: "OrderedCollections", package: "swift-collections"), .product(name: "DequeModule", package: "swift-collections"), .product(name: "Collections", package: "swift-collections"), ]), ] ) ґଘؔ܎ͷఆٛ
  4. $ scipio prepare /path/to/Dependencies 🔁 Resolving Dependencies... 🗑 Cleaning Dependencies...

    📦 Building OrderedCollections for iOS 🚀 Combining into XCFramework... 📦 Building DequeModule for iOS 🚀 Combining into XCFramework... 📦 Building Collections for iOS 🚀 Combining into XCFramework... 📦 Building Logging for iOS 🚀 Combining into XCFramework... ❇ Succeeded. $ scipio prepareͷ࣮ߦ
  5. ΩϟογϡγεςϜ • ͢ͰʹϏϧυ͞Ε͍ͯΔύοέʔδ͕͋Ε͹ϏϧυεΩοϓ • VersionFileͱ͍͏ϏϧυઃఆΛอଘ͢Δ࢓૊ΈͰಉҰੑΛϏϧυ લʹ൑ఆ͍ͯ͠Δ $ scipio prepare /path/to/Dependencies

    🔁 Resolving Dependencies... 🗑 Cleaning Dependencies... ✅ Valid OrderedCollections.xcframework is exists. Skip building. ✅ Valid DequeModule.xcframework is exists. Skip building. ✅ Valid Collections.xcframework is exists. Skip building. ✅ Valid Logging.xcframework is exists. Skip building. ❇ Succeeded.
  6. https://speakerdeck.com/giginet/standardizing-build-system-using-modern-swift-packages-in-line Standardizing build system using modern Swift Packages in LINE

    2022-11-10 Mobile DevOps Summit 2022 Kohki Miki (@giginet) LINE Corp Standardizing build system using modern Swift Packages in LINE Mobile DevOps Summit 2022 2022/11/10
  7. • Swift Package͔ΒxcodeprojΛੜ੒ͯ͘͠ΕΔSwiftPMͷඪ४ػೳ • ͔͠͠௕Β͘ϝϯς͞Ε͍ͯͳͯ͘ඇਪ঑ɺϦιʔεόϯυϧͳͲ ʹରԠ͍ͯ͠ͳ͍ • ઌिग़ͨXcode 14.3(Swift 5.8)͔Β׬શʹ࡟আ

    😇 $ swift package —help SUBCOMMANDS: generate-xcodeproj Generates an Xcode project. This command will be deprecated soon. See 'swift help package <subcommand>' for detailed help. $ swift package generate-xcodeproj
  8. Project Generatorͷखಈੜ੒ • generate-xcodeprojΛಠ࣮ࣗ૷ • SwiftPMͷඪ४ػೳΛ࢖ͬͯPackage ManifestΛύʔε • tuist/XcodeProjͳͲͷαʔυύʔςΟϥΠϒϥϦΛ࢖ͬͯ xcodeprojΛੜ੒

    • generate-xcodeproj͕ରԠ͍ͯ͠ͳ͍ػೳ΋ಠ࣮ࣗ૷ • ͋Δఔ౓͸ϫʔΫ͕ͨ͠ίʔυྔ͕ଟ͗ͯ͢อकੑ͕ࢮ๢ 🔥 • https://github.com/giginet/Scipio/pull/10
  9. ৽ख๏ɿPIFͱxcbuildͷར༻ʢݱঢ়ʣ • The Project Interchange Format (PIF)ͱ ͍͏SwiftPM಺෦ͷ࢓૊ΈΛ࢖͍ͬͯΔ • https://github.com/apple/swift-package-manager/blob/main/

    Sources/XCBuildSupport/PIF.swift • SwiftPM͕Xcodeͱ΍ΓͱΓ͢ΔͨΊͷ σʔλߏ଄(JSON) • xcodeprojͷΑ͏ͳσʔλߏ଄Λ࣋ͬͯ ͍Δ • swift package dump-pif Ͱੜ੒Ͱ͖Δ ґଘͷղܾ ύοέʔδͷऔಘ PIFͷੜ੒ XCFrameworkͷϏϧυ swift package dump-pif xcbuild swift package resolve
  10. [ { "contents" : { "guid" : "Workspace:/Users/giginet/.ghq/github.com/apple/swift-log@11", "name" :

    "swift-log", "path" : "/Users/giginet/.ghq/github.com/apple/swift-log", "projects" : [ "5efb5ae893d8ac787311a46da9406baa3bce845cbce481fdb94390442801fdb3", "9ab62105dad5328dc9d5a3cef4fc26bf52108b7ac1a4beec01d32ce8968f16c3", "0e8bd1af969fb95dc35d81c26beebbf9926c0b251db8863ded809faa315c9e65", "7af763f6bfb93ee07e17424e201c80920f6427b4350a7daf1bc6c63601a082a9" ] }, "signature" : "af4193bb1b6197ade0b9afc08ffece572cbe5c60919c89b2b0953025848a2a67", "type" : "workspace" }, { "contents" : { "buildConfigurations" : [ { "buildSettings" : { "CLANG_ENABLE_OBJC_ARC" : "YES", "CODE_SIGN_IDENTITY" : "", "CODE_SIGNING_REQUIRED" : "NO", "COPY_PHASE_STRIP" : "NO", "DEBUG_INFORMATION_FORMAT" : "dwarf", "DRIVERKIT_DEPLOYMENT_TARGET" : "19.0", "DYLIB_INSTALL_NAME_BASE" : "@rpath", "ENABLE_NS_ASSERTIONS" : "YES", "ENABLE_TESTABILITY" : "YES", "ENABLE_TESTING_SEARCH_PATHS" : "YES", "ENTITLEMENTS_REQUIRED" : "NO", "FRAMEWORK_SEARCH_PATHS[__platform_filter=ios;ios-simulator]" : [ "$(inherited)", "$(PLATFORM_DIR)/Developer/Library/Frameworks" ], "FRAMEWORK_SEARCH_PATHS[__platform_filter=macos]" : [
  11. $ XCBUILD=/Applications/Xcode.app/Contents/SharedFrameworks/ XCBuild.framework/Versions/A/Support/xcbuild $ ./xcbuild dumped-pif.json -con f iguration release

    -target Logging • swift build —build-system xcode • ͜ͷͱ͖ɺSwiftPM͸ɺxcbuildͱ͍͏Xcodeͷ࣋ͭexecutableʹPIF Λ౉͍ͯ͠Δ • https://github.com/apple/swift-package-manager/blob/main/Sources/XCBuildSupport/XcodeBuildSystem.swift PIFͱxcbuild • PIFΛฤूͯ͠ϏϧυઃఆΛ࿔Ε͹͜ΕͰϏϧυͰ͖ΔͷͰ͸ʁ • →Ͱ͖ͨ 🎉
  12. ScipioϓϩδΣΫτͷݱঢ় • ࠷৽൛Ͱ͸ଟ͘ͷύοέʔδ͕XCFrameworkԽͰ͖ΔΑ͏ʹ 🎉 • swift-nio, firebase-ios-sdk, RxSwiftͳͲ • Ұ෦SwiftPMͷfork͕ඞཁͰɺݱঢ়upstreamʹରͯ͠PRૹͬͨΓ͠

    ͍ͯͯϦϦʔεͰ͖͍ͯͳ͍ͷͰਖ਼ࣜϦϦʔεΛ͓଴͍ͪͩ͘͞ • 2023/2/21ݱࡏɺࢼ͍ͨ͠ํ͸͜ͷPR͕࠷৽൛Ͱ͢ • https://github.com/giginet/Scipio/pull/51