Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version management #1: introducing pavexc #163

Merged
merged 25 commits into from
Jan 16, 2024
Merged

Version management #1: introducing pavexc #163

merged 25 commits into from
Jan 16, 2024

Conversation

LukeMathWalker
Copy link
Owner

What's wrong

For Pavex to work as expected, the version of the CLI used when compiling a project with cargo px [...] must match the version of the pavex library crate used in the project.
Currently, there's no mechanism to ensure this is the case. As a result, you'll get version mismatches, resulting in confusing errors (see @m1guelpf in #131).
The problem is even worse if you have multiple Pavex projects, each using a different library version: you'd have to juggle multiple CLI versions on your own since they can't all be in the PATH.

The solution

To eliminate the problem, this PR reworks the pavex CLI: it is now a version manager.
All the meaty functionality (server SDK generation, project generation) is moved into another binary, pavexc (pavex compiler).
pavex introduces the concept of toolchains, in the same vein of rustup. There can be multiple toolchains installed and it'll pick the most appropriate one for each command:

  • For new, it'll check the default toolchain. If none has been defined, it'll use the corresponding version of pavexc.
  • For generate, it'll match the version of pavex (the library) used in the project. If the corresponding pavexc toolchain is not installed, it'll be installed on the fly.

Missing pieces

The pavex CLI needs to grow a few commands to manage toolchains: pavex toolchain default set, pavex toolchain default show, pavex toolchain list and something for removal.
Since they are only relevant for pavex new, that's deferred to a later PR.

@LukeMathWalker LukeMathWalker merged commit 325626f into main Jan 16, 2024
11 checks passed
@LukeMathWalker LukeMathWalker deleted the pavexc-bin branch January 16, 2024 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant