$ git clone https://github.com/giginet/Scipio.git $ cd Scipio $ swift run -c release scipio --help # Add reference .build/release/scipio to the PATH variable. $ export PATH=/path/to/scipio:$PATH
1.2 作为Package使用
推荐使用这种方式,较少命令行中参数,在Swift代码中EntryPoint配置方便。
2 准备您应用程序的所有依赖项
2.1 创建一个新的Swift包来描述依赖关系
1 2 3
$ mkdir MyAppDependencies $ cd MyAppDependencies $ swift package init
// 1. Add the xcstrings-tool Package dependency .package(url: "https://github.com/liamnichols/xcstrings-tool.git", from: "0.1.0") // 2. Or use the repo is essentially a mirror of the main repository however the xcstrings-tool command line interface is a binary dependency that significantly simplifies your build graph and improves compile times. .package(url: "https://github.com/liamnichols/xcstrings-tool-plugin.git", from: "0.1.0")
Printing description of error: ▿ AFError ▿ serverTrustEvaluationFailed : 1 element ▿ reason : ServerTrustFailureReason ▿ noRequiredEvaluator : 1 element - host : "***" (lldb) po error.debugDescription "Server trust evaluation failed due to reason: A ServerTrustEvaluating value is required for host *** but none was found."
原因是配置了白名单
1 2 3 4 5 6 7 8 9 10 11
var evaluators: [String: ServerTrustEvaluating] = [:]
let evaluators: [String: ServerTrustEvaluating] = [ "*.yourdomain.com": PinnedCertificatesTrustEvaluator() ] // 白名单 allHostsMustBeEvaluated: true let serverTrust =ServerTrustManager(allHostsMustBeEvaluated: true, evaluators: evaluators)
// 从给定的文件名创建证书:SecCertificate对象。 staticfunccertificate(filename: String) -> SecCertificate { let filePath =Bundle.test.path(forResource: filename, ofType: "cer")! let data =try!Data(contentsOf: URL(fileURLWithPath: filePath)) let certificate =SecCertificateCreateWithData(nil, data asCFData)!
return certificate } }
functestThatExpiredCertificateRequestFailsWhenPinningLeafPublicKeyWithCertificateChainValidation() { // Given // 这里直接从证书提取公钥 let keys = [TestCertificates.leaf].af.publicKeys let evaluators = [expiredHost: PublicKeysTrustEvaluator(keys: keys)]
let manager =Session(configuration: configuration, serverTrustManager: ServerTrustManager(evaluators: evaluators))
let expectation = expectation(description: "\(expiredURLString)") var error: AFError?
// When manager.request(expiredURLString) .response { resp in error = resp.error expectation.fulfill() }
waitForExpectations(timeout: timeout)
// Then XCTAssertNotNil(error, "error should not be nil") XCTAssertEqual(error?.isServerTrustEvaluationError, true)
ifcaselet .serverTrustEvaluationFailed(reason)?= error { if#available(iOS12, macOS10.14, tvOS12, watchOS5, *) { XCTAssertTrue(reason.isTrustEvaluationFailed, "should be .trustEvaluationFailed") } else { XCTAssertTrue(reason.isDefaultEvaluationFailed, "should be .defaultEvaluationFailed") } } else { XCTFail("error should be .serverTrustEvaluationFailed") } }
task: name: hello macos_instance: # can be a remote or a local virtual machine # image: ghcr.io/cirruslabs/macos-sonoma-base:latest image: sonoma-xcode hello_script: - echo"Hello from within a Tart VM!" - echo"Here is my CPU info:" - sysctl -n machdep.cpu.brand_string - sleep 15
运行该task
将上述 .cirrus.yml 文件放入存储库的根目录中,并使用以下命令运行它:
1 2
brew install cirruslabs/cli/cirrus cirrus run
从 Tart VM 中检索工件
在许多情况下,需要从 Tart 虚拟机中检索特定文件或文件夹。例如,以下 .cirrus.yml 配置定义了一个任务,该任务构建二进制 tart 文件并通过 artifacts 指令公开它:
1 2 3 4 5 6 7
task: name: Build macos_instance: image: ghcr.io/cirruslabs/macos-sonoma-xcode:latest build_script: swift build --product tart binary_artifacts: path: .build/debug/tart
task: name: xcode test macos_instance: # can be a remote or a local virtual machine # image: ghcr.io/cirruslabs/macos-sonoma-base:latest image: sonoma-xcode hello_script: - echo"Hello from within a Tart VM!" - echo"Here is my CPU info:" - sysctl -n machdep.cpu.brand_string build_script: xcodebuild -scheme DemoApp -destination 'platform=iOS Simulator,name=iPhone 15,OS=17.2' clean test binary_artifacts: path: .build/debug/tart
GitHub Actions 部分log
1 2 3 4 5 6 7 8 9 10
Run cirrus run 'xcode test' task pull virtual machine clone virtual machine boot virtual machine syncing working directory 'hello' script 'build' script 'binary' artifacts 'xcode test' task succeeded in 03:17!
Open Chinese Convert (OpenCC, 開放中文轉換) is an opensource project for conversions between Traditional Chinese, Simplified Chinese and Japanese Kanji (Shinjitai). It supports character-level and phrase-level conversion, character variant conversion and regional idioms among Mainland China, Taiwan and Hong Kong. This is not translation tool between Mandarin and Cantonese, etc.
Features
Strictly differentiate between 「one simplified to many traditionals」 and 「one simplified to many variants」. Completely compatible with different variants and can realize dynamic substitution. Strictly scrutinize one-simplified-to-multiple-traditional entries, and the principle is 「if it can be divided, then it will be divided」. Support Mainland China, Taiwan, Hong Kong, different variants and regional customary word conversion, such as 「裏」「裡」、「鼠標」「滑鼠」.
If you have any questions or suggestions, you can contact them through Email.
Showing Recent Messages Swift package target 'Core' is linked as a static library by 'AppCommoms' and 'Core', but cannot be built dynamically because there is a package product with the same name.
Swift package target 'Core' is linked as a static library by 'Onboarding' and 'Core', but cannot be built dynamically because there is a package product with the same name.
Swift package target 'Core' is linked as a static library by 'AppSDK' and 'Core', but cannot be built dynamically because there is a package product with the same name.
classAppCommomsBundle { staticvar module: Bundle= { // Bundle name should be like this "ProductName_TargetName" let bundleName ="AppCommoms_AppCommoms" let candidates = [ // Bundle should be present here when the package is linked into an App. Bundle.main.resourceURL, // Bundle should be present here when the package is linked into a framework. Bundle(for: BundleFinder.self).resourceURL, // SwiftUI Preview Bundle(for: BundleFinder.self).resourceURL?.deletingLastPathComponent().deletingLastPathComponent(), // For command-line tools. Bundle.main.bundleURL ] +Bundle.allBundles.map { $0.bundleURL } for candidate in candidates { let bundlePath = candidate?.appendingPathComponent(bundleName +".bundle") iflet bundle = bundlePath.flatMap(Bundle.init(url:)) { return bundle } } returnBundle(for: BundleFinder.self) // fatalError("unable to find bundle named \(bundleName)") }() }
使用Bundle.module
还有一种更简单的方案就是用Apple推荐的Bundle.module,也是Rswift使用的public let R = _R(bundle: Bundle.module)。
Access a resource in codein page link Always use Bundle.module when you access resources. A package shouldn’t make assumptions about the exact location of a resource.
import class Foundation.Bundle import class Foundation.ProcessInfo import struct Foundation.URL
privateclassBundleFinder {}
extensionFoundation.Bundle { /// Returns the resource bundle associated with the current Swift module. staticlet module: Bundle= { let bundleName ="Onboarding_Onboarding"
let overrides: [URL] #ifDEBUG // The 'PACKAGE_RESOURCE_BUNDLE_PATH' name is preferred since the expected value is a path. The // check for 'PACKAGE_RESOURCE_BUNDLE_URL' will be removed when all clients have switched over. // This removal is tracked by rdar://107766372. ifletoverride=ProcessInfo.processInfo.environment["PACKAGE_RESOURCE_BUNDLE_PATH"] ??ProcessInfo.processInfo.environment["PACKAGE_RESOURCE_BUNDLE_URL"] { overrides = [URL(fileURLWithPath: override)] } else { overrides = [] } #else overrides = [] #endif
let candidates = overrides + [ // Bundle should be present here when the package is linked into an App. Bundle.main.resourceURL,
// Bundle should be present here when the package is linked into a framework. Bundle(for: BundleFinder.self).resourceURL,
// For command-line tools. Bundle.main.bundleURL, ]
for candidate in candidates { let bundlePath = candidate?.appendingPathComponent(bundleName +".bundle") iflet bundle = bundlePath.flatMap(Bundle.init(url:)) { return bundle } } fatalError("unable to find bundle named Onboarding_Onboarding") }() }