Skip to content
Merged
Show file tree
Hide file tree
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
24 changes: 12 additions & 12 deletions Plugins/SwordBuildToolPlugin/SwordBuildToolPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ struct SwordBuildToolPlugin: BuildToolPlugin {
to: URL(fileURLWithPath: sourceModule.directory.string, isDirectory: true).standardized
)
}
let output = context.pluginWorkDirectory.appending("Sword.generated.swift")
let output = context.pluginWorkDirectoryURL.appending(path: "Sword.generated.swift")
var arguments = [String]()
let targetNames = targetByName.keys
if !targetNames.isEmpty {
Expand All @@ -24,11 +24,11 @@ struct SwordBuildToolPlugin: BuildToolPlugin {
if !inputDirectories.isEmpty {
arguments += ["--inputs"] + inputDirectories
}
arguments += ["--output", output.string]
arguments += ["--output", output.relativePath]
return [
.buildCommand(
displayName: "Run SwordCommand",
executable: try context.tool(named: "SwordCommand").path,
executable: try context.tool(named: "SwordCommand").url,
arguments: arguments,
outputFiles: [output]
)
Expand Down Expand Up @@ -74,26 +74,26 @@ extension SwordBuildToolPlugin: XcodeBuildToolPlugin {
return false
}
}
let inputPaths = ([target] + frameworkTargets).flatMap { target in
let inputURLs = ([target] + frameworkTargets).flatMap { target -> [URL] in
target.inputFiles
.filter { $0.type == .source && $0.path.extension == "swift" }
.map(\.path)
.filter { $0.type == .source && $0.url.pathExtension == "swift" }
.map { $0.url }
}
let output = context.pluginWorkDirectory.appending("Sword.generated.swift")
let output = context.pluginWorkDirectoryURL.appending(path: "Sword.generated.swift")
var arguments = [String]()
if !frameworkTargets.isEmpty {
arguments += ["--targets"] + frameworkTargets.map(\.displayName)
}
if !inputPaths.isEmpty {
arguments += ["--inputs"] + inputPaths.map(\.string)
if !inputURLs.isEmpty {
arguments += ["--inputs"] + inputURLs.map(\.relativePath)
}
arguments += ["--output", output.string]
arguments += ["--output", output.relativePath]
return [
.buildCommand(
displayName: "Run SwordCommand",
executable: try context.tool(named: "SwordCommand").path,
executable: try context.tool(named: "SwordCommand").url,
arguments: arguments,
inputFiles: inputPaths,
inputFiles: inputURLs,
outputFiles: [output]
)
]
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwordGenerator/Parser/Visitor/ModuleVisitor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ final class ModuleVisitor: SourceFileVisitor<ModuleDescriptor> {
return ProviderDescriptor(
name: function.name.text,
isStaticFunction: function.modifiers.contains(where: {
$0.as(DeclModifierSyntax.self)?.name.text == "static"
$0.name.text == "static"
}),
returnType: function.signature.returnClause.map { Type(value: "\($0.type.trimmed)") },
parameters: parameters,
Expand Down