Skip to content

Commit

Permalink
Merge branch 'master' into swift-syntax-510.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
alanzeino authored Aug 20, 2024
2 parents dc9d2f4 + 22c350c commit 9f1412b
Show file tree
Hide file tree
Showing 15 changed files with 55 additions and 27 deletions.
46 changes: 37 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,54 @@ on:
branches: [ master ]

env:
DEVELOPER_DIR: /Applications/Xcode_14.1.app
DEVELOPER_DIR: /Applications/Xcode_15.4.app

jobs:
build:
runs-on: macos-12
NeedleFoundationTests:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: "NeedleFoundationTests"
run: xcodebuild test -project NeedleFoundation.xcodeproj -scheme NeedleFoundation -destination 'platform=iOS Simulator,OS=16.1,name=iPhone 14'
run: xcodebuild test -project NeedleFoundation.xcodeproj -scheme NeedleFoundation -destination 'platform=iOS Simulator,OS=17.5,name=iPhone 15'
NeedleGeneratorTests:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: "NeedleGeneratorTests"
run: cd Generator && swift test -Xswiftc -DDEBUG
NeedleGeneratorBinary:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: "NeedleGeneratorBinary"
run: cd Generator && swift build -c release
NeedleSampleMVCApp:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: "NeedleSampleMVCApp"
run: xcodebuild build -project Sample/MVC/TicTacToe/TicTacToe.xcodeproj -scheme TicTacToe -destination 'platform=iOS Simulator,OS=16.1,name=iPhone 14'
run: xcodebuild build -project Sample/MVC/TicTacToe/TicTacToe.xcodeproj -scheme TicTacToe -destination 'platform=iOS Simulator,OS=17.5,name=iPhone 15'
NeedleSampleMVCTests:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: "NeedleSampleMVCTests"
run: xcodebuild test -project Sample/MVC/TicTacToe/TicTacToe.xcodeproj -scheme TicTacToeTests -destination 'platform=iOS Simulator,OS=16.1,name=iPhone 14'
run: xcodebuild test -project Sample/MVC/TicTacToe/TicTacToe.xcodeproj -scheme TicTacToeTests -destination 'platform=iOS Simulator,OS=17.5,name=iPhone 15'
NeedleSamplePluginizedApp:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: "NeedleSamplePluginizedApp"
run: xcodebuild build -project Sample/Pluginized/TicTacToe/TicTacToe.xcodeproj -scheme TicTacToe -destination 'platform=iOS Simulator,OS=16.1,name=iPhone 14'
run: xcodebuild build -project Sample/Pluginized/TicTacToe/TicTacToe.xcodeproj -scheme TicTacToe -destination 'platform=iOS Simulator,OS=17.5,name=iPhone 15'
NeedleSamplePluginizedScoreSheetTests:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: "NeedleSamplePluginizedScoreSheetTests"
run: xcodebuild test -project Sample/Pluginized/TicTacToe/TicTacToe.xcodeproj -scheme ScoreSheetTests -destination 'platform=iOS Simulator,OS=16.1,name=iPhone 14'
run: xcodebuild test -project Sample/Pluginized/TicTacToe/TicTacToe.xcodeproj -scheme ScoreSheetTests -destination 'platform=iOS Simulator,OS=17.5,name=iPhone 15'
NeedleSamplePluginizedTicTacToeCoreTests:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: "NeedleSamplePluginizedTicTacToeCoreTests"
run: xcodebuild test -project Sample/Pluginized/TicTacToe/TicTacToe.xcodeproj -scheme TicTacToeCoreTests -destination 'platform=iOS Simulator,OS=16.1,name=iPhone 14'
run: xcodebuild test -project Sample/Pluginized/TicTacToe/TicTacToe.xcodeproj -scheme TicTacToeCoreTests -destination 'platform=iOS Simulator,OS=17.5,name=iPhone 15'
2 changes: 1 addition & 1 deletion Generator/Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.6
// swift-tools-version:5.10
import PackageDescription

