-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
forc doc
: Generate dependency documentation
#4546
Conversation
Not sure why the CI build for also cc @mitchmindtree & @JoshuaBatty |
Sorry @eureka-cpu, couldn't get to this today, will try to understand first thing tomorrow though 👍 |
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.
I tracked down the issue, if you print the path in the build_deps
function you can see that before canonicalizing it is ../sway-lib-core
but the relative path should be taken into account from sway-lib-std's folder.
CI is running the command like forc-doc --manifest-path ../sway-lib-std
in the root folder which tries to canonicalize /sway/../sway-lib-core
which does not exist. You need to join the path of the dependency with the package's path (the package that declares the dependency).
You can verify this is the case by going into the sway-lib-std folder and running forc-doc
directly there. It is working as /sway/sway-lib-std/../sway-lib-core
is a valid path.
That being said, I see that forc-doc
has a custom logic for building which requires bunch of common code with forc-pkg. I guess the reason for not using forc-pkg
was the fact that forc-doc requires type and decl engines. I would suggest adding a nice function to forc-pkg, which uses all the established logic likeBuildPlan
like our build_with_opts
end point, but at the same time accepts the engines from caller. This way you would loose duplicated building steps, automatically support dependencies declared by git and ipfs as well, also this path issues will be gone as forc-pkg
can give you an iterator of correct paths for each member in the BuildPlan
and finally you would get the recursive dependency logic for free.
Hey @sdankel yes, this is expected. This PR simply allows the dependencies to be built at all, but it does not yet implement the logic to link them together. If you take a look at the file structure in
These are small changes, but are directly related when put in the context of generating dependency docs. |
Nice, I will take a look 🙂 Thanks @kayagokalp Odd that it is working as intended on my machine though! |
Are you trying in the sway repo's root folder? It doesn't work in my system if I run |
Ah I see now, that is what I was doing. Thanks again @kayagokalp 🙂 |
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.
Looks nice! left couple of nits. I opened #4573, after that we can remove all the custom build effort for forc-doc
, and use the usual route of forc-pkg
👌
Description
Generates the documentation for dependencies & small improvements to the API.
What's new so far:
cargo doc
forc doc
: Add support for dependencies #4533assets
folder: Closesforc doc
: Changeassets
folder tostatic.files
#4545forc doc
: Check for and removedoc
folder when generating new docs #4544Checklist
Breaking*
orNew Feature
labels where relevant.