From e469bdbd6c2e34342d6eed2639f3e76be2a4c6c9 Mon Sep 17 00:00:00 2001 From: Anton Sviridov Date: Mon, 18 Oct 2021 13:44:39 +0100 Subject: [PATCH 1/4] Scala3 -> 3.1.0 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index a1cab14..b0ac8f4 100644 --- a/build.sbt +++ b/build.sbt @@ -19,7 +19,7 @@ val Ver = new { val Scala = new { val `2_12` = "2.12.13" val `2_13` = "2.13.5" - val `3` = "3.0.2" + val `3` = "3.1.0" val only_2 = Seq(`2_12`, `2_13`) val only_2_13 = Seq(`2_13`) From b52de0d672706de53011d60f49370ba021afeb27 Mon Sep 17 00:00:00 2001 From: Anton Sviridov Date: Tue, 19 Oct 2021 14:40:30 +0100 Subject: [PATCH 2/4] Change scala version in workflow --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 464819d..20547af 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,10 +15,10 @@ jobs: os: [ubuntu-latest] # java: [adopt@1.8, adopt@1.11, 17] java: [adopt@1.8] - scalaVersion: ["2_12", "2_13", "3_0"] + scalaVersion: ["2_12", "2_13", "3_1"] scalaPlatform: ["jvm", "js", "native"] exclude: - - scalaVersion: "3_0" + - scalaVersion: "3_1" scalaPlatform: "native" runs-on: ${{ matrix.os }} env: From 4845b0db863ef70e26d6a31c18ea17145fa7d8e3 Mon Sep 17 00:00:00 2001 From: Anton Sviridov Date: Tue, 30 Nov 2021 20:30:44 +0000 Subject: [PATCH 3/4] Upgrade mdoc! --- .scalafmt.conf | 4 +- modules/core/src/main/scala/mdoc/Mdoc.scala | 2 +- .../core/src/test/scala/MdocBatchTests.scala | 133 ------------------ 3 files changed, 4 insertions(+), 135 deletions(-) delete mode 100644 modules/core/src/test/scala/MdocBatchTests.scala diff --git a/.scalafmt.conf b/.scalafmt.conf index c948438..bd6d782 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,4 +1,6 @@ -version = "3.0.6" +version = "3.2.0" + +runner.dialect = scala213source3 align.preset = "more" diff --git a/modules/core/src/main/scala/mdoc/Mdoc.scala b/modules/core/src/main/scala/mdoc/Mdoc.scala index fd3f602..2cd753e 100644 --- a/modules/core/src/main/scala/mdoc/Mdoc.scala +++ b/modules/core/src/main/scala/mdoc/Mdoc.scala @@ -63,7 +63,7 @@ object MdocConfiguration { MdocConfiguration( scalaBinaryVersion = BuildInfo.scalaBinaryVersion, scalaVersion = BuildInfo.scalaVersion, - mdocVersion = "2.2.23", + mdocVersion = "2.2.24", inheritClasspath = true, inheritVariables = true, variables = Map.empty, diff --git a/modules/core/src/test/scala/MdocBatchTests.scala b/modules/core/src/test/scala/MdocBatchTests.scala deleted file mode 100644 index bc338af..0000000 --- a/modules/core/src/test/scala/MdocBatchTests.scala +++ /dev/null @@ -1,133 +0,0 @@ -package subatomic - -import weaver._ -import cats.effect.IO - -import cats.effect.Blocker -import cats.effect.Resource - -object MdocBatchTests extends IOSuite { - override type Res = Processor - override def sharedResource: Resource[IO, Res] = Blocker[IO].map(new Processor(_)) - - override def maxParallelism: Int = sys.env.get("CI").map(_ => 1).getOrElse(100) - - val HelloWorldPath = SiteRoot / "hello" / "world" - - class Processor( - val blocker: Blocker - ) { - - def process( - content: String, - dependencies: Set[String] = Set.empty, - variables: Map[String, String] = Map.empty, - log: Log[IO] - )( - result: String => Expectations - ): IO[Expectations] = { - val logger = new Logger(s => log.info(s.replace("\n", " ")).unsafeRunSync()) - - val config = MdocConfiguration.default.copy(extraDependencies = dependencies, variables = variables) - - val mdoc = - new Mdoc(logger, config) - - val tmpFile = os.temp(content, suffix = ".md") - - blocker.blockOn(IO(mdoc.process(tmpFile))).map { p => - result(os.read(p)) - } - } - - def block[A](a: => A) = blocker.blockOn(IO(a)) - } - - // test("prepared Mdoc invoked only once") { (res, log) => - // val content = - // """ - // |hello! - // | - // |```scala mdoc - // |println("tut") - // |```""".stripMargin - - // for { - // logs <- Ref.of[IO, Chain[String]](Chain.empty[String]) - - // logger = new Logger(s => effectCompat.sync(logs.update(_ ++ Chain(s)) *> log.info(s.replace("\n", " ")))) - // mdoc = new Mdoc(logger = logger) - - // tmpContent = List.fill(10)(os.temp(content, suffix = ".md")) - - // prepared = mdoc.prepare(tmpContent.map { path => - // path -> MdocFile(path, MdocConfiguration.default) - // }) - - // firstRetrieved <- res.block(prepared.get(tmpContent.head)).map(os.read) - - // allRetrieved <- tmpContent.parTraverse(path => IO(os.read(prepared.get(path)))).map(_.distinct) - // results <- logs.get - // } yield expect(results.exists(_.contains("Compiling 10 files to"))) and - // expect(results.toList.count(_.contains("Compiling")) == 1) and - // expect(allRetrieved == List(firstRetrieved)) - // } - - // test("prepared Mdoc invoked only once per dependency set") { (res, log) => - // val content1 = - // """ - // |hello! - // | - // |```scala mdoc - // |println("tut") - // |```""".stripMargin - - // val content2 = - // """ - // |hello! - // | - // |```scala mdoc - // |cats.effect.IO(println("tut")).unsafeRunSync() - // |```""".stripMargin - - // val zeroDepContent = List.fill(5)(os.temp(content1, suffix = ".zero-dep.md")) - // val ceDepContent = List.fill(5)(os.temp(content2, suffix = "cats-effect..md")) - - // val preparedZeroDep = zeroDepContent.map { path => - // path -> MdocFile(path, MdocConfiguration.default) - // } - - // val preparedCEDep = ceDepContent.map { path => - // path -> MdocFile( - // path, - // MdocConfiguration.default.copy(extraDependencies = Set("org.typelevel::cats-effect:2.3.0")) - // ) - // } - - // for { - // logs <- Ref.of[IO, Chain[String]](Chain.empty[String]) - - // logger = new Logger(s => effectCompat.sync(logs.update(_ ++ Chain(s)) *> log.info(s.replace("\n", " ")))) - // mdoc = new Mdoc(logger = logger) - - // prepared = mdoc.prepare(preparedZeroDep ++ preparedCEDep) - - // resultFirst <- ( - // res.block(prepared.get(zeroDepContent.head)).map(os.read), - // res.block(prepared.get(ceDepContent.head)).map(os.read) - // ).parTupled - - // firstRetrievedZeroDep = resultFirst._1 - // firstRetrievedCEDep = resultFirst._2 - - // allRetrievedZeroDep <- zeroDepContent.parTraverse(path => res.block(os.read(prepared.get(path)))).map(_.distinct) - // allRetrievedCEDep <- ceDepContent.parTraverse(path => res.block(os.read(prepared.get(path)))).map(_.distinct) - - // results <- logs.get.map(_.toList) - // } yield expect(results.count(_.contains("Compiling 5 files to")) == 2) and - // expect(results.count(_.contains("Compiling")) == 2) and - // expect(allRetrievedZeroDep == List(firstRetrievedZeroDep)) and - // expect(allRetrievedCEDep == List(firstRetrievedCEDep)) - // } - -} From 256215d2673cc5f2cba28bad8b1ee245faeaa8ee Mon Sep 17 00:00:00 2001 From: Anton Sviridov Date: Tue, 30 Nov 2021 21:06:41 +0000 Subject: [PATCH 4/4] What an unending clusterduck this is --- build.sbt | 2 +- modules/builders/src/main/scala/MdocConfig.scala | 2 +- modules/core/src/main/scala/Logger.scala | 2 +- modules/core/src/main/scala/mdoc/Mdoc.scala | 2 +- modules/core/src/main/scala/mdoc/MdocJS.scala | 10 ++++------ modules/core/src/main/scala/mdoc/MdocJSProcessor.scala | 1 - .../search/indexer/src/test/scala/IndexerTests.scala | 2 +- project/plugins.sbt | 8 ++++---- 8 files changed, 13 insertions(+), 16 deletions(-) diff --git a/build.sbt b/build.sbt index cb0e368..e8a1199 100644 --- a/build.sbt +++ b/build.sbt @@ -18,7 +18,7 @@ val Ver = new { val Scala = new { val `2_12` = "2.12.15" - val `2_13` = "2.13.6" + val `2_13` = "2.13.7" val `3` = "3.1.0" val only_2 = Seq(`2_12`, `2_13`) diff --git a/modules/builders/src/main/scala/MdocConfig.scala b/modules/builders/src/main/scala/MdocConfig.scala index c6888f4..96079d4 100644 --- a/modules/builders/src/main/scala/MdocConfig.scala +++ b/modules/builders/src/main/scala/MdocConfig.scala @@ -40,7 +40,7 @@ object MdocJSConfig { val enabled = attrs.optionalOne("scala-mdoc-js").getOrElse("false").toBoolean val dependencies = attrs.optionalOne("scala-mdoc-js-dependencies").map(_.split(",").toList).getOrElse(Nil) - val scalaJSVersion = attrs.optionalOne("scala-mdoc-js-version").getOrElse("1.1.0") + val scalaJSVersion = attrs.optionalOne("scala-mdoc-js-version").getOrElse("1.7.1") if (enabled) Some(MdocJSConfig(dependencies, scalaJSVersion)) else None } diff --git a/modules/core/src/main/scala/Logger.scala b/modules/core/src/main/scala/Logger.scala index 0751ead..37c45f5 100644 --- a/modules/core/src/main/scala/Logger.scala +++ b/modules/core/src/main/scala/Logger.scala @@ -45,7 +45,7 @@ trait Colors { import Console._ private lazy val colors = true - //System.console() != null && System.getenv().get("TERM") != null + // System.console() != null && System.getenv().get("TERM") != null def _blue(s: String) = if (!colors) s else CYAN + s + RESET def _red(s: String) = if (!colors) s else RED + s + RESET diff --git a/modules/core/src/main/scala/mdoc/Mdoc.scala b/modules/core/src/main/scala/mdoc/Mdoc.scala index 2cd753e..3872f87 100644 --- a/modules/core/src/main/scala/mdoc/Mdoc.scala +++ b/modules/core/src/main/scala/mdoc/Mdoc.scala @@ -35,7 +35,7 @@ case class ScalaJSConfig( ) object ScalaJSConfig { - def default = ScalaJSConfig(version = "1.5.0", "1.0.0") + def default = ScalaJSConfig(version = "1.7.1", "1.0.0") def fromAttrs(attrs: Discover.YamlAttributes): Option[ScalaJSConfig] = { val enabled = attrs.optionalOne("mdoc-js").map(_.toBoolean).getOrElse(false) diff --git a/modules/core/src/main/scala/mdoc/MdocJS.scala b/modules/core/src/main/scala/mdoc/MdocJS.scala index 6431298..8569a84 100644 --- a/modules/core/src/main/scala/mdoc/MdocJS.scala +++ b/modules/core/src/main/scala/mdoc/MdocJS.scala @@ -157,7 +157,7 @@ class MdocJS( files: Seq[os.Path] ): Seq[(os.Path, ScalaJSResult)] = { val dependencies = config.extraDependencies - val tempDir = os.temp.dir() + val tempDir = os.temp.dir(deleteOnExit = false) val opts = Classpath.Path(optsFolder(dependencies)) val logger = logging.at("MDOC.JS") @@ -182,13 +182,11 @@ class MdocJS( "java", "-classpath", (runnerCp.cp + opts).render(config), - "mdoc.Main" - // "--classpath", - // fetchCp(dependencies) + "mdoc.Main", + "--classpath", + fetchCp(dependencies) ) ++ argmap - // command.foreach(println) - os.proc(command) .call( _pwd, diff --git a/modules/core/src/main/scala/mdoc/MdocJSProcessor.scala b/modules/core/src/main/scala/mdoc/MdocJSProcessor.scala index ff11745..d39d72a 100644 --- a/modules/core/src/main/scala/mdoc/MdocJSProcessor.scala +++ b/modules/core/src/main/scala/mdoc/MdocJSProcessor.scala @@ -50,7 +50,6 @@ class MdocJSProcessor[C] private (pwd: os.Path, toMdocFile: PartialFunction[C, M override def retrieve(content: C): MdocJSResult[C] = { val triggerKey = internalTriggers(content) - println(triggerKey) if (!internalResults.contains(triggerKey)) { val filesToProcess = internalFiles(triggerKey) diff --git a/modules/search/indexer/src/test/scala/IndexerTests.scala b/modules/search/indexer/src/test/scala/IndexerTests.scala index 96a4e37..e82caf6 100644 --- a/modules/search/indexer/src/test/scala/IndexerTests.scala +++ b/modules/search/indexer/src/test/scala/IndexerTests.scala @@ -14,7 +14,7 @@ class IndexerSuite extends munit.FunSuite { ) val idx = - Indexer.default(content).processAll { case (path, sections) => //Document.section(s"Document at $path", path, text) + Indexer.default(content).processAll { case (path, sections) => // Document.section(s"Document at $path", path, text) Document( s"Document at $path", diff --git a/project/plugins.sbt b/project/plugins.sbt index a5d61cf..34d3906 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -7,13 +7,13 @@ resolvers += Resolver.sonatypeRepo("snapshots") addSbtPlugin("com.github.cb372" % "sbt-explicit-dependencies" % "0.2.16") -addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.3") +addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.4") addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.5") -addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.31") +addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.33") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0") -addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.7.0") +addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.9.0") addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.7.0") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.7.1") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.1") addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.8.0") addSbtPlugin("com.indoorvivants" % "sbt-commandmatrix" % "0.0.4+2-6d7e7dcf-SNAPSHOT")