Skip to content

Commit

Permalink
Update sbt plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwei-k committed May 15, 2023
1 parent 261ebcb commit 490419a
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
distribution: temurin
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: coursier/cache-action@d1039466d0812d6370649b9afb02bbf5f646bacf # v6.4.3
- run: rm -rf "$HOME/.sbt/ghpages"
- run: sbt -v test makeSite
- uses: webfactory/ssh-agent@d4b9b8ff72958532804b70bbe600ad43b36d5f2e # v0.8.0
if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}
Expand Down
3 changes: 2 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ lazy val root = (project in file(".")).
val r = GitKeys.gitRunner.value
gitRemoveFiles(repo, (repo * "*.html").get.toList, r, s)
val mappings = for {
(file, target) <- siteMappings.value if siteInclude(file)
(file, target) <- (Pamflet / Keys.mappings).value if siteInclude(file)
} yield (file, repo / target)
assert(mappings.nonEmpty)
IO.copy(mappings)
repo
}
Expand Down
37 changes: 37 additions & 0 deletions project/PamfletPlugin.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import com.typesafe.sbt.site.SitePlugin.autoImport.siteSubdirName
import com.typesafe.sbt.site.SitePlugin
import com.typesafe.sbt.site.util.SiteHelpers
import sbt.Keys._
import sbt._
import pamflet.FileStorage
import pamflet.Produce

object PamfletPlugin extends AutoPlugin {
override def requires = SitePlugin
override def trigger = noTrigger
object autoImport {
val Pamflet = config("pamflet")
}

import autoImport._

override def projectSettings = pamfletSettings(Pamflet)

private def pamfletSettings(config: Configuration): Seq[Setting[_]] =
inConfig(config)(
Def.settings(
includeFilter := AllPassFilter,
mappings := {
val output = target.value
val storage = FileStorage(sourceDirectory.value, Nil)
Produce(storage.globalized, output)
IO.delete(output / "offline")
output ** includeFilter.value --- output pair Path.relativeTo(output)
},
siteSubdirName := "",
SiteHelpers.directorySettings(config),
SiteHelpers.watchSettings(config),
SiteHelpers.addMappingsToSiteDir(config / mappings, config / siteSubdirName),
)
)
}
5 changes: 3 additions & 2 deletions project/site.sbt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.1")
addSbtPlugin("com.github.sbt" % "sbt-ghpages" % "0.7.0")
addSbtPlugin("com.github.sbt" % "sbt-site" % "1.5.0")
addSbtPlugin("com.github.sbt" % "sbt-ghpages" % "0.8.0")
libraryDependencies += "org.foundweekends" %% "pamflet-library" % "0.12.0"

0 comments on commit 490419a

Please sign in to comment.