From bc1fa260663c8f5783b42efe4bf3d300d9a70e6f Mon Sep 17 00:00:00 2001 From: Matthias Kurz Date: Mon, 12 Feb 2024 12:57:54 +0100 Subject: [PATCH 1/5] Latest sbt-site in scripted test --- plugin/src/sbt-test/sbt-site/can-use-theme/project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/src/sbt-test/sbt-site/can-use-theme/project/plugins.sbt b/plugin/src/sbt-test/sbt-site/can-use-theme/project/plugins.sbt index 8669f49..c4d2550 100644 --- a/plugin/src/sbt-test/sbt-site/can-use-theme/project/plugins.sbt +++ b/plugin/src/sbt-test/sbt-site/can-use-theme/project/plugins.sbt @@ -4,4 +4,4 @@ sys.props.get("project.version") match { |Specify this property using the scriptedLaunchOpts -D.""".stripMargin) } -addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.3.1") +addSbtPlugin("com.github.sbt" % "sbt-site" % "1.5.0") From 1019b968586b7bec649604d4c13f962d72151538 Mon Sep 17 00:00:00 2001 From: Matthias Kurz Date: Mon, 12 Feb 2024 13:03:02 +0100 Subject: [PATCH 2/5] Depend on sbt-site-paradox --- plugin/src/sbt-test/sbt-site/can-use-theme/project/plugins.sbt | 2 +- project/plugins.sbt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/src/sbt-test/sbt-site/can-use-theme/project/plugins.sbt b/plugin/src/sbt-test/sbt-site/can-use-theme/project/plugins.sbt index c4d2550..1e81d9b 100644 --- a/plugin/src/sbt-test/sbt-site/can-use-theme/project/plugins.sbt +++ b/plugin/src/sbt-test/sbt-site/can-use-theme/project/plugins.sbt @@ -4,4 +4,4 @@ sys.props.get("project.version") match { |Specify this property using the scriptedLaunchOpts -D.""".stripMargin) } -addSbtPlugin("com.github.sbt" % "sbt-site" % "1.5.0") +addSbtPlugin("com.github.sbt" % "sbt-site-paradox" % "1.5.0") diff --git a/project/plugins.sbt b/project/plugins.sbt index 6b6275b..63f9fb0 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,6 +1,6 @@ addSbtPlugin("com.lightbend.paradox" % "sbt-paradox" % "0.9.2") addSbtPlugin("com.lightbend.paradox" % "sbt-paradox-theme" % "0.9.2") -addSbtPlugin("com.github.sbt" % "sbt-site" % "1.5.0") +addSbtPlugin("com.github.sbt" % "sbt-site-paradox" % "1.5.0") addSbtPlugin("com.github.sbt" % "sbt-ghpages" % "0.8.0") addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2") From 1778f14d5c0b95816094a8c02c7804ed6020453e Mon Sep 17 00:00:00 2001 From: Matthias Kurz Date: Mon, 12 Feb 2024 15:14:54 +0100 Subject: [PATCH 3/5] Exclude transitive sbt-paradox dependency (which would be newer) --- plugin/src/sbt-test/sbt-site/can-use-theme/project/plugins.sbt | 2 +- project/plugins.sbt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/src/sbt-test/sbt-site/can-use-theme/project/plugins.sbt b/plugin/src/sbt-test/sbt-site/can-use-theme/project/plugins.sbt index 1e81d9b..3e68ee1 100644 --- a/plugin/src/sbt-test/sbt-site/can-use-theme/project/plugins.sbt +++ b/plugin/src/sbt-test/sbt-site/can-use-theme/project/plugins.sbt @@ -4,4 +4,4 @@ sys.props.get("project.version") match { |Specify this property using the scriptedLaunchOpts -D.""".stripMargin) } -addSbtPlugin("com.github.sbt" % "sbt-site-paradox" % "1.5.0") +addSbtPlugin(("com.github.sbt" % "sbt-site-paradox" % "1.5.0").exclude("com.lightbend.paradox", "sbt-paradox")) diff --git a/project/plugins.sbt b/project/plugins.sbt index 63f9fb0..234ce29 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,6 +1,6 @@ addSbtPlugin("com.lightbend.paradox" % "sbt-paradox" % "0.9.2") addSbtPlugin("com.lightbend.paradox" % "sbt-paradox-theme" % "0.9.2") -addSbtPlugin("com.github.sbt" % "sbt-site-paradox" % "1.5.0") +addSbtPlugin(("com.github.sbt" % "sbt-site-paradox" % "1.5.0").exclude("com.lightbend.paradox", "sbt-paradox")) addSbtPlugin("com.github.sbt" % "sbt-ghpages" % "0.8.0") addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2") From 128f663428717cab42be6bf7e83a9b5b69f1c756 Mon Sep 17 00:00:00 2001 From: Matthias Kurz Date: Tue, 13 Feb 2024 11:19:25 +0100 Subject: [PATCH 4/5] Change scope to Compile --- .../theme/ParadoxMaterialThemePlugin.scala | 29 +++++++++---------- .../sbt-test/sbt-site/can-use-theme/build.sbt | 8 ++--- src/main/paradox/getting-started.md | 7 ----- 3 files changed, 15 insertions(+), 29 deletions(-) diff --git a/plugin/src/main/scala/com/github/sbt/paradox/material/theme/ParadoxMaterialThemePlugin.scala b/plugin/src/main/scala/com/github/sbt/paradox/material/theme/ParadoxMaterialThemePlugin.scala index efcca35..9ccfef8 100644 --- a/plugin/src/main/scala/com/github/sbt/paradox/material/theme/ParadoxMaterialThemePlugin.scala +++ b/plugin/src/main/scala/com/github/sbt/paradox/material/theme/ParadoxMaterialThemePlugin.scala @@ -19,7 +19,7 @@ object ParadoxMaterialThemePlugin extends AutoPlugin { override lazy val projectSettings: Seq[Setting[_]] = Def.settings( paradoxMaterialThemeGlobalSettings, - paradoxMaterialThemeSettings(Compile) + paradoxMaterialThemeSettings ) lazy val paradoxMaterialThemeGlobalSettings: Seq[Setting[_]] = Def.settings( @@ -29,20 +29,17 @@ object ParadoxMaterialThemePlugin extends AutoPlugin { paradoxTheme := Some("com.github.sbt" % "paradox-material-theme" % (paradoxMaterialTheme / version).value) ) - def paradoxMaterialThemeSettings(config: Configuration): Seq[Setting[_]] = - inConfig(config)( - Def.settings( - paradoxMaterialTheme := ParadoxMaterialTheme(), - paradoxProperties += ("material.theme.version" -> (paradoxMaterialTheme / version).value), - paradoxProperties ++= paradoxMaterialTheme.value.paradoxProperties, - paradoxMaterialTheme / mappings := Def.taskDyn { - if (paradoxProperties.value.contains("material.search")) - Def.task(Seq(SearchIndex.mapping(config).value)) - else - Def.task(Seq.empty[(File, String)]) - }.value, - paradox / mappings ++= (paradoxMaterialTheme / mappings).value - ) - ) + lazy val paradoxMaterialThemeSettings: Seq[Setting[_]] = Def.settings( + Compile / paradoxMaterialTheme := ParadoxMaterialTheme(), + Compile / paradoxProperties += ("material.theme.version" -> (paradoxMaterialTheme / version).value), + Compile / paradoxProperties ++= (Compile / paradoxMaterialTheme).value.paradoxProperties, + Compile / paradoxMaterialTheme / mappings := Def.taskDyn { + if ((Compile / paradoxProperties).value.contains("material.search")) + Def.task(Seq(SearchIndex.mapping(Compile).value)) + else + Def.task(Seq.empty[(File, String)]) + }.value, + Compile / paradox / mappings ++= (Compile / paradoxMaterialTheme / mappings).value + ) } diff --git a/plugin/src/sbt-test/sbt-site/can-use-theme/build.sbt b/plugin/src/sbt-test/sbt-site/can-use-theme/build.sbt index 3350ba8..8a755ad 100644 --- a/plugin/src/sbt-test/sbt-site/can-use-theme/build.sbt +++ b/plugin/src/sbt-test/sbt-site/can-use-theme/build.sbt @@ -2,15 +2,11 @@ name := "test" enablePlugins(ParadoxSitePlugin, ParadoxMaterialThemePlugin) -//#theme-site-settings -ParadoxMaterialThemePlugin.paradoxMaterialThemeSettings(Paradox) -//#theme-site-settings - -Paradox / paradoxProperties ++= Map( +Compile / paradoxProperties ++= Map( "github.base_url" -> "https://github.com/sbt/sbt-paradox-material-theme" ) -Paradox / paradoxMaterialTheme ~= { +Compile / paradoxMaterialTheme ~= { _.withCopyright("test-copyright") .withLogo("test-logo") .withFavicon("test-favicon") diff --git a/src/main/paradox/getting-started.md b/src/main/paradox/getting-started.md index 32fb3c6..a5222a6 100644 --- a/src/main/paradox/getting-started.md +++ b/src/main/paradox/getting-started.md @@ -13,13 +13,6 @@ And enable the theme plugin in your project's `build.sbt`: @@ snip [build.sbt]($root$/plugin/src/sbt-test/paradox/can-use-theme/build.sbt) { #enable-plugin } -If you are generating your site with [sbt-site] you also need to add a few -additional settings in `build.sbt`: - -@@ snip [build.sbt]($root$/plugin/src/sbt-test/sbt-site/can-use-theme/build.sbt) { #theme-site-settings } - - [sbt-site]: http://www.scala-sbt.org/sbt-site/generators/paradox.html - ## Configuring the theme The theme is configurable via Paradox properties which means that you can From a16acda4b096fd17d10aa0dfeb6f834b5b551ffa Mon Sep 17 00:00:00 2001 From: Matthias Kurz Date: Tue, 13 Feb 2024 11:20:45 +0100 Subject: [PATCH 5/5] "main" subfolder is default now --- .../sbt-site/can-use-theme/src/{ => main}/paradox/index.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename plugin/src/sbt-test/sbt-site/can-use-theme/src/{ => main}/paradox/index.md (100%) diff --git a/plugin/src/sbt-test/sbt-site/can-use-theme/src/paradox/index.md b/plugin/src/sbt-test/sbt-site/can-use-theme/src/main/paradox/index.md similarity index 100% rename from plugin/src/sbt-test/sbt-site/can-use-theme/src/paradox/index.md rename to plugin/src/sbt-test/sbt-site/can-use-theme/src/main/paradox/index.md