rules_spm
rules_spm copied to clipboard
Update `rules_spm` to build fetched dependencies using Bazel instead of Swift Package Manager
Goals
- Fetch dependencies using Swift Package Manager (SPM)
- Generate Bazel build targets for the fetched dependencies
- Ensure that the fetched dependencies have typical Bazel dependency names (e.g.
https://github.com/grpc/grpc-swift
becomescom_github_grpc_grpc_swift
) - Provide a mechanism for external dependencies to have a custom Bazel dependency name.
Reasoning
- Address duplicate symbol errors when the client project and a client project dependency both load the same dependency
- #148
- #86
- Allow target platform compilation to work properly (e.g., build for iOS device on macOS)
Tasks
- [x] Add support for pure Swift packages
- [x] Add support for packages with C that do not have special settings (e.g.
CSetting
). - [x] Derive source package directory name from the repository URL, not the package name.
- [ ] Migrate
spm_parser
to a separate repository.- [ ] Migrate the code
- [ ] Create a release process that builds binaries for MacOS and Linux
- [ ] Update
rules_spm
to downloadspm_parser
. - [ ] Add code to
interesting_deps
example that useslibwebp
. example - [ ] Add support for packages with Objective-C.
- [ ] Add support for packages with C that do have special settings (e.g.
CSetting
). - [ ] Implement functional tests for
spm_parser
. - [ ] Enable integration tests that test
build_mode
set tobazel
.
Working Examples
- [X]
simple
- [X]
simple_with_dev_dir
- [X]
simple_revision
- [x]
interesting_deps
- Need to derive the source package name from the repo URL and not the pkg_name. - [ ]
simple_with_binary
- The binary that we define works. Theswiftformat
andswiftlint
do not work due to special C settings. - [ ]
ios_sim
- Requires support for special C settings. - [ ]
local_package
- Requires support for special C settings. - [ ]
public_hdrs
- Need to find source path frompath
setting in thePackage.swift
. (e.g. TrustKit) - [ ]
vapor
- Requires support for special C settings.