pekko/project/ParadoxBrowse.scala

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

39 lines
1.1 KiB
Scala
Raw Normal View History

/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* license agreements; and to You under the Apache License, version 2.0:
*
* https://www.apache.org/licenses/LICENSE-2.0
*
2023-06-22 14:19:26 +01:00
* This file is part of the Apache Pekko project, which was derived from Akka.
*/
/*
2022-02-04 12:36:44 +01:00
* Copyright (C) 2018-2022 Lightbend Inc. <https://www.lightbend.com>
*/
package org.apache.pekko
import com.lightbend.paradox.sbt.ParadoxPlugin
import com.lightbend.paradox.sbt.ParadoxPlugin.autoImport._
import sbt.Keys._
import sbt._
object ParadoxBrowse extends AutoPlugin {
object autoImport {
val paradoxBrowse = taskKey[Unit]("Open the docs in the default browser")
}
import autoImport._
override def trigger = allRequirements
override def requires = ParadoxPlugin
override lazy val projectSettings = Seq(paradoxBrowse := {
import java.awt.Desktop
val rootDocFile = (Compile / paradox).value / "index.html"
val log = streams.value.log
if (Desktop.isDesktopSupported) Desktop.getDesktop.open(rootDocFile)
else log.info(s"Couldn't open default browser, but docs are at $rootDocFile")
})
}