From 33e4f2b35e27cbc699e7bb929dc510e471f2a08e Mon Sep 17 00:00:00 2001 From: pschord Date: Mon, 21 Oct 2019 16:29:36 -0400 Subject: [PATCH] SBT: add support for unified docs (#284) Unified documentation can be generated with the sbt unidoc command. --- README.md | 7 ++++++- build.sbt | 15 +++++++++++++++ project/plugins.sbt | 2 ++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 719c1855..f4b4e1d5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# PlanetSide Login Server [![Build Status](https://travis-ci.org/psforever/PSF-LoginServer.svg?branch=master)](https://travis-ci.org/psforever/PSF-LoginServer) [![Code coverage](https://codecov.io/gh/psforever/PSF-LoginServer/coverage.svg?branch=master)](https://codecov.io/gh/psforever/PSF-LoginServer/) +# PlanetSide Login Server [![Build Status](https://travis-ci.org/psforever/PSF-LoginServer.svg?branch=master)](https://travis-ci.org/psforever/PSF-LoginServer) [![Code coverage](https://codecov.io/gh/psforever/PSF-LoginServer/coverage.svg?branch=master)](https://codecov.io/gh/psforever/PSF-LoginServer/) [![Documentation](https://img.shields.io/badge/documentation-master-lightgrey)](https://psforever.github.io/docs/master/index.html) This project contains the code to run and manage the login and world server roles for PlanetSide 1. The login server and world server are currently combined for ease of contributing. @@ -53,6 +53,11 @@ sbt pslogin/run ``` This will clone the repository and SBT will compile and run the login server. Note: SBT is quite slow at starting up. It's recommended you have an open SBT console in order to avoid this startup time. +### Generating Documentation +Using SBT, you can generate documentation for both the common and pslogin projects using `sbt unidoc`. + +Current documentation is available at [https://psforever.github.io/docs/master/index.html](https://psforever.github.io/docs/master/index.html) + ## Running the Server To run a headless, non-interactive server, run diff --git a/build.sbt b/build.sbt index 19a934fd..32d9fe34 100644 --- a/build.sbt +++ b/build.sbt @@ -3,6 +3,20 @@ lazy val commonSettings = Seq( version := "1.0.2-SNAPSHOT", scalaVersion := "2.11.8", scalacOptions := Seq("-unchecked", "-feature", "-deprecation", "-encoding", "utf8", "-language:postfixOps"), + // scaladoc flags: https://github.com/scala/scala/blob/2.11.x/src/scaladoc/scala/tools/nsc/doc/Settings.scala + // Trick taken from https://groups.google.com/d/msg/scala-user/mxV9ok7J_Eg/kt-LnsrD0bkJ + scalacOptions in (Compile,doc) <<= baseDirectory map { + bd => Seq( + "-groups", + "-implicits", + "-doc-title", "PSF-LoginServer - ", + "-doc-version", "master", + "-doc-footer", "Copyright PSForever", + // For non unidoc builds, you may need bd.getName before the template parameter + "-doc-source-url", "https://github.com/psforever/PSF-LoginServer/blob/master/€{FILE_PATH}.scala", + "-sourcepath", bd.getAbsolutePath // needed for scaladoc relative source paths + ) + }, resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots", libraryDependencies ++= Seq( "com.typesafe.akka" %% "akka-actor" % "2.4.4", @@ -40,6 +54,7 @@ lazy val psloginPackSettings = packAutoSettings ++ Seq( lazy val root = (project in file(".")). settings(commonSettings: _*). + enablePlugins(ScalaUnidocPlugin). settings(psloginPackSettings: _*). aggregate(pslogin, common) diff --git a/project/plugins.sbt b/project/plugins.sbt index f9d70139..84abecfe 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,3 +2,5 @@ logLevel := Level.Warn addSbtPlugin("org.xerial.sbt" % "sbt-pack" % "0.7.9") addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.3.5") +// https://github.com/sbt/sbt-unidoc +addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.2")