最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【记录】尝试使用Swift的包管理器:SPM,Swift Package Manager

Swift crifan 3547浏览 0评论

之前管理swift的库都是尽量用Carthage,结果对于:

github “thii/SwiftHEXColors”

去更新SwiftHEXColors,结果出错:

The following build commands failed:
    Check dependencies
(1 failure)
A shell task (/usr/bin/xcrun xcodebuild -project /Users/crifan/dev/dev_root/crifan/FeeeShadowsocks/FreeShadowsocks/Carthage/Checkouts/SwiftHEXColors/SwiftHEXColors.xcodeproj -scheme SwiftHEXColors -configuration Release -sdk iphoneos ONLY_ACTIVE_ARCH=NO BITCODE_GENERATION_MODE=bitcode CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES clean build) failed with exit code 65:
2016-10-14 20:09:57.763 xcodebuild[18312:1564900] [MT] PluginLoading: Required plug-in compatibility UUID 8A66E736-A720-4B3C-92F1-33D9962C69DF for plug-in at path ‘~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/WCGitTagsPlugin.xcplugin’ not present in DVTPlugInCompatibilityUUIDs
2016-10-14 20:09:57.764 xcodebuild[18312:1564900] [MT] PluginLoading: Required plug-in compatibility UUID 8A66E736-A720-4B3C-92F1-33D9962C69DF for plug-in at path ‘~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/RealmPlugin.xcplugin’ not present in DVTPlugInCompatibilityUUIDs
2016-10-14 20:09:57.764 xcodebuild[18312:1564900] [MT] PluginLoading: Required plug-in compatibility UUID 8A66E736-A720-4B3C-92F1-33D9962C69DF for plug-in at path ‘~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin’ not present in DVTPlugInCompatibilityUUIDs
** CLEAN FAILED **
The following build commands failed:
    Check dependencies
(1 failure)
** BUILD FAILED **
The following build commands failed:
    Check dependencies
(1 failure)

去看了最新主页:

GitHub – thii/SwiftHEXColors: HEX color handling as an extension for UIColor.

其支持:Swift Package Manager

所以打算去试试。

Swift Package Manager  usage

GitHub – apple/swift-package-manager: The Package Manager for the Swift Programming Language

➜  FreeShadowsocks swift package –version
Apple Swift Package Manager – Swift 3.0.0 (swiftpm-19)

Playing with the Swift Package Manager – A Tutorial – Swift and iOS Writing – Medium

Swift Package Manager快速上手指南(一):环境搭建-CSDN.NET

Swift.org – Package Manager

