You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
2.1 KiB

  1. /* Note: This file is shared among many projects. Avoid putting project-specific things here. */
  2. import sbt._
  3. import sbt.Keys._
  4. import java.net.URL
  5. trait SettingTemplate {
  6. val buildOrganization: String
  7. val buildOrganizationName: String
  8. val buildOrganizationUrl: Option[URL] = None
  9. val projectDescription: String
  10. val projectStartYear: Int
  11. val projectHomepage: Option[URL] = None
  12. val buildScalaVersion: String
  13. val extraScalaVersions: Seq[String] = Seq.empty
  14. val minimumJavaVersion: String = "1.8"
  15. val defaultOptimize: Boolean = true
  16. val defaultOptimizeGlobal: Boolean = false
  17. val inlinePatterns: Seq[String] = Seq("!akka.**","!slick.**")
  18. val defaultDisableAssertions: Boolean = false
  19. val defaultWarnUnused: Boolean = false
  20. val defaultWarnImport: Boolean = false
  21. val defaultWarnInline: Boolean = false
  22. val extraScalacOptions: Seq[String] = Seq.empty
  23. val autoAddCompileOptions: Boolean = true
  24. val parallelBuild: Boolean = true
  25. val cachedResolution: Boolean = true
  26. val sonatypeResolver: Boolean = false
  27. val projectLicenses: Seq[(String, URL)]
  28. val defaultNewBackend: Boolean = false
  29. val developerInfo: scala.xml.Elem
  30. val buildMetadata: Seq[Setting[_]]
  31. def sourceLocation(branch: String): Option[URL] = None
  32. }
  33. object SettingTemplate {
  34. trait GithubProject extends SettingTemplate {
  35. val githubOrganization: String
  36. val githubProject: String
  37. val githubOrgPageFallback: Boolean = true
  38. lazy val githubPage = url(s"https://github.com/${githubOrganization}/${githubProject}")
  39. override def sourceLocation(branch: String) = Some(url(s"${githubPage.toExternalForm}/blob/$branch"))
  40. lazy val buildMetadata = Vector(
  41. licenses := projectLicenses,
  42. homepage := Some(projectHomepage.getOrElse(githubPage)),
  43. description := projectDescription,
  44. startYear := Some(projectStartYear),
  45. scmInfo := Some(ScmInfo(githubPage, s"scm:git:git@github.com:${githubOrganization}/${githubProject}.git"))
  46. )
  47. }
  48. trait ApacheLicensed extends SettingTemplate {
  49. final val projectLicenses = Seq("Apache License, Version 2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt"))
  50. }
  51. }