Skip to content

Commit

Permalink
use new slash syntax instead of deprecated in
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwei-k committed Oct 12, 2024
1 parent 1334d59 commit 9173fc3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions mdoc-sbt/src/main/scala/mdoc/DocusaurusPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ object DocusaurusPlugin extends AutoPlugin {
import autoImport._
def website: Def.Initialize[File] =
Def.setting {
baseDirectory.in(ThisBuild).value / "website"
(ThisBuild / baseDirectory).value / "website"
}

def listJarFiles(root: Path): List[(File, String)] = {
Expand Down Expand Up @@ -95,8 +95,8 @@ object DocusaurusPlugin extends AutoPlugin {

override def projectSettings: Seq[Def.Setting[_]] =
List(
aggregate.in(docusaurusPublishGhpages) := false,
aggregate.in(docusaurusCreateSite) := false,
(docusaurusPublishGhpages / aggregate) := false,
(docusaurusCreateSite / aggregate) := false,
docusaurusProjectName := moduleName.value.stripSuffix("-docs"),
MdocPlugin.mdocInternalVariables ++= List(
"js-out-prefix" -> "assets"
Expand Down Expand Up @@ -146,7 +146,7 @@ object DocusaurusPlugin extends AutoPlugin {
Relativize.htmlSite(out.toPath)
out
},
packageDoc.in(Compile) := {
(Compile / packageDoc) := {
val directory = doc.value
val jar = target.value / "docusaurus.jar"
val files = listJarFiles(directory.toPath)
Expand Down
24 changes: 12 additions & 12 deletions mdoc-sbt/src/main/scala/mdoc/MdocPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ object MdocPlugin extends AutoPlugin {

override def projectSettings: Seq[Def.Setting[_]] =
List(
mdocIn := baseDirectory.in(ThisBuild).value / "docs",
mdocOut := target.in(Compile).value / "mdoc",
mdocIn := (ThisBuild / baseDirectory).value / "docs",
mdocOut := (Compile / target).value / "mdoc",
mdocVariables := Map.empty,
mdocExtraArguments := Nil,
mdocJS := None,
Expand All @@ -96,7 +96,7 @@ object MdocPlugin extends AutoPlugin {
parsed
).flatten.mkString(" ")
Def.taskDyn {
runMain.in(Compile).toTask(s" mdoc.SbtMain $args")
(Compile / runMain).toTask(s" mdoc.SbtMain $args")
}
}.evaluated,
dependencyOverrides ++= List(
Expand All @@ -114,9 +114,9 @@ object MdocPlugin extends AutoPlugin {
List()
}
},
resourceGenerators.in(Compile) += Def.task {
(Compile / resourceGenerators) += Def.task {
val out =
managedResourceDirectories.in(Compile).value.head / "mdoc.properties"
(Compile / managedResourceDirectories).value.head / "mdoc.properties"
val props = new java.util.Properties()
mdocVariables.value.foreach { case (key, value) =>
props.put(key, value)
Expand All @@ -126,9 +126,9 @@ object MdocPlugin extends AutoPlugin {
}
def getJars(mid: ModuleID) = {

val depRes = dependencyResolution.in(update).value
val updc = updateConfiguration.in(update).value
val uwconfig = unresolvedWarningConfiguration.in(update).value
val depRes = (update / dependencyResolution).value
val updc = (update / updateConfiguration).value
val uwconfig = (update / unresolvedWarningConfiguration).value
val modDescr = depRes.wrapDependencyInModule(mid)

depRes
Expand Down Expand Up @@ -190,21 +190,21 @@ object MdocPlugin extends AutoPlugin {
props.put("out", mdocOut.value.toString)
props.put(
"scalacOptions",
scalacOptions.in(Compile).value.mkString(" ")
(Compile / scalacOptions).value.mkString(" ")
)
val classpath = ListBuffer.empty[File]
// Can't use fullClasspath.value because it introduces cyclic dependency between
// compilation and resource generation.
classpath ++= dependencyClasspath.in(Compile).value.iterator.map(_.data)
classpath += classDirectory.in(Compile).value
classpath ++= (Compile / dependencyClasspath).value.iterator.map(_.data)
classpath += (Compile / classDirectory).value
props.put(
"classpath",
classpath.mkString(java.io.File.pathSeparator)
)
IO.write(props, "mdoc properties", out)
val esVersion = props.clone().asInstanceOf[java.util.Properties]
esVersion.put("js-module-kind", "ESModule")
val esOut = managedResourceDirectories.in(Compile).value.head / "es.properties"
val esOut = (Compile / managedResourceDirectories).value.head / "es.properties"
IO.write(
esVersion,
"mdoc esmoddule properties",
Expand Down

0 comments on commit 9173fc3

Please sign in to comment.