forked from pantsbuild/pants
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add codec for ExternalTool known version field (pantsbuild#15950)
ExternalTool has known_versions as packed strings in the form `"1.2.3|linux_arm64 |feed6789feed6789feed6789feed6789feed6789feed6789feed6789feed6789|112233"`. This MR adds an internal dataclass to handle encoding and decoding this field. Having a separate codec (which includes encoding) will help with tooling to generate these. For example, this MR is prework for scraping all the versions of Terraform. Backwards compatibility note: This is fully backwards compatible. This MR only extracts the codec, and uses it as a container for returning values. Packed strings are still used in positions where they were before, so any user configs will still work. This MR does not add the ability to supply either a string or an ExternalToolVersion; although used in the Terraform tool, the dataclasses are encoded to strings. (I wasn't sure if there was an easy way to have a field that is a `Union[ExternalToolVersion, str]`). This MR also preserves the signature of the original `split_known_version_str` method, in case it is used in plugins; it modifies the body to forward to the codec. (I guess we could deprecate this if we wanted.) [ci skip-rust]
- Loading branch information
Showing
3 changed files
with
52 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters