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

Make topkg doc work, so that topkg publish doc also works. #3

Merged
1 commit merged into from
Jun 2, 2017
Merged

Make topkg doc work, so that topkg publish doc also works. #3

1 commit merged into from
Jun 2, 2017

Conversation

samoht
Copy link
Owner

@samoht samoht commented Jun 1, 2017

Note: this does not (yet) create a global index for all the documented packages

OS.Cmd.run @@ Cmd.(jbuilder % "build" % "--root" % "."))
Log.debug (fun l -> l "files=%s" (String.concat ", " files));
match List.rev files with
| "doc/api.docdir/index.html" :: _ -> (* topkg doc *)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pretty fragile. @dbuenzli is there a better way to know that we are building the docs? Something in the build context maybe?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last time I looked at the topkg API I didn't see anything about it. But I think @dbuenzli wants to rework the handling of documentation in topkg.

In the meantime, let's just add a comment explaining what's happening. We can probably use List.mem as well rather than checking only the last target.


let uerror = Unix.error_message

let rec mkdir dir =
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dbuenzli: any objection into moving mkdir and copy upstream into Topkg.OS.Dir?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Topkg.OS doesn't depend on unix.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hum good point

@samoht
Copy link
Owner Author

samoht commented Jun 1, 2017

I think it would be fine to have a hand-written mld file used as top-level index too. I suspect multi-package repositories usually contain a few packages, so it should be ok to keep that file up-to-date (and would maybe help to describe the relations between the various packages).

@samoht samoht mentioned this pull request Jun 1, 2017
>>= fun () ->
let src = "_build" // "default" // "_doc" in
let dst = "_build" // "doc" // "api.docdir" in
copy src dst
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why copy instead of rename? AFAIU, this is essentially a one time build

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't want to use Unix initially but I had to due to mkdir. So yes, I guess I could use rename.

@samoht
Copy link
Owner Author

samoht commented Jun 2, 2017

I've force-pushed a new version.

Note: this does not (yet) create a global index for all the documented packages
>>= fun () ->
let src = "_build" // "default" // "_doc" in
let dst = "_build" // "doc" // "api.docdir" in
rmdir dst >>= fun () ->
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to remove the directory before? Is the build directory kept between run?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you do topkg doc yes, it is kept.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. this is a lot of code for a workaround :(, but hopefully it's just temporary

@ghost ghost merged commit f831637 into samoht:master Jun 2, 2017
@samoht
Copy link
Owner Author

samoht commented Sep 4, 2017

@diml would it be possible to have a new release with this change? This is needed to have topkg publish doc works seamlessly. Thanks!

This pull request was closed.
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