import PackageDescription
let package = Package(
    name: “MyPackage”,
    dependencies: [
        // Other dependencies
        .Package(url: “https://github.com/thii/SwiftHEXColors.git”, majorVersion: 1)
    ]
)

提示:

Package.Swift:9:8: No such module ‘PackageDescription’

-》

好像暂时Swift 3的Swift Package Manager都不支持iOS?

3 Steps to marry Xcode with Swift Package Manager – honza dvorsky

Introducing the Swift Package Manager

Swift Package Manager  iOS 使用

ios – swift 包管理怎么用 – SegmentFault

Swift Package Manager 快速入门指引 | Aotu.io「凹凸实验室」

为你的 Swift Packages 命名 | Swift 教程 – Swift 语言学习 – Swift code – SwiftGG 翻译组 – 高质量的 Swift 译文网站

iOS开发周报:Swift 开源,新的包管理和 Swift 3.0 前瞻

如何通过Swift Package Manager 来构建一个简单的开发环境_IOS开发-织梦者

how to use swift package manager

Dependency Management with the Swift Package Manager

➜  FreeShadowsocks swift build –version
Apple Swift Package Manager – Swift 3.0.0 (swiftpm-19)
➜  FreeShadowsocks swift package –help
OVERVIEW: Perform operations on Swift packages
USAGE: swift package [command] [options]
COMMANDS:
  init [–type <type>]                   Initialize a new package
      (type: empty|library|executable|system-module)
  fetch                                  Fetch package dependencies
  update                                 Update package dependencies
  generate-xcodeproj [–output <path>]   Generates an Xcode project
  show-dependencies [–format <format>]  Print the resolved dependency graph
      (format: text|dot|json)
  dump-package [–input <path>]          Print parsed Package.swift as JSON
OPTIONS:
  -C, –chdir <path>        Change working directory before any other operation
  –color <mode>            Specify color mode (auto|always|never)
  –enable-code-coverage    Enable code coverage in generated Xcode projects
  -v, –verbose             Increase verbosity of informational output
  –version                 Print the Swift Package Manager version
  -Xcc <flag>               Pass flag through to all C compiler invocations
  -Xlinker <flag>           Pass flag through to all linker invocations
  -Xswiftc <flag>           Pass flag through to all Swift compiler invocations
NOTE: Use `swift build` to build packages, and `swift test` to test packages
➜  FreeShadowsocks swift build –help
OVERVIEW: Build sources into binary products
USAGE: swift build [mode] [options]
MODES:
  -c, –configuration <value>   Build with configuration (debug|release) [default: debug]
  –clean [<mode>]              Delete artifacts (build|dist) [default: build]
OPTIONS:
  -C, –chdir <path>       Change working directory before any other operation
  –build-path <path>      Specify build directory [default: ./.build]
  –color <mode>           Specify color mode (auto|always|never) [default: auto]
  -v, –verbose            Increase verbosity of informational output
  -Xcc <flag>              Pass flag through to all C compiler invocations
  -Xlinker <flag>          Pass flag through to all linker invocations
  -Xswiftc <flag>          Pass flag through to all Swift compiler invocations
NOTE: Use `swift package` to perform other functions on packages
➜  FreeShadowsocks swift package update
Cloning https://github.com/thii/SwiftHEXColors.git
HEAD is now at c4ca840 1.0.4
Resolved version: 1.0.4
error: the module at FreeShadowsocksTests has an invalid name (‘FreeShadowsocksTests’): the name of a non-test module has a ‘Tests’ suffix
fix: rename the module at ‘FreeShadowsocksTests’ to not have a ‘Tests’ suffix

不过看到新增Packages文件夹,以及其下的库:

➜  FreeShadowsocks ll
total 24
-rw-r–r–  1 crifan  staff   207B 10 14 20:06 Cartfile
-rw-r–r–@ 1 crifan  staff   243B 10 14 20:07 Cartfile.resolved
drwxr-xr-x  4 crifan  staff   136B 10 14 20:08 Carthage
drwxr-xr-x  9 crifan  staff   306B 10 14 20:26 FreeShadowsocks
drwxr-xr-x  5 crifan  staff   170B 10 14 20:34 FreeShadowsocks.xcodeproj
drwxr-xr-x  4 crifan  staff   136B 10 14 19:52 FreeShadowsocksTests
drwxr-xr-x  4 crifan  staff   136B 10 14 19:52 FreeShadowsocksUITests
-rw-r–r–@ 1 crifan  staff   370B 10 14 20:44 Package.Swift
drwxr-xr-x  3 crifan  staff   102B 10 14 20:47 Packages
➜  FreeShadowsocks ls -h Packages/SwiftHEXColors-1.0.4
LICENSE                          Sources                          SwiftHEXColorsExamples
Package.swift                    SwiftHEXColors.podspec           SwiftHEXColorsExamples.xcodeproj
README.md                        SwiftHEXColors.xcodeproj         Tests
➜  FreeShadowsocks ll Packages/SwiftHEXColors-1.0.4
total 32
-rw-r–r–  1 crifan  staff   1.0K 10 14 20:47 LICENSE
-rw-r–r–  1 crifan  staff    73B 10 14 20:47 Package.swift
-rw-r–r–  1 crifan  staff   3.4K 10 14 20:47 README.md
drwxr-xr-x  5 crifan  staff   170B 10 14 20:47 Sources
-rw-r–r–  1 crifan  staff   645B 10 14 20:47 SwiftHEXColors.podspec
drwxr-xr-x  5 crifan  staff   170B 10 14 20:47 SwiftHEXColors.xcodeproj
drwxr-xr-x  7 crifan  staff   238B 10 14 20:47 SwiftHEXColorsExamples
drwxr-xr-x  5 crifan  staff   170B 10 14 20:47 SwiftHEXColorsExamples.xcodeproj
drwxr-xr-x  4 crifan  staff   136B 10 14 20:47 Tests

swift package update

Swift Package Manager Super Updates – ankit.im

swift-package-manager/Documentation at master · apple/swift-package-manager · GitHub

Using Xcode and Swift Package Manager Together · Caesar Wirth

ios – Using Swift Package Manager with Xcode – Stack Overflow

swift package manager ios Xcode

How to Marry Xcode and Swift Package Manager – Medium

How to Install Package in Xcode via Swift Package Manager – Stack Overflow

去build报同样错误:

➜  FreeShadowsocks swift build
error: the module at FreeShadowsocksTests has an invalid name (‘FreeShadowsocksTests’): the name of a non-test module has a ‘Tests’ suffix
fix: rename the module at ‘FreeShadowsocksTests’ to not have a ‘Tests’ suffix

SPM error: the module at   has an invalid name

Problems using Swift Package Manager · Issue #1582 · Alamofire/Alamofire · GitHub

Build error with Swift Package Manager · Issue #1544 · Alamofire/Alamofire · GitHub

->里面有详细的步骤

但是怎么还需要搞什么

Sources文件夹

生成xcode项目文件啥的

-》感觉一点都不好方便,不好用。

【总结】

感觉SPM还是不成熟,不方便,不用了。

等SPM以后成熟了再说。

转载请注明:在路上 » 【记录】尝试使用Swift的包管理器:SPM,Swift Package Manager

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
91 queries in 0.200 seconds, using 22.04MB memory