Skip to content

Commit

Permalink
Simplify SBT build and fix docs generation (#456)
Browse files Browse the repository at this point in the history
* These settings aren't needed anymore

They're automatically provided by `sbt-github`

* Remove unused method

* This is the new way of preventing module publishing

* Use new `project` macro for creating new projects

This macro will use the `val` name as the expected folder and `moduleName`

* We need to add `mdocIn` for project docs

* Not needed (already provided by `sbt-github-mdoc`)

* The root module is auto-created by SBT, only need to skip publishing

* Launch scalafmtSbt
  • Loading branch information
alejandrohdezma committed Apr 13, 2020
1 parent d048d50 commit 58816e8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 42 deletions.
39 changes: 16 additions & 23 deletions build.sbt
@@ -1,43 +1,36 @@
addCommandAlias("ci-test", "+scalafmtCheck; +scalafmtSbtCheck; +docs/mdoc; +test")
addCommandAlias("ci-docs", "project-docs/mdoc; headerCreateAll")

lazy val root = (project in file("."))
.settings(moduleName := "github4s-root")
.aggregate(github4s)
.dependsOn(github4s)
.settings(noPublishSettings: _*)
skip in publish := true

lazy val github4s =
(project in file("github4s"))
.settings(moduleName := "github4s")
.enablePlugins(BuildInfoPlugin)
.settings(
buildInfoKeys := Seq[BuildInfoKey](
name,
version,
"token" -> sys.env.getOrElse("GITHUB_TOKEN", "")
),
buildInfoPackage := "github4s"
)
.settings(coreDeps: _*)
lazy val github4s = project
.enablePlugins(BuildInfoPlugin)
.settings(
buildInfoKeys := Seq[BuildInfoKey](
name,
version,
"token" -> sys.env.getOrElse("GITHUB_TOKEN", "")
),
buildInfoPackage := "github4s"
)
.settings(coreDeps: _*)

//////////
// DOCS //
//////////

lazy val docs = (project in file("docs"))
lazy val docs = project
.aggregate(github4s)
.dependsOn(github4s)
.settings(moduleName := "github4s-docs")
.settings(micrositeSettings: _*)
.settings(noPublishSettings: _*)
.settings(skip in publish := true)
.enablePlugins(MicrositesPlugin)

lazy val `project-docs` = (project in file(".docs"))
.aggregate(github4s)
.dependsOn(github4s)
.settings(moduleName := "github4s-project-docs")
.settings(mdocVariables += "NAME" -> "github4s")
.settings(mdocIn := file(".docs"))
.settings(mdocOut := file("."))
.settings(noPublishSettings: _*)
.settings(skip in publish := true)
.enablePlugins(MdocPlugin)
19 changes: 0 additions & 19 deletions project/ProjectPlugin.scala
Expand Up @@ -30,13 +30,6 @@ object ProjectPlugin extends AutoPlugin {
val silencer: String = "1.6.0"
}

lazy val noPublishSettings = Seq(
publish := ((): Unit),
publishLocal := ((): Unit),
publishArtifact := false,
publishMavenStyle := false // suppress warnings about intransitive deps (not published anyway)
)

lazy val micrositeSettings = Seq(
micrositeName := "Github4s",
micrositeDescription := "Github API wrapper written in Scala",
Expand Down Expand Up @@ -92,25 +85,13 @@ object ProjectPlugin extends AutoPlugin {
})
)

def toCompileTestList(sequence: Seq[ProjectReference]): List[String] = sequence.toList.map {
p =>
val project: String = p.asInstanceOf[LocalProject].project
s"$project/test"
}
}

import autoImport.V

override def projectSettings: Seq[Def.Setting[_]] =
Seq(
name := "github4s",
organization := "com.47deg",
organizationName := "47 Degrees",
organizationHomepage := Some(url("https://www.47deg.com")),
homepage := Option(url("https://47degrees.github.io/github4s/")),
description := "Github API wrapper written in Scala",
startYear := Option(2016),
resolvers += Resolver.sonatypeRepo("snapshots"),
crossScalaVersions := Seq(V.scala212, V.scala213),
scalacOptions := {
val withStripedLinter = scalacOptions.value filterNot Set("-Xlint", "-Xfuture").contains
Expand Down

0 comments on commit 58816e8

Please sign in to comment.