Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Scala 3 support #242

Merged
merged 3 commits into from
Jun 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ThisBuild / scalaVersion := "2.12.12"
ThisBuild / scalaVersion := "2.12.15"
ThisBuild / organization := "com.alejandrohdezma"
ThisBuild / pluginCrossBuild / sbtVersion := "1.2.8"

addCommandAlias("ci-test", "fix --check; mdoc; +test; scripted")
addCommandAlias("ci-test", "scalafmtCheckAll; scalafmtSbtCheck; mdoc; +test; +publishLocal; scripted")
addCommandAlias("ci-docs", "github; mdoc; headerCreateAll")
addCommandAlias("ci-publish", "github; ci-release")

Expand All @@ -11,24 +11,21 @@ val `sbt-mdoc` = "org.scalameta" % "sbt-mdoc" % "[2.0,)" % Provided // scala-ste

val mdoc = "org.scalameta" %% "mdoc" % "[2.0,)" % Provided // scala-steward:off

skip in publish := true

lazy val `documentation` = project
.enablePlugins(MdocPlugin)
.dependsOn(`mdoc-toc-generator`)
.settings(skip in publish := true)
.settings(mdocOut := file("."))

lazy val `sbt-mdoc-toc` = project
lazy val `sbt-mdoc-toc` = module
.enablePlugins(SbtPlugin)
.dependsOn(`mdoc-toc-generator`)
.settings(publishLocal := publishLocal.dependsOn(`mdoc-toc-generator` / publishLocal).value)
.settings(scriptedLaunchOpts += s"-Dplugin.version=${version.value}")
.settings(addSbtPlugin(`sbt-mdoc`))

lazy val `mdoc-toc-generator` = project
lazy val `mdoc-toc-generator` = module
.enablePlugins(BuildInfoPlugin)
.settings(crossScalaVersions := Seq("2.12.12", "2.13.8"))
.settings(crossScalaVersions := Seq("2.12.15", "2.13.8", "3.1.2"))
.settings(buildInfoPackage := "com.alejandrohdezma.mdoc.toc.generator")
.settings(libraryDependencies += mdoc)
.settings(libraryDependencies += "org.specs2" %% "specs2-core" % "4.15.0" % Test)
.settings(libraryDependencies += "org.scalameta" %% "munit" % "0.7.29" % Test)
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@

package com.alejandrohdezma.mdoc.toc.generator

