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

General improvments #268

Merged
merged 2 commits into from
Dec 12, 2024
Merged

Conversation

Totto16
Copy link
Contributor

@Totto16 Totto16 commented Dec 9, 2024

This adds some general improvements and three bug fixes, I saw when implementing #261

Bugs:

  • The meson version wasn't detected correctly, since the g flag was used in the regex for the version number, so the resulting match array was ["1.6.0"] instead of ["1.6.0","1","6","0"]
  • The version comparison was done manually in 5e9c9e9#diff-9a3b5396b880a25586663b03f9bda56906914991b7b43b493283eca3ccc74fc3R28 and there we only checked version[1] < 50, which only worked correctly before 1.0.0 (thsi never showed, since after this check we additionally check, if the returned filename is an array or not, so this only cleans this up)
  • The slicing of the version for meson was done incorrectly, ["1.6.0","1","6","0"].slice(1,.3) results in ["1","6"] and not in three components

Improvements:

  • add Version class, that handles:
    • comparison, so that we don't make obvious errors and so that it's much simpler
    • toString function, so that it can be easily printed
    • check at runtime, if the input is correct, this can help detect feature errors easier, if e.g. muon changes it's version string, that we parse, so that we get a nice and early error (this also helped my find bug 3)

Most of these things I "need" for #261 or at least it makes the life much more easy, (I print versions in some places, comparison is an improvement, that benefits also existing code)

Feel free to suggest any changes 😄

@Totto16 Totto16 force-pushed the general_improvments branch from 5e9c9e9 to 753fd25 Compare December 9, 2024 20:09
@Totto16 Totto16 force-pushed the general_improvments branch from 753fd25 to 7463dd9 Compare December 9, 2024 20:16
@Totto16 Totto16 mentioned this pull request Dec 9, 2024
4 tasks
src/types.ts Outdated Show resolved Hide resolved
@Totto16 Totto16 force-pushed the general_improvments branch from 7463dd9 to 8d8b9f8 Compare December 9, 2024 20:48
src/formatters.ts Outdated Show resolved Hide resolved
@tristan957
Copy link
Contributor

Looks good. Please squash at will, and I will merge!

this type allows pretty printing, version comparison, and runtime checks, to detect such errors as the one fixed in the previous commit

also use the proper compare methods, where we previously did it by hand

add class for ToolCheckResult: it is now easier to check if it's an error or not
@Totto16 Totto16 force-pushed the general_improvments branch from ef4a9d3 to c010638 Compare December 12, 2024 16:46
@Totto16
Copy link
Contributor Author

Totto16 commented Dec 12, 2024

Squashed it to 2 commits, which makes the most sense to me

@tristan957 tristan957 added this pull request to the merge queue Dec 12, 2024
Merged via the queue into mesonbuild:main with commit 9fb8065 Dec 12, 2024
4 checks passed
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.

2 participants