rules_spm icon indicating copy to clipboard operation
rules_spm copied to clipboard

Update `rules_spm` to build fetched dependencies using Bazel instead of Swift Package Manager

Open cgrindel opened this issue 2 years ago • 4 comments

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 becomes com_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 download spm_parser.
  • [ ] Add code to interesting_deps example that uses libwebp. 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 to bazel.

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. The swiftformat and swiftlint 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 from path setting in the Package.swift. (e.g. TrustKit)
  • [ ] vapor - Requires support for special C settings.

cgrindel avatar Jun 13 '22 14:06 cgrindel