Skip to content
Closed
Changes from all 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
35 changes: 18 additions & 17 deletions Generator/Plugin/File/CuckooPluginFile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ struct CuckooPluginFile: BuildToolPlugin {
.filter { $0.type == .source }

return try commands(
sources: sources.map(\.path),
sources: sources.map(\.url),
executableFactory: context.tool(named:),
projectDir: context.package.directory,
derivedSourcesDir: context.pluginWorkDirectory
projectDir: context.package.directoryURL,
derivedSourcesDir: context.pluginWorkDirectoryURL
)
}
}
Expand Down Expand Up @@ -52,35 +52,36 @@ extension CuckooPluginFile: XcodeBuildToolPlugin {
}

return try commands(
sources: sources.map(\.path),
sources: sources.map(\.url),
executableFactory: context.tool(named:),
projectDir: context.xcodeProject.directory,
derivedSourcesDir: context.pluginWorkDirectory
projectDir: context.xcodeProject.directoryURL,
derivedSourcesDir: context.pluginWorkDirectoryURL
)
}
}
#endif

func commands(
sources: [Path],
sources: [URL],
executableFactory: (String) throws -> PluginContext.Tool,
projectDir: Path,
derivedSourcesDir: Path
projectDir: URL,
derivedSourcesDir: URL
) throws -> [Command] {
let configurationPath = projectDir.appending("Cuckoofile.toml")
let output = derivedSourcesDir.appending("GeneratedMocks.swift")
let configurationURL = projectDir.appending(path: "Cuckoofile.toml")
let outputURL = derivedSourcesDir.appending(component: "GeneratedMocks.swift")

return [
.buildCommand(
displayName: "Run Cuckoonator (single file)",
executable: try executableFactory("CuckooGenerator").path,
executable: try executableFactory("CuckooGenerator").url,
arguments: [],
environment: [
"PROJECT_DIR": projectDir,
"DERIVED_SOURCES_DIR": derivedSourcesDir,
"CUCKOO_OVERRIDE_OUTPUT": output,
"PROJECT_DIR": projectDir.path(),
"DERIVED_SOURCES_DIR": derivedSourcesDir.path(),
"CUCKOO_OVERRIDE_OUTPUT": outputURL.path(),
],
inputFiles: [configurationPath] + sources,
outputFiles: [output]
inputFiles: [configurationURL] + sources,
outputFiles: [outputURL]
)
]
}
Loading