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

Create TypelevelUnidocPlugin #119

Merged
merged 17 commits into from
Mar 2, 2022

Conversation

armanbilge
Copy link
Member

@armanbilge armanbilge commented Jan 30, 2022

This one is pretty simple. A plugin to publish a unidoc artifact to sonatype/maven accessible via javadoc.io, e.g.:

https://www.javadoc.io/doc/org.typelevel/sbt-typelevel_2.12/0.4.4/

AFAIK since javadoc.io can't render snapshots, you can't really update docs between releases.

build.sbt Outdated
Comment on lines 151 to 156
lazy val unidoc = project
.in(file("unidoc"))
.enablePlugins(TypelevelUnidocPlugin)
.settings(
name := "sbt-typelevel-unidoc"
)
Copy link
Member Author

Choose a reason for hiding this comment

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

This is how you set it up. Choice of "unidoc" for the module name is arbitrary—it would be good to establish a best practice.

Copy link
Member Author

@armanbilge armanbilge Jan 30, 2022

Choose a reason for hiding this comment

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

Actually: this might not even need a separate module. In theory you could enable the TypelevelUnidocPlugin on your core module and it would replace its API docs artifact with the unidoc artifact. Not entirely sure if this would work—could be playing with fire.

Edit: just tried this and it seems to work 😅

)

private[sbt] def javadocioUrl = Def.setting {
if (isSnapshot.value) None // javadoc.io doesn't support snapshots
Copy link
Member Author

Choose a reason for hiding this comment

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

build.sbt Outdated
Comment on lines 167 to 168
tlSiteApiModule := Some((unidoc / projectID).value),
tlSiteApiPackage := Some("org.typelevel.sbt")
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a bit clunky.

Copy link
Member Author

Choose a reason for hiding this comment

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

I have an idea to set tlSiteApiModule := Some((unidoc / projectID).value) automatically.

Copy link
Member Author

Choose a reason for hiding this comment

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

A bit reflection-y but gets the job done :)

// tell the site plugin about us, without forcing the dependency!
ThisBuild / SettingKey[Option[ModuleID]]("tlSiteApiModule") := Some(projectID.value)

build.sbt Outdated
Comment on lines 156 to 158
// Doesn't conflict w/ core artifact since this one won't have the sbt cross version suffix
// javadoc.io doesn't recognize sbt artifacts, so we must publish like this
name := "sbt-typelevel",
Copy link
Member Author

Choose a reason for hiding this comment

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

In retrospect not sure if naming the artifact sbt-typelevel is a good idea. sbt-typelevel-docs or sbt-typelevel-unidoc etc. is much better.

@armanbilge armanbilge added this to the v0.4.5 milestone Feb 10, 2022
@armanbilge
Copy link
Member Author

I got additional support for this idea in erikerlandson/coulomb#233 (reply in thread). So I'm going to move ahead with it for the next release :)

@armanbilge armanbilge merged commit 4795978 into typelevel:series/0.4 Mar 2, 2022
@armanbilge armanbilge linked an issue Mar 2, 2022 that may be closed by this pull request
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.

Integrate Unidoc with TypelevelSitePlugin
1 participant