Skip to content

Commit

Permalink
Reorganize file structures
Browse files Browse the repository at this point in the history
  • Loading branch information
Ellie Shin committed Jan 17, 2020
1 parent 0661d40 commit 08398d6
Show file tree
Hide file tree
Showing 11 changed files with 389 additions and 342 deletions.
5 changes: 3 additions & 2 deletions MockoloFramework.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Pod::Spec.new do |s|
s.osx.deployment_target = '10.14'
s.swift_version = '5.1'
s.dependency 'SourceKittenFramework', '~>0.26.0'
s.source = { :http => "#{s.homepage}/archive/#{s.version}.zip", :flatten => true }
# s.source_files = 'Sources/MockoloFramework/**/*.swift'
s.source = { :git => 'https://github.com/uber/mockolo.git', :tag => '1.1.2' }
s.source_files = 'Sources/MockoloFramework/**/*.swift'
s.exclude_files = 'Sources/MockoloFramework/Parsers/ViaSwiftSyntax/**/*.swift'
end
4 changes: 2 additions & 2 deletions Sources/Mockolo/Executor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,16 @@ class Executor {
do {
try generate(sourceDirs: srcDirs,
sourceFiles: srcs,
parser: shouldUseSourceKit ? ParserViaSourceKit() : ParserViaSwiftSyntax(),
exclusionSuffixes: exclusionSuffixes,
mockFilePaths: mockFilePaths,
annotation: annotation,
header: header,
macro: macro,
parserType: shouldUseSourceKit ? .sourceKit : .swiftSyntax,
to: outputFilePath,
loggingLevel: loggingLevel,
concurrencyLimit: concurrencyLimit,
onCompletion: { _ in
onCompletion: { _ in
log("Done. Exiting program.", level: .info)
exit(0)
})
Expand Down
2 changes: 1 addition & 1 deletion Sources/MockoloFramework/Models/ParsedEntity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ final class EntityNodeSubContainer {


/// Metadata for a type being mocked
final class Entity {
public final class Entity {
var filepath: String = ""
var data: Data? = nil

Expand Down
36 changes: 18 additions & 18 deletions Sources/MockoloFramework/Operations/Generator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ public enum ParserType {
/// Performs end to end mock generation flow
public func generate(sourceDirs: [String]?,
sourceFiles: [String]?,
parser: SourceParsing,
exclusionSuffixes: [String],
mockFilePaths: [String]?,
annotation: String,
header: String?,
macro: String?,
parserType: ParserType,
to outputFilePath: String,
loggingLevel: Int,
concurrencyLimit: Int?,
Expand Down Expand Up @@ -63,20 +63,19 @@ public func generate(sourceDirs: [String]?,
let t0 = CFAbsoluteTimeGetCurrent()
log("Process input mock files...", level: .info)
if let mockFilePaths = mockFilePaths {
generateProcessedTypeMap(mockFilePaths,
parserType: parserType,
semaphore: sema,
queue: mockgenQueue) { (elements, imports) in
elements.forEach { element in
parentMocks[element.entityNode.name] = element
}

for (path, modules) in imports {
if pathToImportsMap[path] == nil {
pathToImportsMap[path] = []
}
pathToImportsMap[path]?.append(contentsOf: modules)
}
parser.parseClasses(mockFilePaths,
semaphore: sema,
queue: mockgenQueue) { (elements, imports) in
elements.forEach { element in
parentMocks[element.entityNode.name] = element
}

for (path, modules) in imports {
if pathToImportsMap[path] == nil {
pathToImportsMap[path] = []
}
pathToImportsMap[path]?.append(contentsOf: modules)
}
}
}
signpost_end(name: "Process input")
Expand All @@ -86,11 +85,12 @@ public func generate(sourceDirs: [String]?,
signpost_begin(name: "Generate protocol map")
log("Process source files and generate an annotated/protocol map...", level: .info)

generateProtocolMap(sourceDirs: sourceDirs,
sourceFiles: sourceFiles,
let paths = sourceDirs ?? sourceFiles
let isDirs = sourceDirs != nil
parser.parseProtocols(paths,
isDirs: isDirs,
exclusionSuffixes: exclusionSuffixes,
annotation: annotation,
parserType: parserType,
semaphore: sema,
queue: mockgenQueue) { (elements, imports) in
elements.forEach { element in
Expand Down
108 changes: 0 additions & 108 deletions Sources/MockoloFramework/Operations/ProcessedTypeMapGenerator.swift

This file was deleted.

Loading

0 comments on commit 08398d6

Please sign in to comment.