let package = Package(
Expand Down
2 changes: 1 addition & 1 deletion Generator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Needle is intended to be heavily multi-threaded. This makes stepping through the

### Structure of generated code

The shortest way to describe the code generated by needle is that it's primary purpose is to create classes that conform to all the `*Dependency` protocols in your application code.
The shortest way to describe the code generated by needle is that its primary purpose is to create classes that conform to all the `*Dependency` protocols in your application code.

In order to do this needle creates Provider classes which perform the job just described. So the providers need to have a number of vars, one for each of the vars in the protocol. The body of these vars is quite simple. Typically, something like:
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import Foundation
import SourceParsingFramework

/// The generation phase entry class that executes tasks to process dependency
/// graph components, inlcuding pluginized and non-core ones, into necessary
/// graph components, including pluginized and non-core ones, into necessary
/// dependency providers and their registrations, then exports the contents to
/// the destination path.
class PluginizedDependencyGraphExporter {
Expand All @@ -28,10 +28,10 @@ class PluginizedDependencyGraphExporter {
/// code for the given components and pluginized components, and export
/// the source code to the given destination path.
///
/// - parameter components: Array of Components to generate dependnecy
/// - parameter components: Array of Components to generate dependency
/// providers for
/// - parameter pluginizedComponents: Array of pluginized components to
/// generate plugin extensions and dependnecy providers for.
/// generate plugin extensions and dependency providers for.
/// - parameter imports: The import statements.
/// - parameter path: Path to file where we want the results written to.
/// - parameter executor: The executor to use for concurrent computation of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import Foundation

/// A serializer that produces the class definitation source code for the
/// A serializer that produces the class definition source code for the
/// plugin extension provider.
class PluginExtensionDynamicContentSerializer: Serializer {

Expand All @@ -36,7 +36,7 @@ class PluginExtensionDynamicContentSerializer: Serializer {

return """
/// \(component.data.name) plugin extension
extension \(component.data.name): ExtensionRegistration {
extension \(component.data.name): NeedleFoundation.ExtensionRegistration {
public func registerExtensionItems() {
\(properties)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import SourceParsingFramework
import SwiftParser

/// A task that parses a Swift source content and produces Swift AST that
/// can then be parsed into the dependnecy graph.
/// can then be parsed into the dependency graph.
class ASTProducerTask: AbstractTask<AST> {

/// Initializer.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ let bootstrapComponentName = "BootstrapComponent"
/// The name of the protocol that all Dependency protocols inherit from.
let dependencyProtocolName = "Dependency"

/// The name fo the class that all Component classes inherit from
/// The name of the class that all Component classes inherit from
let componentClassName = "Component"
2 changes: 1 addition & 1 deletion Generator/Sources/needle/Version.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
// limitations under the License.
//

let version = "0.24.0"
let version = "0.25.0"
Binary file modified Generator/bin/needle
Binary file not shown.
2 changes: 1 addition & 1 deletion NeedleFoundation.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'NeedleFoundation'
s.version = '0.24.0'
s.version = '0.25.0'
s.summary = 'Compile-time safe Swift dependency injection framework with real code.'
s.description = 'Needle is a dependency injection (DI) system for Swift. Unlike other DI frameworks, such as Cleanse, Swinject, Needle encourages hierarchical DI structure and utilizes code generation to ensure compile-time safety. This allows us to develop our apps and make changes with confidence. If it compiles, it works. In this aspect, Needle is more similar to Android Dagger.'

Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.1
// swift-tools-version:5.10
import PackageDescription

let package = Package(
Expand Down
2 changes: 1 addition & 1 deletion Sources/NeedleFoundation/Bootstrap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import Foundation

/// An empty protocol that can be used for any components that require no
/// dependencies. This can be used as the dependnecy protocol of the root
/// dependencies. This can be used as the dependency protocol of the root
/// component of a dependency graph.
public protocol EmptyDependency: AnyObject {}

Expand Down
6 changes: 3 additions & 3 deletions Sources/NeedleFoundation/Component.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public protocol Registration {
/// directly.
/// @CreateMock
public protocol Scope: AnyObject {
/// The path to reach this component on the dependnecy graph.
/// The path to reach this component on the dependency graph.
var path: [String] { get }

/// The parent of this component.
Expand Down Expand Up @@ -83,7 +83,7 @@ open class Component<DependencyType>: Scope {
/// The parent of this component.
public let parent: Scope

/// The path to reach this scope on the dependnecy graph.
/// The path to reach this scope on the dependency graph.
// Use `lazy var` to avoid computing the path repeatedly. Internally,
// this is always accessed with the `__DependencyProviderRegistry`'s lock
// acquired.
Expand Down Expand Up @@ -207,7 +207,7 @@ open class Component<DependencyType>: Scope {
/// The parent of this component.
public let parent: Scope

/// The path to reach this scope on the dependnecy graph.
/// The path to reach this scope on the dependency graph.
// Use `lazy var` to avoid computing the path repeatedly. Internally,
// this is always accessed with the `__DependencyProviderRegistry`'s lock
// acquired.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import Foundation
// Once that happens, we can declare an `open createDependencyProvider`
// method in the base component class. Generate extensions to all the
// component subclasses that override the method to instantiate the
// dependnecy providers.
// dependency providers.
public class __DependencyProviderRegistry {

/// The singleton instance.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import Foundation
// Once that happens, we can declare an `open createPluginExtensionProvider`
// method in the base pluginized component class. Generate extensions to
// all the pluginized component subclasses that override the method to
// instantiate the dependnecy providers.
// instantiate the dependency providers.
public class __PluginExtensionProviderRegistry {

/// The singleton instance.
Expand Down

0 comments on commit 9f1412b

Please sign in to comment.