Skip to content

Commit

Permalink
Merge pull request #144 from uber/version-update
Browse files Browse the repository at this point in the history
Rename files and update configs & version
  • Loading branch information
EspressoCup authored Apr 29, 2021
2 parents cc085c1 + 5ca5bb6 commit e723dc2
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 71 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Build Actions
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
macos:
runs-on: macOS-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Build
run: swift build -v
- name: Test
run: swift test -v -c release

8 changes: 0 additions & 8 deletions .travis.yml

This file was deleted.

10 changes: 1 addition & 9 deletions Sources/Mockolo/Executor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ class Executor {
do {
try generate(sourceDirs: srcDirs,
sourceFiles: srcs,
parser: ParserViaSwiftSyntax(),
parser: SourceParser(),
exclusionSuffixes: exclusionSuffixes,
mockFilePaths: mockFilePaths,
annotation: annotation,
Expand All @@ -233,11 +233,3 @@ class Executor {
}
}
}

public struct Version {
/// The string value for this version.
public let value: String

/// The current Mockolo version.
public static let current = Version(value: "1.3.2")
}
1 change: 1 addition & 0 deletions Sources/Mockolo/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import Foundation
import TSCUtility
import TSCBasic
import MockoloFramework

func main() {
let parser = ArgumentParser(usage: "<options>", overview: "Mockolo: Swift mock generator.")
Expand Down
2 changes: 1 addition & 1 deletion Sources/MockoloFramework/Operations/Generator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ enum InputError: Error {
/// Performs end to end mock generation flow
public func generate(sourceDirs: [String]?,
sourceFiles: [String]?,
parser: SourceParsing,
parser: SourceParser,
exclusionSuffixes: [String],
mockFilePaths: [String]?,
annotation: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,32 @@
import Foundation
import SwiftSyntax

public class ParserViaSwiftSyntax: SourceParsing {

public enum DeclType {
case protocolType, classType, other, all
}

public class SourceParser {
public init() {}

/// Parses processed decls (mock classes) and calls a completion block
/// @param paths File paths containing processed mocks
/// @param fileMacro: File level macro
/// @param completion:The block to be executed on completion
public func parseProcessedDecls(_ paths: [String],
fileMacro: String?,
completion: @escaping ([Entity], ImportMap?) -> ()) {
scan(paths) { (path, lock) in
self.generateASTs(path, annotation: "", fileMacro: fileMacro, declType: .classType, lock: lock, completion: completion)
}
}

/// Parses decls (protocol, class) with annotations (/// @mockable) and calls a completion block
/// @param paths File/dir paths containing types with mock annotation
/// @param isDirs:True if paths are dir paths
/// @param exclusionSuffixess List of file suffixes to exclude when processing
/// @param annotation The mock annotation
/// @param fileMacro: File level macro
/// @param declType: The declaration type, e.g. protocol, class.
/// @param completion:The block to be executed on completion
public func parseDecls(_ paths: [String]?,
isDirs: Bool,
exclusionSuffixes: [String]? = nil,
Expand Down
49 changes: 0 additions & 49 deletions Sources/MockoloFramework/Parsers/SourceParsing.swift

This file was deleted.

7 changes: 7 additions & 0 deletions Sources/MockoloFramework/Version.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
public struct Version {
/// The string value for this version.
public let value: String

/// The current Mockolo version.
public static let current = Version(value: "1.4.0")
}
2 changes: 1 addition & 1 deletion Tests/MockoloTestCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class MockoloTestCase: XCTestCase {

try? generate(sourceDirs: nil,
sourceFiles: srcFilePaths,
parser: ParserViaSwiftSyntax(),
parser: SourceParser(),
exclusionSuffixes: ["Mocks", "Tests"],
mockFilePaths: mockFilePaths,
annotation: String.mockAnnotation,
Expand Down

0 comments on commit e723dc2

Please sign in to comment.