Skip to content

Instantly share code, notes, and snippets.

@laevandus
Created November 26, 2022 03:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laevandus/842ca1ed2feaf44c79dd5a5d1c66637c to your computer and use it in GitHub Desktop.
Save laevandus/842ca1ed2feaf44c79dd5a5d1c66637c to your computer and use it in GitHub Desktop.
import Foundation
import PackagePlugin
@main
struct ToomasKitPlugin: BuildToolPlugin {
func createBuildCommands(context: PackagePlugin.PluginContext, target: PackagePlugin.Target) async throws -> [PackagePlugin.Command] {
let inputJSON = target.directory.appending("Source.json")
let output = context.pluginWorkDirectory.appending("GeneratedEnum.swift")
return [
.buildCommand(displayName: "Generate Code",
executable: try context.tool(named: "CodeGenerator").path,
arguments: [inputJSON, output],
environment: [:],
inputFiles: [inputJSON],
outputFiles: [output])
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment