4 changed files with 148 additions and 78 deletions
-
108project/BasicSettings.scala
-
32project/ProjectSettings.scala
-
60project/SettingTemplate.scala
-
26project/SiteSettingsPlugin.scala
@ -0,0 +1,32 @@ |
|||
/** Basic metadata about the project that gets pulled into the build */ |
|||
trait ProjectSettings |
|||
extends SettingTemplate |
|||
with SettingTemplate.ApacheLicensed |
|||
with SettingTemplate.GithubProject { |
|||
override final val buildOrganization = "org.gerweck.scalafx" |
|||
override final val buildOrganizationName = "Sarah Gerweck" |
|||
override final val projectDescription = "Utilities to simplify ScalaFX applications" |
|||
override final val projectStartYear = 2015 |
|||
|
|||
override final val githubOrganization = "sarahgerweck" |
|||
override final val githubProject = "scalafx-utils" |
|||
|
|||
override final val buildScalaVersion = "2.12.3" |
|||
override final val extraScalaVersions = Seq("2.11.11") |
|||
override final val defaultOptimize = true |
|||
override final val defaultOptimizeGlobal = false |
|||
|
|||
override final val sonatypeResolver = true |
|||
|
|||
lazy val developerInfo = { |
|||
<developers> |
|||
<developer> |
|||
<id>sarah</id> |
|||
<name>Sarah Gerweck</name> |
|||
<email>sarah.a180@gmail.com</email> |
|||
<url>https://github.com/sarahgerweck</url> |
|||
<timezone>America/Los_Angeles</timezone> |
|||
</developer> |
|||
</developers> |
|||
} |
|||
} |
@ -0,0 +1,60 @@ |
|||
/* Note: This file is shared among many projects. Avoid putting project-specific things here. */ |
|||
|
|||
import sbt._ |
|||
import sbt.Keys._ |
|||
|
|||
import java.net.URL |
|||
|
|||
trait SettingTemplate { |
|||
val buildOrganization: String |
|||
val buildOrganizationName: String |
|||
val buildOrganizationUrl: Option[URL] = None |
|||
val projectDescription: String |
|||
val projectStartYear: Int |
|||
val projectHomepage: Option[URL] = None |
|||
|
|||
val buildScalaVersion: String |
|||
val extraScalaVersions: Seq[String] |
|||
val minimumJavaVersion: String = "1.8" |
|||
val defaultOptimize: Boolean = true |
|||
val defaultOptimizeGlobal: Boolean = false |
|||
val inlinePatterns: Seq[String] = Seq("!akka.**","!slick.**") |
|||
val autoAddCompileOptions: Boolean = true |
|||
|
|||
val parallelBuild: Boolean = true |
|||
val cachedResolution: Boolean = true |
|||
val sonatypeResolver: Boolean = false |
|||
|
|||
val projectLicenses: Seq[(String, URL)] |
|||
|
|||
val defaultNewBackend: Boolean = false |
|||
|
|||
val developerInfo: scala.xml.Elem |
|||
|
|||
val buildMetadata: Seq[Setting[_]] |
|||
|
|||
def sourceLocation(branch: String): Option[URL] = None |
|||
} |
|||
|
|||
object SettingTemplate { |
|||
trait GithubProject extends SettingTemplate { |
|||
val githubOrganization: String |
|||
val githubProject: String |
|||
|
|||
val githubOrgPageFallback: Boolean = true |
|||
lazy val githubPage = url(s"https://github.com/${githubOrganization}/${githubProject}") |
|||
override def sourceLocation(branch: String) = Some(url(s"${githubPage.toExternalForm}/blob/branch")) |
|||
|
|||
lazy val buildMetadata = Vector( |
|||
licenses := projectLicenses, |
|||
homepage := Some(projectHomepage.getOrElse(githubPage)), |
|||
description := projectDescription, |
|||
startYear := Some(projectStartYear), |
|||
scmInfo := Some(ScmInfo(githubPage, s"scm:git:git@github.com:${githubOrganization}/${githubProject}.git")) |
|||
) |
|||
} |
|||
|
|||
trait ApacheLicensed extends SettingTemplate { |
|||
final val projectLicenses = Seq("Apache License, Version 2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt")) |
|||
} |
|||
} |
@ -0,0 +1,26 @@ |
|||
import sbt._ |
|||
import Keys._ |
|||
|
|||
import com.typesafe.sbt.site._ |
|||
|
|||
object SiteSettingsPlugin extends AutoPlugin { |
|||
override def requires = SiteScaladocPlugin |
|||
|
|||
override lazy val projectSettings = Seq( |
|||
scalacOptions in (Compile,doc) ++= Seq( |
|||
"-groups", |
|||
"-implicits", |
|||
"-diagrams", |
|||
"-sourcepath", (baseDirectory in ThisBuild).value.getAbsolutePath |
|||
), |
|||
scalacOptions in (Compile,doc) ++= ( |
|||
(BasicSettings: SettingTemplate).sourceLocation("master") match { |
|||
case Some(url) => |
|||
val srcUrl = url + "€{FILE_PATH}.scala" |
|||
Seq("-doc-source-url", srcUrl) |
|||
case None => |
|||
Seq.empty |
|||
} |
|||
) |
|||
) |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue