cgrindel / rules_swift_package_manager

Collection of utilities and Bazel rules to aid in the development and maintenance of Swift repositories using Bazel.
Apache License 2.0
74 stars 29 forks source link

Support target type `plugin` (module_type is `PluginTarget`) #46

Open cgrindel opened 1 year ago

cgrindel commented 1 year ago

Currently, just treating it as a library.

cgrindel commented 1 year ago

Until we have a use-case for using plugins in Bazel, I am going to close this issue.

cgrindel commented 1 year ago

The following describes a use-case for plugin support.

So plugins are interesting because the Plugin itself is getting compiled with swiftc and then invoked to return those build commands. In Xcode these build commands are translated to shell scripts but we should probably translate them to gen rules in Bazel. The return build commands should give enough information to construct a proper bazel rule with all the input and outputs.

A use-case that comes to mind is just building a gRPC service. Grpc-swift also offers a SPM plugin: https://github.com/grpc/grpc-swift/blob/main/Sources/protoc-gen-grpc-swift/Docs.docc/spm-plugin.md

It would be great if we can have an example in your repository that builds a gRPC server where the proto file is part of the repo and the plugin is used to generate the Swift code from it.

GevaZeichner commented 7 months ago

Another use case: https://github.com/securevale/swift-confidential The plugin there would generate a Swift file with encrypted secrets, but that doesn't work with rules_swift_package_manager