2023-01-08 17:13:31 +08:00
|
|
|
/*
|
|
|
|
|
* 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.
|
2023-01-08 17:13:31 +08:00
|
|
|
*/
|
|
|
|
|
|
2018-03-13 23:45:55 +09:00
|
|
|
/*
|
2022-02-04 12:36:44 +01:00
|
|
|
* Copyright (C) 2018-2022 Lightbend Inc. <https://www.lightbend.com>
|
2018-03-13 23:45:55 +09:00
|
|
|
*/
|
|
|
|
|
|
2022-11-12 10:21:24 +01:00
|
|
|
package org.apache.pekko
|
2017-10-30 03:13:14 +02:00
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
2021-02-01 15:38:29 +00:00
|
|
|
override lazy val projectSettings = Seq(paradoxBrowse := {
|
|
|
|
|
import java.awt.Desktop
|
2021-05-25 12:50:51 +02:00
|
|
|
val rootDocFile = (Compile / paradox).value / "index.html"
|
2021-02-01 15:38:29 +00:00
|
|
|
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")
|
|
|
|
|
})
|
2017-10-30 03:13:14 +02:00
|
|
|
}
|