Add example of pulling SPM deps
Opened this issue · 6 comments
rules_ios
compiles SPM based deps w/o changes. The gist is you can effectively add the targets you want from package.swift
into a BUILD
file.
Maybe we can make a simple example of pulling Collections
in rules_ios
via an http_archive - or vendoring the code into third_party
for folks who don't want to pull from network deps.
Any progress on this? It would be nice to see an example.
Theres some examples of manually creating BUILD files for SPM targets here: https://github.com/bazel-ios/rules_ios/blob/master/tests/ios/frameworks/external-dependency/external_dependency.bzl
If you want to instead automate this process, recommend you checkout: https://github.com/cgrindel/rules_swift_package_manager it's purpose is consume SPM packages as Bazel targets.
@luispadron awesome, thanks for cleaning this up for us! Did we end up getting rules_ios working e2e with rules_swift_package_manager
with the common features we use?
Did we end up getting rules_ios working e2e with
rules_swift_package_manager
with the common features we use?
We use it today successfully but only for the command line tool we're building at Cash App. I believe it should work with rules_iOS if we have decent compatibility with rules_swift / rules_apple targets. We'll be looking at moving from cocoapods to SPM for 3rd party deps once we have more of the Bazel migration completed and can try to add better support here
Cool, does it seem reasonable to set the exit criteria of #560 to just have some tested way the common SPM rules work E2E? Also that CLI isn't on rules_ios so it might be orthogonal to this.
Sure I took this issue as meaning to show how to consume an SPM package, which we have examples of in this repo. If we want something else though I'll reopen