Skip to content

Conversation

@nyurik
Copy link
Contributor

@nyurik nyurik commented Sep 26, 2025

implement #2616

Note that this also allows #2290

_required_just_ver := if semver_matches(just_version(), '>=1.43.0') == 'true' {
  'yes'
} else {
  error('just version 1.43.0 or greater is required, found ' + just_version())
}

@nyurik nyurik force-pushed the just_version branch 3 times, most recently from 42cc35d to 01c3e34 Compare September 28, 2025 02:33
@nyurik
Copy link
Contributor Author

nyurik commented Oct 3, 2025

@casey hi, are there any blockers or concerns with this? Thx!

@laniakea64
Copy link
Contributor

Sorry if I'm missing something, but so far the proposed use cases for this function revolve around detecting whether the running just version has the features the justfile requires. But when a too-old just version is presented with a syntax or function that requires a later just version, it will fail with a compile error before the justfile's version check is evaluated. So as casey said in #2290 (comment) , a just function cannot fulfill those use cases.

Are there any other use cases for just_version()?

@nyurik
Copy link
Contributor Author

nyurik commented Oct 3, 2025

ironically, my biggest use case is NOT to do version check, but rather to reliably report the version from inside. All my just-using projects have this section. I need it to work in CI before anything else - just so that I can debug bigger issues.

# Print environment info
env-info:
    @echo "Running for '{{main_crate}}' crate {{if ci_mode == '1' {'in CI mode'} else {'in dev mode'} }} on {{os()}} / {{arch()}}"
    {{just_executable()}} --version
    rustc --version
    cargo --version
    rustup --version

What I recently discovered is that this breaks on Windows - because just_executable() returns Windows path, but if the script runs using bash, it creates all sorts of problems. So if we have {{just_version()}}, I will have more flexibility in the future.

Do note that with every function we will have the "before" and "after" -- so anyone who wants to use any new function will have to ensure that the version of the just executable will handle it. Not much we can do about it "in retrospect" other than to create some external wrappers.

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