Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable strict concurrency #213

Merged
merged 5 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
with:
linux_5_9_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_5_10_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to lose warnings-as-errors on 5.10, as we can no longer maintain it with this change.

linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error"
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"
linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"

benchmarks:
name: Benchmarks
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ jobs:
with:
linux_5_9_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_5_10_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error"
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"
linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"

benchmarks:
name: Benchmarks
Expand Down
8 changes: 7 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 5.8
// swift-tools-version: 5.9
//===----------------------------------------------------------------------===//
//
// This source file is part of the SwiftCertificates open source project
Expand Down Expand Up @@ -91,6 +91,12 @@ if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
]
}

for target in package.targets {
var settings = target.swiftSettings ?? []
settings.append(.enableExperimentalFeature("StrictConcurrency=complete"))
target.swiftSettings = settings
}

// --- STANDARD CROSS-REPO SETTINGS DO NOT EDIT --- //
for target in package.targets {
if target.type != .plugin {
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ a default verifier and a number of built-in verifier policies.

## Supported Swift Versions

This library was introduced with support for Swift 5.7 or later. This library will
support the latest stable Swift version and the two versions prior.
This library will support the latest stable Swift version and the two versions prior.

## Getting Started

Expand Down
2 changes: 1 addition & 1 deletion Sources/X509/SecKeyWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ extension Certificate.PrivateKey {

@usableFromInline
static func keyAttributes(key: SecKey) throws -> [String: any Sendable] {
guard let attributes = SecKeyCopyAttributes(key) as? [CFString: Any] else {
guard let attributes = SecKeyCopyAttributes(key) as? [CFString: any Sendable] else {
throw CertificateError.unsupportedPrivateKey(
reason: "cannot copy SecKey attributes"
)
Expand Down
7 changes: 5 additions & 2 deletions Tests/X509Tests/SecKeyWrapperTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

import XCTest
@_spi(Testing) @testable import X509
#if canImport(Darwin)
@preconcurrency import Security
#endif

#if canImport(Darwin)
final class SecKeyWrapperTests: XCTestCase {
Expand Down Expand Up @@ -62,9 +65,9 @@ final class SecKeyWrapperTests: XCTestCase {
}

@available(macOS 11.0, iOS 14, tvOS 14, watchOS 7, *)
func testPEMExport() throws {
func testPEMExport() async throws {
for candidate in try generateCandidateKeys() {
try XCTContext.runActivity(named: "Testing \(candidate.type) key (size: \(candidate.keySize))") { _ in
try await XCTContext.runActivity(named: "Testing \(candidate.type) key (size: \(candidate.keySize))") { _ in
let secKeyWrapper = try Certificate.PrivateKey.SecKeyWrapper(key: candidate.key)

if !candidate.sep {
Expand Down
3 changes: 3 additions & 0 deletions Tests/X509Tests/SignatureTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ import XCTest
import _CryptoExtras
import SwiftASN1
@testable import X509
#if canImport(Darwin)
@preconcurrency import Security
#endif

final class SignatureTests: XCTestCase {
static let now = Date()
Expand Down
Loading