目录
目录README.md

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
关于
105.0 KB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

©Copyright 2023 CCF 开源发展委员会
Powered by Trustie& IntelliDE 京ICP备13000930号