diff --git a/plugin/src/sbt-test/paradox/latest-paradox-deps/build.sbt b/plugin/src/sbt-test/paradox/latest-paradox-deps/build.sbt new file mode 100644 index 0000000..55c4da8 --- /dev/null +++ b/plugin/src/sbt-test/paradox/latest-paradox-deps/build.sbt @@ -0,0 +1,45 @@ +name := "test" + +//#enable-plugin +enablePlugins(ParadoxMaterialThemePlugin) +//#enable-plugin + +Compile / paradoxProperties ++= Map( + "github.base_url" -> "https://github.com/sbt/sbt-paradox-material-theme" +) + +Compile / paradoxMaterialTheme ~= { + _.withCopyright("test-copyright") + .withLogo("test-logo") + .withFavicon("test-favicon") +} + +def fileContains(file: File, texts: String*) = { + assert(file.exists, s"${file.getAbsolutePath} did not exist") + val content = IO.readLines(file) + for (text <- texts) + assert( + content.exists(_.contains(text)), + s"Did not find '$text' in ${file.getName}:\n${content.mkString("\n")}" + ) +} + +TaskKey[Unit]("checkContent") := { + val dest = (Compile / paradox / target).value + + fileContains( + dest / "index.html", + "Paradox Site", + "Nicely themed", + "mkdocs-material", + "test-copyright", + "test-logo", + "test-favicon" + ) + + fileContains( + dest / "search" / "search_index.json", + "Paradox Site", + "Nicely themed" + ) +} diff --git a/plugin/src/sbt-test/paradox/latest-paradox-deps/project/plugins.sbt b/plugin/src/sbt-test/paradox/latest-paradox-deps/project/plugins.sbt new file mode 100644 index 0000000..6dad501 --- /dev/null +++ b/plugin/src/sbt-test/paradox/latest-paradox-deps/project/plugins.sbt @@ -0,0 +1,8 @@ +addSbtPlugin("com.lightbend.paradox" % "sbt-paradox" % "0.10.6") +addSbtPlugin("com.lightbend.paradox" % "sbt-paradox-theme" % "0.10.6") + +sys.props.get("project.version") match { + case Some(x) => addSbtPlugin("com.github.sbt" % "sbt-paradox-material-theme" % x) + case _ => sys.error("""|The system property 'project.version' is not defined. + |Specify this property using the scriptedLaunchOpts -D.""".stripMargin) +} diff --git a/plugin/src/sbt-test/paradox/latest-paradox-deps/src/main/paradox/index.md b/plugin/src/sbt-test/paradox/latest-paradox-deps/src/main/paradox/index.md new file mode 100644 index 0000000..53f903a --- /dev/null +++ b/plugin/src/sbt-test/paradox/latest-paradox-deps/src/main/paradox/index.md @@ -0,0 +1,3 @@ +# Paradox Site + +Nicely themed. diff --git a/plugin/src/sbt-test/paradox/latest-paradox-deps/test b/plugin/src/sbt-test/paradox/latest-paradox-deps/test new file mode 100644 index 0000000..93f4db2 --- /dev/null +++ b/plugin/src/sbt-test/paradox/latest-paradox-deps/test @@ -0,0 +1,2 @@ +> paradox +> checkContent