Skip to content
This repository has been archived by the owner on Apr 3, 2023. It is now read-only.

Handle project that uses rules_spm and one of its dependencies also uses rules_spm #86

Open
cgrindel opened this issue Oct 27, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@cgrindel
Copy link
Owner

cgrindel commented Oct 27, 2021

Project A - Has dep on a package (e.g. swift-nio).
Project B - Has dep on Project A and a package that Project A uses as a dep (e.g. swift-nio)

Problem:

  1. If spm_repositories for Project A and B have the same name, we will get a duplicate declaration.
  2. If spm_repositories for Project A and B have the same names, we will get duplicate symbol errors during compile/linking

Options:

  1. Require that Project A provides a Package.swift; Project B would use spm_repositories to use the dependency.
  2. Rework rules_spm deps logic;
  • Each project that uses rules_spm would provide their package info (i.e., deps and platforms) via function.
  • The root project would collect all of the package info for all of the deps (and deps of deps) and pass it to spm_repositories.

Option 1 Thoughts

  • Biggest benefit: SPM figures it all out; it already handles all of the dep merging mechanics
  • We could provide a build rule to generate a Package.swift; it could be copied to source using rules_updatesrc.
  • Non-Bazel projects can consume the project
  • Biggest downside: Can't treat the dep repository as a Bazel repo (i.e., can't use local_repository)
    • Note: spm_pkg does support local packages. So, this may not be a big deal.

Option 2 Thoughts:

  • Biggest benefit: Can treat dep repository as a Bazel repo
  • Biggest downside: Need to rework package declarations
    • Each project that uses rules_spm would implement a function that returns their package info (deps and platforms)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant