-
Notifications
You must be signed in to change notification settings - Fork 480
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
Obtain inventory version from Project.toml #2442
Conversation
@mortenpi How do you feel about this one? I'm still working on an alternative PR that patches in the Also, even in the So why not just always just go to the I completely agree with the sentiment that "there should only be one source" for a "version", but I'd say the |
I don't think we should involve (*) If we'd be implementing Documenter from scratch, then that's a design decision that should definitely be questioned, but I really don't want to complicate the logic here.
Right, but then we should also be using that in So I am still very much partial to #2443 without the |
But I just don't see it:
I'll be happy to implement whatever you like best, but I have two hard requirements:
|
Unless maybe you wanted to use the version from "latest" with |
Never mind, that doesn't work. The I'd have look at which folders exist on the So all I can do is reiterate: |
Ugh. One complication: This doesn't work for Julia itself, which uses a I still think this is the way to go, but also checking for a So that is the one thing where Morten's preferred #2443 could have an edge. Edit: fixed in latest commit (now also reads |
This is required to set the inventory version for the Julia project itself. Also adds (implicit) support for `JuliaProject.toml`. This is not documented, as it's understood that `JuliaProject.toml` is just an alias for `Project.toml`, and not something we want to confuse people with too much.
7e35e9e
to
f7f960a
Compare
If `deploydocs` is deploying for a tagged version, verify that that version matches the `version` in the `objects.inv` inventory file. If not, throw an error: The inventory `version` must never contradict what the version-selection-menu shows.
I've updated this to make sure there can never be a mismatch between the version detected here and the version in |
objects_inv = joinpath(realpath(target), "objects.inv") | ||
if isfile(objects_inv) | ||
inventory_version = _get_inventory_version(objects_inv) | ||
deploy_version = _get_deploy_version(deploy_subfolder) | ||
if !isempty(deploy_version) && (inventory_version != deploy_version) | ||
error("Inventory declares version `$inventory_version`, but `deploydocs` is for version `$deploy_version`") | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mortenpi This is the bit of code in deploydocs
that would guarantee that there is never a mismatch between the automatic version extracted from the Project.toml
and what is shown in the versions-selection menu for tagged releases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you think the error
is too harsh or might be considered semver-breaking, I'd also be okay making it an @error
, and potentially even overwriting the inventory_version
with the deploy_version
. That would be extremely close to #2448, but the "fallback" would happen in makedocs
instead of deploydocs
, which I'd much prefer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #2449, which might be starting to become my preferred solution (since I actually agree with you that for a tagged release, the version
that comes out of deploydocs
is kinda authoritative).
This always obtains the
version
for the inventory from theProject.toml
in any parent directory of the current working directory. For virtually all normal Julia projects, this should do the right thing.If no
Project.toml
can be found, show a warning and use an empty string.This does not add a new
version
/inventory_version
argument toHTML()
: In the rare situation where the defaultversion
is inappropriate, I would recommend manually patching theobjects.inv
file indocs/make.jl
, betweenmakedocs
anddeploydocs
. I'll add something toDocInventories
to make this kind of patching easier.My preferred alternative to #2433 and #2443