KipplePlugins

main

A collection of Swift Package Manager plugins.
swift-kipple/Plugins

KipplePlugins

CI Status Latest Release Swift Compatibility Platform Compatibility License

A collection of Swift Package Manager plugins.

⚠️ The code in this library has been made public as-is for the purposes of education, discovery, and personal use. It is NOT production-ready; however, if you're interested in leveraging this library as a dependency for your own projects, feel free to do so (at your own risk) and open GitHub issues for any problems you encounter and I will do my best to provide support.

To Do

General

  • Include default configuration files (so repositories don't need their own) via PluginSupport module.
  • Allow repository to override the configuration file used with standard local dotfile for the applicable command.
  • [] Add pre-commit installation scripts.
  • [] Add setup.sh and other common script files to the project.

Format

  • Add Format command (via SwiftFormat) as Swift Package and Xcode plugins.
  • Add functionality for formatting staged files only.

Lint

  • [] Add Lint command (via SwiftLint) as Swift Package and Xcode plugin.
  • [] Add functionality for linting staged files only.

Example Xcode Plugin

#if canImport(XcodeProjectPlugin)
import XcodeProjectPlugin

extension FormatPlugin: XcodeCommandPlugin {
    func performCommand(context: XcodePluginContext, arguments: [String]) throws {
        try self.perform(
            swiftformat: try context.tool(named: "swiftformat"),
            fileProvider: try context.tool(named: "kipple-file-provider"),
            // FIXME: This needs to detect the version somehow! Detect a .swift-version file, maybe?
            defaultSwiftVersion: "5.7",
            arguments: arguments
        ) { targetNames in
            // It is impossible to provide directories like in Swift Package case
            // because input files in XcodeTarget aren't restricted by a directory.
            let targets = context.xcodeProject.targets.filter { targetNames.contains($0.displayName) }
            return targets.flatMap(\.inputFiles).map(\.path.string)
        }
    }
}
#endif

Description

  • Swift Tools 5.6.0
View More Packages from this Author

Dependencies

Last updated: Thu Sep 29 2022 16:29:55 GMT-0500 (GMT-05:00)