import org.specs2.mutable.Specification
class TableOfContentsModifierSuite extends munit.FunSuite {

class TableOfContentsModifierSpec extends Specification {

"Generates table of contents for markdown file" >> {
test("Generates table of contents for markdown file") {
val markdown =
"""# The title
|
Expand Down Expand Up @@ -63,7 +61,7 @@ class TableOfContentsModifierSpec extends Specification {
| - [5.1.1](#511)
|""".stripMargin

(toc must be).equalTo(expected)
assertEquals(toc, expected)
}

}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ThisBuild / scalaVersion := "2.12.12"
ThisBuild / scalaVersion := "2.12.15"

lazy val root = project.in(file(".")).enablePlugins(MdocPlugin)
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.1.3")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.2")
addSbtPlugin("com.alejandrohdezma" % "sbt-mdoc-toc" % sys.props("plugin.version"))
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# The title

Miau miau

---

- [Installation](#installation)
- [Configuration](#configuration)
- [Configurating the first thing](#configurating-the-first-thing)
- [Configurating the second thing](#configurating-the-second-thing)
- [Integrations](#integrations)
- [Integration one](#integration-one)
- [Integration two](#integration-two)
- [`the-thing.txt`](#the-thingtxt)
- [How does it work?](#how-does-it-work)
- [Example](#example)

## Installation

Miau miau miau

## Configuration

Miau miau miau

### Configurating the first thing

Miau miau miau

### Configurating the second thing

Miau miau miau

## Integrations

Miau miau miau

### Integration one

Miau miau miau

### Integration two

Miau miau miau

### [`the-thing.txt`](https://www.example.com)

Testing that a link in header is normalized

#### How does it work?

Miau miau miau

#### Example

Miau miau miau
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ThisBuild / scalaVersion := "2.13.8"

lazy val root = project.in(file(".")).enablePlugins(MdocPlugin)
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# The title

Miau miau

```scala mdoc:toc

```

## Installation

Miau miau miau

## Configuration

Miau miau miau

### Configurating the first thing

Miau miau miau

### Configurating the second thing

Miau miau miau

## Integrations

Miau miau miau

### Integration one

Miau miau miau

### Integration two

Miau miau miau

### [`the-thing.txt`](https://www.example.com)

Testing that a link in header is normalized

#### How does it work?

Miau miau miau

#### Example

Miau miau miau
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sbt.version=1.6.2
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.2")
addSbtPlugin("com.alejandrohdezma" % "sbt-mdoc-toc" % sys.props("plugin.version"))
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# this test ensures `sbt-mdoc-toc` can create a table-of-contents
> mdoc
$ must-mirror target/mdoc/DOCS.md DOCS.md
56 changes: 56 additions & 0 deletions modules/sbt-mdoc-toc/src/sbt-test/sbt-mdoc-toc/simple_3/DOCS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# The title

Miau miau

---

- [Installation](#installation)
- [Configuration](#configuration)
- [Configurating the first thing](#configurating-the-first-thing)
- [Configurating the second thing](#configurating-the-second-thing)
- [Integrations](#integrations)
- [Integration one](#integration-one)
- [Integration two](#integration-two)
- [`the-thing.txt`](#the-thingtxt)
- [How does it work?](#how-does-it-work)
- [Example](#example)

## Installation

Miau miau miau

## Configuration

Miau miau miau

### Configurating the first thing

Miau miau miau

### Configurating the second thing

Miau miau miau

## Integrations

Miau miau miau

### Integration one

Miau miau miau

### Integration two

Miau miau miau

### [`the-thing.txt`](https://www.example.com)

Testing that a link in header is normalized

#### How does it work?

Miau miau miau

#### Example

Miau miau miau
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ThisBuild / scalaVersion := "3.1.2"

lazy val root = project.in(file(".")).enablePlugins(MdocPlugin)
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# The title

Miau miau

```scala mdoc:toc

```

## Installation

Miau miau miau

## Configuration

Miau miau miau

### Configurating the first thing

Miau miau miau

### Configurating the second thing

Miau miau miau

## Integrations

Miau miau miau

### Integration one

Miau miau miau

### Integration two

Miau miau miau

### [`the-thing.txt`](https://www.example.com)

Testing that a link in header is normalized

#### How does it work?

Miau miau miau

#### Example

Miau miau miau
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sbt.version=1.6.2
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.2")
addSbtPlugin("com.alejandrohdezma" % "sbt-mdoc-toc" % sys.props("plugin.version"))
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# this test ensures `sbt-mdoc-toc` can create a table-of-contents
> mdoc
$ must-mirror target/mdoc/DOCS.md DOCS.md
30 changes: 16 additions & 14 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.10.0")
addSbtPlugin("com.alejandrohdezma" % "sbt-fix" % "0.7.0")
addSbtPlugin("com.alejandrohdezma" % "sbt-ci" % "2.4.2")
addSbtPlugin("com.alejandrohdezma" % "sbt-github-header" % "0.11.2")
addSbtPlugin("com.alejandrohdezma" % "sbt-github-mdoc" % "0.11.2")
addSbtPlugin("com.alejandrohdezma" % "sbt-remove-test-from-pom" % "0.1.0")
addSbtPlugin("com.alejandrohdezma" % "sbt-scalafix-defaults" % "0.6.0")
addSbtPlugin("com.alejandrohdezma" % "sbt-scalafmt-defaults" % "0.6.0")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.7.0")
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.3.3")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.2")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.10.0")
addSbtPlugin("com.alejandrohdezma" % "sbt-fix" % "0.7.0")
addSbtPlugin("com.alejandrohdezma" % "sbt-ci" % "2.4.2")
addSbtPlugin("com.alejandrohdezma" % "sbt-github-header" % "0.11.2")
addSbtPlugin("com.alejandrohdezma" % "sbt-github-mdoc" % "0.11.2")
addSbtPlugin("com.alejandrohdezma" % "sbt-modules" % "0.2.0")
addSbtPlugin("com.alejandrohdezma" % "sbt-remove-test-from-pom" % "0.1.0")
// TODO: Disabled until a new version of `sbt-scalafix-defaults` is released
// addSbtPlugin("com.alejandrohdezma" % "sbt-scalafix-defaults" % "0.6.0")
addSbtPlugin("com.alejandrohdezma" % "sbt-scalafmt-defaults" % "0.6.0")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.7.0")
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.3.3")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.2")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")