Skip to content

Commit

Permalink
Add support for Swift 6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ncipollo committed Oct 11, 2024
1 parent 796ea3c commit 8ad666a
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>
<true/>
</dict>
</plist>
79 changes: 79 additions & 0 deletions .swiftpm/xcode/xcshareddata/xcschemes/WhoopDIKit.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1600"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "WhoopDIKit"
BuildableName = "WhoopDIKit"
BlueprintName = "WhoopDIKit"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "WhoopDIKitTests"
BuildableName = "WhoopDIKitTests"
BlueprintName = "WhoopDIKitTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "WhoopDIKit"
BuildableName = "WhoopDIKit"
BlueprintName = "WhoopDIKit"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
9 changes: 5 additions & 4 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"originHash" : "3262a5846ea4516117d0058e3c3efc147f6e7e7eafb82b0dd6de03a2d3e001d4",
"pins" : [
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-syntax.git",
"location" : "https://github.com/swiftlang/swift-syntax.git",
"state" : {
"revision" : "64889f0c732f210a935a0ad7cda38f77f876262d",
"version" : "509.1.1"
"revision" : "0687f71944021d616d34d922343dcef086855920",
"version" : "600.0.1"
}
}
],
"version" : 2
"version" : 3
}
6 changes: 3 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.9
// swift-tools-version:6.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import CompilerPluginSupport
Expand All @@ -14,10 +14,10 @@ let package = Package(
products: [
.library(
name: "WhoopDIKit",
targets: ["WhoopDIKit", "WhoopDIKitMacros"]),
targets: ["WhoopDIKit",]),
],
dependencies: [
.package(url: "https://github.com/apple/swift-syntax.git", from: "509.0.0")
.package(url: "https://github.com/swiftlang/swift-syntax.git", from: "600.0.0-latest")
],
targets: [
.target(
Expand Down
2 changes: 1 addition & 1 deletion Sources/WhoopDIKit/ServiceKey.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// Hashable wrapper for a metatype value.
/// See https://stackoverflow.com/questions/42459484/make-a-swift-dictionary-where-the-key-is-type
public struct ServiceKey {
public struct ServiceKey: Sendable {
public let type: Any.Type
public let name: String?

Expand Down
4 changes: 2 additions & 2 deletions Sources/WhoopDIKit/WhoopDI.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation
public final class WhoopDI: DependencyRegister {
private static let serviceDict = ServiceDictionary<DependencyDefinition>()
private static var localServiceDict: ServiceDictionary<DependencyDefinition>? = nil
nonisolated(unsafe) private static let serviceDict = ServiceDictionary<DependencyDefinition>()
nonisolated(unsafe) private static var localServiceDict: ServiceDictionary<DependencyDefinition>? = nil

/// Registers a list of modules with the DI system.
/// Typically you will create a `DependencyModule` for your feature, then add it to the module list provided to this method.
Expand Down
7 changes: 6 additions & 1 deletion Tests/WhoopDIKitTests/InjectableTests.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import Foundation
@testable import WhoopDIKitMacros
import SwiftSyntaxMacrosTestSupport
import XCTest

// Macro implementations build for the host, so the corresponding module is not available when cross-compiling.
// Cross-compiled tests may still make use of the macro itself in end-to-end tests.
#if canImport(WhoopDIKitMacros)
@testable import WhoopDIKitMacros

final class InjectableTests: XCTestCase {
func testBasicInject() {
assertMacroExpansion(
Expand Down Expand Up @@ -132,3 +136,4 @@ final class InjectableTests: XCTestCase {
macros: ["Injectable": InjectableMacro.self])
}
}
#endif

0 comments on commit 8ad666a

Please sign in to comment.