diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 11381aca..c4536357 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -12,8 +12,14 @@ on:
branches: ['**']
push:
branches: ['**']
+ tags: [v*]
env:
+ PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
+ SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
+ SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }}
+ SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
+ PGP_SECRET: ${{ secrets.PGP_SECRET }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
@@ -23,10 +29,10 @@ jobs:
matrix:
os: [ubuntu-latest]
scala: [2.13.8, 2.12.15, 3.1.0]
- java: [adopt@1.11]
- platform: [jvm, js, native]
+ java: [temurin@8]
+ project: [rootJS, rootJVM, rootNative]
exclude:
- - platform: native
+ - project: rootNative
scala: 3.1.0
runs-on: ${{ matrix.os }}
steps:
@@ -35,10 +41,21 @@ jobs:
with:
fetch-depth: 0
- - name: Setup Java and Scala
- uses: olafurpg/setup-scala@v13
+ - name: Download Java (temurin@8)
+ id: download-java-temurin-8
+ if: matrix.java == 'temurin@8'
+ uses: typelevel/download-java@v1
with:
- java-version: ${{ matrix.java }}
+ distribution: temurin
+ java-version: 8
+
+ - name: Setup Java (temurin@8)
+ if: matrix.java == 'temurin@8'
+ uses: actions/setup-java@v2
+ with:
+ distribution: jdkfile
+ java-version: 8
+ jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }}
- name: Cache sbt
uses: actions/cache@v2
@@ -53,49 +70,235 @@ jobs:
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
- name: Check that workflows are up to date
- run: sbt ++${{ matrix.scala }} githubWorkflowCheck
+ run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' 'project /' githubWorkflowCheck
+
+ - name: Check headers and formatting
+ if: matrix.java == 'temurin@8'
+ run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' headerCheckAll scalafmtCheckAll 'project /' scalafmtSbtCheck
+
+ - name: scalaJSLink
+ if: matrix.project == 'rootJS'
+ run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' Test/scalaJSLinkerResult
+
+ - name: nativeLink
+ if: matrix.project == 'rootNative'
+ run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' Test/nativeLink
+
+ - name: Test
+ run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' test
- - name: Validate JavaScript
- if: matrix.platform == 'js'
- run: sbt ++${{ matrix.scala }} js/checkCI
+ - name: Check binary compatibility
+ if: matrix.java == 'temurin@8'
+ run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' mimaReportBinaryIssues
- - name: Validate Native
- if: matrix.platform == 'native'
- run: sbt ++${{ matrix.scala }} native/checkCI
+ - name: Generate API documentation
+ if: matrix.java == 'temurin@8'
+ run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' doc
- - name: Validate JVM
- if: matrix.platform == 'jvm' && matrix.scala != '2.12.15'
- run: sbt ++${{ matrix.scala }} jvm/checkCI
+ - name: Make target directories
+ if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master')
+ run: mkdir -p target cats/native/target .js/target core/.native/target docs/target core/.js/target core/.jvm/target .jvm/target .native/target cats/js/target cats/jvm/target benchmark/target project/target
- - name: Setup Python
- if: matrix.platform == 'jvm' && matrix.scala == '2.12.15'
- uses: actions/setup-python@v2
+ - name: Compress target directories
+ if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master')
+ run: tar cf targets.tar target cats/native/target .js/target core/.native/target docs/target core/.js/target core/.jvm/target .jvm/target .native/target cats/js/target cats/jvm/target benchmark/target project/target
+
+ - name: Upload target directories
+ if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master')
+ uses: actions/upload-artifact@v2
with:
- python-version: 3.x
+ name: target-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}-${{ matrix.project }}
+ path: targets.tar
- - name: Setup codecov
- if: matrix.platform == 'jvm' && matrix.scala == '2.12.15'
- run: pip install codecov
+ publish:
+ name: Publish Artifacts
+ needs: [build]
+ if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master')
+ strategy:
+ matrix:
+ os: [ubuntu-latest]
+ scala: [2.13.8]
+ java: [temurin@8]
+ runs-on: ${{ matrix.os }}
+ steps:
+ - name: Checkout current branch (full)
+ uses: actions/checkout@v2
+ with:
+ fetch-depth: 0
- - name: Validate JVM (scala 2)
- if: matrix.platform == 'jvm' && matrix.scala == '2.12.15'
- run: sbt ++${{ matrix.scala }} coverage jvm/checkCI docs/mdoc coverageReport
+ - name: Download Java (temurin@8)
+ id: download-java-temurin-8
+ if: matrix.java == 'temurin@8'
+ uses: typelevel/download-java@v1
+ with:
+ distribution: temurin
+ java-version: 8
- - name: Upload Codecov Results
- if: matrix.platform == 'jvm' && matrix.scala == '2.12.15'
- run: codecov
+ - name: Setup Java (temurin@8)
+ if: matrix.java == 'temurin@8'
+ uses: actions/setup-java@v2
+ with:
+ distribution: jdkfile
+ java-version: 8
+ jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }}
- - name: Binary compatibility ${{ matrix.scala }}
- if: matrix.platform == 'jvm' && matrix.scala == '2.12.15'
- run: sbt ++${{ matrix.scala }} mimaReportBinaryIssues
+ - name: Cache sbt
+ uses: actions/cache@v2
+ with:
+ path: |
+ ~/.sbt
+ ~/.ivy2/cache
+ ~/.coursier/cache/v1
+ ~/.cache/coursier/v1
+ ~/AppData/Local/Coursier/Cache/v1
+ ~/Library/Caches/Coursier/v1
+ key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
+
+ - name: Download target directories (2.13.8, rootJS)
+ uses: actions/download-artifact@v2
+ with:
+ name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.8-rootJS
+
+ - name: Inflate target directories (2.13.8, rootJS)
+ run: |
+ tar xf targets.tar
+ rm targets.tar
+
+ - name: Download target directories (2.13.8, rootJVM)
+ uses: actions/download-artifact@v2
+ with:
+ name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.8-rootJVM
+
+ - name: Inflate target directories (2.13.8, rootJVM)
+ run: |
+ tar xf targets.tar
+ rm targets.tar
+
+ - name: Download target directories (2.13.8, rootNative)
+ uses: actions/download-artifact@v2
+ with:
+ name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.8-rootNative
+
+ - name: Inflate target directories (2.13.8, rootNative)
+ run: |
+ tar xf targets.tar
+ rm targets.tar
+
+ - name: Download target directories (2.12.15, rootJS)
+ uses: actions/download-artifact@v2
+ with:
+ name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.15-rootJS
+
+ - name: Inflate target directories (2.12.15, rootJS)
+ run: |
+ tar xf targets.tar
+ rm targets.tar
+
+ - name: Download target directories (2.12.15, rootJVM)
+ uses: actions/download-artifact@v2
+ with:
+ name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.15-rootJVM
- checks:
- name: Format Scala code
+ - name: Inflate target directories (2.12.15, rootJVM)
+ run: |
+ tar xf targets.tar
+ rm targets.tar
+
+ - name: Download target directories (2.12.15, rootNative)
+ uses: actions/download-artifact@v2
+ with:
+ name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.15-rootNative
+
+ - name: Inflate target directories (2.12.15, rootNative)
+ run: |
+ tar xf targets.tar
+ rm targets.tar
+
+ - name: Download target directories (3.1.0, rootJS)
+ uses: actions/download-artifact@v2
+ with:
+ name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.0-rootJS
+
+ - name: Inflate target directories (3.1.0, rootJS)
+ run: |
+ tar xf targets.tar
+ rm targets.tar
+
+ - name: Download target directories (3.1.0, rootJVM)
+ uses: actions/download-artifact@v2
+ with:
+ name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.0-rootJVM
+
+ - name: Inflate target directories (3.1.0, rootJVM)
+ run: |
+ tar xf targets.tar
+ rm targets.tar
+
+ - name: Import signing key
+ if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == ''
+ run: echo $PGP_SECRET | base64 -di | gpg --import
+
+ - name: Import signing key and strip passphrase
+ if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE != ''
+ run: |
+ echo "$PGP_SECRET" | base64 -di > /tmp/signing-key.gpg
+ echo "$PGP_PASSPHRASE" | gpg --pinentry-mode loopback --passphrase-fd 0 --import /tmp/signing-key.gpg
+ (echo "$PGP_PASSPHRASE"; echo; echo) | gpg --command-fd 0 --pinentry-mode loopback --change-passphrase $(gpg --list-secret-keys --with-colons 2> /dev/null | grep '^sec:' | cut --delimiter ':' --fields 5 | tail -n 1)
+
+ - name: Publish
+ run: sbt '++${{ matrix.scala }}' tlRelease
+
+ coverage:
+ name: Generate coverage report
strategy:
matrix:
os: [ubuntu-latest]
- scala: [2.13.8, 2.12.15, 3.1.0]
- java: [adopt@1.8]
+ scala: [2.13.8]
+ java: [temurin@11]
+ runs-on: ${{ matrix.os }}
+ steps:
+ - name: Checkout current branch (fast)
+ uses: actions/checkout@v2
+
+ - name: Download Java (temurin@8)
+ id: download-java-temurin-8
+ if: matrix.java == 'temurin@8'
+ uses: typelevel/download-java@v1
+ with:
+ distribution: temurin
+ java-version: 8
+
+ - name: Setup Java (temurin@8)
+ if: matrix.java == 'temurin@8'
+ uses: actions/setup-java@v2
+ with:
+ distribution: jdkfile
+ java-version: 8
+ jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }}
+
+ - name: Cache sbt
+ uses: actions/cache@v2
+ with:
+ path: |
+ ~/.sbt
+ ~/.ivy2/cache
+ ~/.coursier/cache/v1
+ ~/.cache/coursier/v1
+ ~/AppData/Local/Coursier/Cache/v1
+ ~/Library/Caches/Coursier/v1
+ key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
+
+ - run: sbt '++${{ matrix.scala }}' coverage rootJVM/test coverageAggregate
+
+ - run: 'bash <(curl -s https://codecov.io/bash)'
+
+ site:
+ name: Generate Site
+ strategy:
+ matrix:
+ os: [ubuntu-latest]
+ scala: [2.13.8]
+ java: [temurin@8]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
@@ -103,10 +306,21 @@ jobs:
with:
fetch-depth: 0
- - name: Setup Java and Scala
- uses: olafurpg/setup-scala@v13
+ - name: Download Java (temurin@8)
+ id: download-java-temurin-8
+ if: matrix.java == 'temurin@8'
+ uses: typelevel/download-java@v1
with:
- java-version: ${{ matrix.java }}
+ distribution: temurin
+ java-version: 8
+
+ - name: Setup Java (temurin@8)
+ if: matrix.java == 'temurin@8'
+ uses: actions/setup-java@v2
+ with:
+ distribution: jdkfile
+ java-version: 8
+ jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }}
- name: Cache sbt
uses: actions/cache@v2
@@ -120,8 +334,13 @@ jobs:
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
- - if: matrix.platform == 'jvm' && matrix.scala == '2.12.15'
- run: sbt ++${{ matrix.scala }} scalafmtCheckAll
+ - name: Generate site
+ run: sbt '++${{ matrix.scala }}' docs/tlSite
- - if: matrix.platform == 'jvm' && matrix.scala == '2.12.15'
- run: sbt ++${{ matrix.scala }} scalafmtSbtCheck
+ - name: Publish site
+ if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master'
+ uses: peaceiris/actions-gh-pages@v3.8.0
+ with:
+ github_token: ${{ secrets.GITHUB_TOKEN }}
+ publish_dir: docs/target/docs/site
+ keep_files: true
diff --git a/.jvmopts b/.jvmopts
new file mode 100644
index 00000000..6f8a1a39
--- /dev/null
+++ b/.jvmopts
@@ -0,0 +1,3 @@
+-Xms1G
+-Xmx4G
+-XX:+UseG1GC
\ No newline at end of file
diff --git a/.scalafmt.conf b/.scalafmt.conf
index 2a94dc26..b4cb4fb0 100644
--- a/.scalafmt.conf
+++ b/.scalafmt.conf
@@ -6,4 +6,6 @@ continuationIndent.defnSite = 2
assumeStandardLibraryStripMargin = true
danglingParentheses.preset = true
rewrite.rules = [AvoidInfix, SortImports, RedundantBraces, RedundantParens, SortModifiers]
-docstrings = JavaDoc
+docstrings.style = Asterisk
+docstrings.wrap = no
+runner.dialect = scala213
diff --git a/README.md b/README.md
index abdbfa7a..b21d8171 100644
--- a/README.md
+++ b/README.md
@@ -105,7 +105,7 @@ c.render(60)
// )
```
-For more examples, see the [tutorial](docs/src/main/mdoc/intro.md).
+For more examples, see the [tutorial](docs/src/main/mdoc/index.md).
## Benchmarks
diff --git a/build.sbt b/build.sbt
index 0e49b781..410cda3b 100644
--- a/build.sbt
+++ b/build.sbt
@@ -1,72 +1,40 @@
-import sbtcrossproject.{crossProject, CrossType}
-
val Scala212 = "2.12.15"
val Scala213 = "2.13.8"
+val Scala3Version = "3.1.0"
-ThisBuild / crossScalaVersions := Seq(Scala213, Scala212, "3.1.0")
-ThisBuild / scalaVersion := Scala213
-
-ThisBuild / githubWorkflowJavaVersions := Seq("adopt@1.11")
-
-ThisBuild / githubWorkflowBuildMatrixAdditions += "platform" -> List("jvm", "js", "native")
-
-ThisBuild / githubWorkflowBuildMatrixExclusions ++=
- (ThisBuild / crossScalaVersions).value.filter(_.startsWith("3.")).map { dottyVersion =>
- MatrixExclude(Map("platform" -> "native", "scala" -> dottyVersion))
- }
-
-val JvmCond = s"matrix.platform == 'jvm'"
-val JsCond = s"matrix.platform == 'js'"
-val NativeCond = s"matrix.platform == 'native'"
-
-val Scala212Cond = s"matrix.scala == '$Scala212'"
+ThisBuild / tlBaseVersion := "0.4"
-ThisBuild / githubWorkflowBuild := Seq(
- WorkflowStep.Sbt(List("js/checkCI"), name = Some("Validate JavaScript"), cond = Some(JsCond)),
- WorkflowStep.Sbt(List("native/checkCI"), name = Some("Validate Native"), cond = Some(NativeCond)),
- WorkflowStep.Sbt(List("jvm/checkCI"),
- name = Some("Validate JVM"),
- cond = Some(JvmCond + " && " + s"matrix.scala != '$Scala212'")
- ),
- WorkflowStep.Use(UseRef.Public("actions", "setup-python", "v2"),
- name = Some("Setup Python"),
- params = Map("python-version" -> "3.x"),
- cond = Some(JvmCond + " && " + Scala212Cond)
- ),
- WorkflowStep.Run(List("pip install codecov"),
- name = Some("Setup codecov"),
- cond = Some(JvmCond + " && " + Scala212Cond)
- ),
- WorkflowStep.Sbt(List("coverage", "jvm/checkCI", "docs/mdoc", "coverageReport"),
- name = Some("Validate JVM (scala 2)"),
- cond = Some(JvmCond + " && " + Scala212Cond)
- ),
- WorkflowStep.Run(List("codecov"),
- name = Some("Upload Codecov Results"),
- cond = Some(JvmCond + " && " + Scala212Cond)
- ),
- WorkflowStep.Sbt(List("mimaReportBinaryIssues"),
- name = Some("Binary compatibility ${{ matrix.scala }}"),
- cond = Some(JvmCond + " && " + Scala212Cond)
- )
-)
+ThisBuild / scalaVersion := Scala213
+ThisBuild / tlVersionIntroduced := Map("3" -> "0.4.2")
+ThisBuild / crossScalaVersions := Seq(Scala213, Scala212, Scala3Version)
+ThisBuild / githubWorkflowBuildMatrixExclusions +=
+ MatrixExclude(Map("project" -> "rootNative", "scala" -> Scala3Version))
-ThisBuild / githubWorkflowAddedJobs ++= Seq(
+// Setup coverage
+ThisBuild / githubWorkflowAddedJobs +=
WorkflowJob(
- "checks",
- "Format Scala code",
- githubWorkflowJobSetup.value.toList ::: List(
- WorkflowStep.Sbt(List("scalafmtCheckAll"), cond = Some(JvmCond + " && " + Scala212Cond)),
- WorkflowStep.Sbt(List("scalafmtSbtCheck"), cond = Some(JvmCond + " && " + Scala212Cond))
- ),
- scalas = crossScalaVersions.value.toList
+ id = "coverage",
+ name = "Generate coverage report",
+ scalas = List("2.13.8"),
+ steps = List(WorkflowStep.Checkout) ++ WorkflowStep.SetupJava(
+ githubWorkflowJavaVersions.value.toList
+ ) ++ githubWorkflowGeneratedCacheSteps.value ++ List(
+ WorkflowStep.Sbt(List("coverage", "rootJVM/test", "coverageAggregate")),
+ WorkflowStep.Run(List("bash <(curl -s https://codecov.io/bash)"))
+ )
)
-)
-ThisBuild / githubWorkflowArtifactUpload := false
+ThisBuild / tlCiReleaseBranches := Seq("master")
+ThisBuild / tlSitePublishBranch := Some("master")
+
+lazy val root = tlCrossRootProject.aggregate(core, cats)
-ThisBuild / githubWorkflowPublish := Seq()
-ThisBuild / githubWorkflowPublishTargetBranches := Seq()
+ThisBuild / developers := List(
+ // your GitHub handle and name
+ tlGitHubDev("johnynek", "Oscar Boykin"),
+ tlGitHubDev("coltfred", "Colt Frederickson"),
+ tlGitHubDev("non", "Erik Osheim")
+)
def scalaVersionSpecificFolders(srcName: String, srcBaseDir: java.io.File, scalaVersion: String) = {
def extraDirs(suffix: String) =
@@ -83,58 +51,6 @@ def scalaVersionSpecificFolders(srcName: String, srcBaseDir: java.io.File, scala
}
}
-inThisBuild(
- List(
- organization := "org.typelevel",
- scalaVersion := Scala213,
- licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
- homepage := Some(url("https://github.com/typelevel/paiges")),
- pomExtra := (
-
-
- johnynek
- Oscar Boykin
- http://github.com/johnynek/
-
-
- coltfred
- Colt Frederickson
- http://github.com/coltfred/
-
-
- non
- Erik Osheim
- http://github.com/non/
-
-
-
- https://github.com/typelevel/paiges
- scm:git:git://github.com/typelevel/paiges.git
-
- ),
- coverageMinimum := 60,
- coverageFailOnMinimum := false
- )
-)
-
-noPublish
-
-// Aggregate for JVM projects, for example run `jvm/test` to run only JVM tests.
-lazy val jvm = project
- .in(file(".jvm"))
- .settings(noPublish)
- .aggregate(coreJVM, catsJVM)
-
-lazy val js = project
- .in(file(".js"))
- .settings(noPublish)
- .aggregate(coreJS, catsJS)
-
-lazy val native = project
- .in(file(".native"))
- .settings(noPublish)
- .aggregate(coreNative, catsNative)
-
lazy val core = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.crossType(CrossType.Pure)
.in(file("core"))
@@ -142,14 +58,12 @@ lazy val core = crossProject(JSPlatform, JVMPlatform, NativePlatform)
commonSettings,
name := "paiges-core",
moduleName := "paiges-core",
- mimaPreviousArtifacts := {
- if (scalaVersion.value.startsWith("3")) Set.empty
- else previousArtifact(version.value, "core")
- },
libraryDependencies ++= Seq(
"org.scalatestplus" %%% "scalacheck-1-15" % "3.2.10.0" % Test,
"org.scalatest" %%% "scalatest-funsuite" % "3.2.11" % Test
- )
+ ),
+ // TODO: 2.13 has warnings for using Stream, but scalacheck Shrink
+ tlFatalWarningsInCi := scalaVersion.value.startsWith("2.12.")
)
.disablePlugins(JmhPlugin)
.jsSettings(commonJsSettings)
@@ -172,11 +86,7 @@ lazy val cats = crossProject(JSPlatform, JVMPlatform, NativePlatform)
"org.typelevel" %%% "cats-core" % "2.7.0",
"org.typelevel" %%% "cats-laws" % "2.7.0" % Test,
"org.typelevel" %%% "discipline-scalatest" % "2.1.5" % Test
- ),
- mimaPreviousArtifacts := {
- if (scalaVersion.value.startsWith("3")) Set.empty
- else previousArtifact(version.value, "cats")
- }
+ )
)
.disablePlugins(JmhPlugin)
.jsSettings(commonJsSettings)
@@ -190,9 +100,8 @@ lazy val catsNative = cats.native
lazy val benchmark = project
.in(file("benchmark"))
.dependsOn(coreJVM, catsJVM)
+ .enablePlugins(NoPublishPlugin)
.settings(
- noPublish,
- crossScalaVersions := List(Scala212),
name := "paiges-benchmark"
)
.enablePlugins(JmhPlugin)
@@ -200,56 +109,13 @@ lazy val benchmark = project
lazy val docs = project
.in(file("docs"))
.dependsOn(coreJVM, catsJVM)
- .enablePlugins(MdocPlugin)
+ .enablePlugins(TypelevelSitePlugin)
.settings(
- noPublish,
- crossScalaVersions := List(Scala212),
name := "paiges-docs",
- mdocIn := baseDirectory.in(LocalRootProject).value / "docs" / "src" / "main" / "mdoc",
- scalacOptions in mdoc := {
- val testOptions = scalacOptions.in(test).value
- val unwantedOptions = Set("-Xlint", "-Xfatal-warnings")
- testOptions.filterNot(unwantedOptions)
- }
+ mdocIn := (LocalRootProject / baseDirectory).value / "docs" / "src" / "main" / "mdoc"
)
lazy val commonSettings = Seq(
- publishTo := {
- if ((ThisBuild / isVersionStable).value)
- Some("Releases".at("https://oss.sonatype.org/service/local/staging/deploy/maven2"))
- else
- None
- },
- // The validation steps that we run in CI.
- TaskKey[Unit]("checkCI") := Def
- .sequential(
- test.in(Test),
- doc.in(Compile),
- mimaReportBinaryIssues
- )
- .value,
- // scalac options are defined in commonSettings instead of inThisBuild
- // because we customize the settings based on scalaVersion.
- scalacOptions ++= Seq(
- "-deprecation",
- "-encoding",
- "UTF-8",
- "-feature",
- "-language:existentials",
- "-language:higherKinds",
- "-language:implicitConversions",
- "-language:experimental.macros",
- "-unchecked",
- "-Xlint",
- "-Ywarn-dead-code",
- "-Ywarn-numeric-widen",
- "-Ywarn-value-discard"
- ),
- // HACK: without these lines, the console is basically unusable,
- // since all imports are reported as being unused (and then become
- // fatal errors).
- scalacOptions in (Compile, console) ~= { _.filterNot("-Xlint" == _) },
- scalacOptions in (Test, console) := (scalacOptions in (Compile, console)).value,
scalacOptions ++= (
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, n)) if n <= 12 =>
@@ -267,52 +133,16 @@ lazy val commonSettings = Seq(
)
lazy val commonJvmSettings = Seq(
- testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-oDF")
+ Test / testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-oDF")
)
lazy val commonJsSettings = Seq(
- scalaJSStage in Global := FastOptStage,
- parallelExecution := false,
- jsEnv := new org.scalajs.jsenv.nodejs.NodeJSEnv(),
coverageEnabled := false
)
lazy val commonNativeSettings = Seq(
- crossScalaVersions := crossScalaVersions.value.filter(_.startsWith("2.")),
- coverageEnabled := false
-)
-
-def previousArtifact(version: String, proj: String) = {
- def mod(x: Int, y: Int, z: Int): ModuleID =
- "org.typelevel" %% s"paiges-$proj" % s"$x.$y.$z"
-
- // the "-dbuild..." part is for Scala community build friendliness
- val regex = "([0-9]+)\\.([0-9]+)\\.([0-9]+)(-SNAPSHOT|-dbuild[a-z0-9]*|\\+.*)?".r
- version match {
- case regex(smajor, sminor, spatch, suffix) =>
- val (major, minor, patch) = (smajor.toInt, sminor.toInt, spatch.toInt)
-
- // unless we're in a 0.x release, we need to ensure that our
- // minor version is compatible with previous minor versions.
- //
- // for example, 4.1.1 should be compatible with 4.1.0 and also
- // with 4.0.0.
- //
- // ideally we'd want to ensure that 4.1.1 was compatible with
- // the latest 4.0.x release (e.g. 4.0.13) but that would require
- // parsing our full release history; currently the algorithm is
- // only based on the current version.
- val minors = if (major > 0) (0 until minor).toSet else Set.empty
- val patches = (0 until patch).toSet
- val current = if (suffix != null && suffix.startsWith("+")) Set(mod(major, minor, patch)) else Set.empty[ModuleID]
- minors.map(mod(major, _, 0)) | patches.map(mod(major, minor, _)) | current
- case _ =>
- throw new RuntimeException(s"Could not parse Paiges version: $version")
- }
-}
-
-lazy val noPublish = commonSettings ++ Seq(
- skip in publish := true,
- mimaPreviousArtifacts := Set.empty,
+ crossScalaVersions := (ThisBuild / crossScalaVersions).value.filter(_.startsWith("2.")),
+ // Remove when native is published for the default previous versions
+ tlVersionIntroduced := List("2.12", "2.13").map(_ -> "0.4.1").toMap,
coverageEnabled := false
)
diff --git a/cats/js/src/main/scala/org/typelevel/paiges/Platform.scala b/cats/js/src/main/scala/org/typelevel/paiges/Platform.scala
index 7aa94419..68be4354 100644
--- a/cats/js/src/main/scala/org/typelevel/paiges/Platform.scala
+++ b/cats/js/src/main/scala/org/typelevel/paiges/Platform.scala
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2022 Typelevel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.typelevel.paiges
private[paiges] object Platform {
diff --git a/cats/jvm/src/main/scala/org/typelevel/paiges/Platform.scala b/cats/jvm/src/main/scala/org/typelevel/paiges/Platform.scala
index 12455f1b..fe4d87a9 100644
--- a/cats/jvm/src/main/scala/org/typelevel/paiges/Platform.scala
+++ b/cats/jvm/src/main/scala/org/typelevel/paiges/Platform.scala
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2022 Typelevel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.typelevel.paiges
private[paiges] object Platform {
diff --git a/cats/native/src/main/scala/org/typelevel/paiges/Platform.scala b/cats/native/src/main/scala/org/typelevel/paiges/Platform.scala
index dd0d77d9..9eaf3c10 100644
--- a/cats/native/src/main/scala/org/typelevel/paiges/Platform.scala
+++ b/cats/native/src/main/scala/org/typelevel/paiges/Platform.scala
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2022 Typelevel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.typelevel.paiges
private[paiges] object Platform {
diff --git a/cats/shared/src/main/scala/org/typelevel/paiges/CatsDocument.scala b/cats/shared/src/main/scala/org/typelevel/paiges/CatsDocument.scala
index 5a2c9839..d96cdba8 100644
--- a/cats/shared/src/main/scala/org/typelevel/paiges/CatsDocument.scala
+++ b/cats/shared/src/main/scala/org/typelevel/paiges/CatsDocument.scala
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2022 Typelevel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.typelevel.paiges
import cats.{Contravariant, Defer, Semigroupal}
diff --git a/cats/shared/src/main/scala/org/typelevel/paiges/instances.scala b/cats/shared/src/main/scala/org/typelevel/paiges/instances.scala
index 7981b52a..ef10ed6b 100644
--- a/cats/shared/src/main/scala/org/typelevel/paiges/instances.scala
+++ b/cats/shared/src/main/scala/org/typelevel/paiges/instances.scala
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2022 Typelevel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.typelevel.paiges
import cats.kernel.{Eq, Monoid}
diff --git a/cats/shared/src/test/scala/org/typelevel/paiges/LawTests.scala b/cats/shared/src/test/scala/org/typelevel/paiges/LawTests.scala
index 3cf3d3b1..9c7b3ff0 100644
--- a/cats/shared/src/test/scala/org/typelevel/paiges/LawTests.scala
+++ b/cats/shared/src/test/scala/org/typelevel/paiges/LawTests.scala
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2022 Typelevel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.typelevel.paiges
import cats.Semigroupal
@@ -20,7 +36,7 @@ class LawTests extends LawChecking with CatsDocument {
implicit val docEq: Eq[Doc] =
Eq.instance((x: Doc, y: Doc) => PaigesTest.docEquiv.equiv(x, y))
- implicit def monoidTests[A: Eq: Arbitrary: Monoid]: MonoidTests[A] = MonoidTests[A]
+ implicit def monoidTests[A: Monoid]: MonoidTests[A] = MonoidTests[A]
implicit def arbitraryForDocument[A]: Arbitrary[Document[A]] =
Arbitrary(Document.useToString[A])
diff --git a/core/src/main/scala-2.12-/org/typelevel/paiges/ScalaVersionCompat.scala b/core/src/main/scala-2.12-/org/typelevel/paiges/ScalaVersionCompat.scala
index 416a97f1..b8f03dee 100644
--- a/core/src/main/scala-2.12-/org/typelevel/paiges/ScalaVersionCompat.scala
+++ b/core/src/main/scala-2.12-/org/typelevel/paiges/ScalaVersionCompat.scala
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2022 Typelevel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.typelevel.paiges
object ScalaVersionCompat {
diff --git a/core/src/main/scala-2.13+/org/typelevel/paiges/ScalaVersionCompat.scala b/core/src/main/scala-2.13+/org/typelevel/paiges/ScalaVersionCompat.scala
index 40dd5390..282434b6 100644
--- a/core/src/main/scala-2.13+/org/typelevel/paiges/ScalaVersionCompat.scala
+++ b/core/src/main/scala-2.13+/org/typelevel/paiges/ScalaVersionCompat.scala
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2022 Typelevel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.typelevel.paiges
object ScalaVersionCompat {
diff --git a/core/src/main/scala/org/typelevel/paiges/Chunk.scala b/core/src/main/scala/org/typelevel/paiges/Chunk.scala
index da1b1766..194b2da8 100644
--- a/core/src/main/scala/org/typelevel/paiges/Chunk.scala
+++ b/core/src/main/scala/org/typelevel/paiges/Chunk.scala
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2022 Typelevel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.typelevel.paiges
import scala.annotation.tailrec
@@ -133,11 +149,11 @@ private[paiges] object Chunk {
if (trim) new TrimChunkIterator(stream) else new ChunkIterator(stream)
}
- //$COVERAGE-OFF$
+ // $COVERAGE-OFF$
// code of the form `final val x = ...` is inlined. we never
// access this field at runtime, but it is still used.
final private[this] val indentMax = 100
- //$COVERAGE-ON$
+ // $COVERAGE-ON$
private[this] def makeIndentStr(i: Int): String = "\n" + (" " * i)
diff --git a/core/src/main/scala/org/typelevel/paiges/Doc.scala b/core/src/main/scala/org/typelevel/paiges/Doc.scala
index cc261fd6..1f532844 100644
--- a/core/src/main/scala/org/typelevel/paiges/Doc.scala
+++ b/core/src/main/scala/org/typelevel/paiges/Doc.scala
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2022 Typelevel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.typelevel.paiges
import java.io.PrintWriter
@@ -234,7 +250,7 @@ sealed abstract class Doc extends Product with Serializable {
// minor optimization to short circuit sooner
s.isEmpty && loop(a, stack)
case Concat(a, b) => loop(a, b :: stack)
- case Nest(i, d) => loop(d, stack)
+ case Nest(_, d) => loop(d, stack)
case Align(d) => loop(d, stack)
case Text(s) =>
// shouldn't be empty by construction, but defensive
@@ -318,13 +334,13 @@ sealed abstract class Doc extends Product with Serializable {
def loop(pos: Int, lst: List[(Int, Doc)]): LazyList[String] =
lst match {
case Nil => LazyList.empty
- case (i, Empty) :: z => loop(pos, z)
+ case (_, Empty) :: z => loop(pos, z)
case (i, FlatAlt(a, _)) :: z => loop(pos, (i, a) :: z)
case (i, Concat(a, b)) :: z => loop(pos, (i, a) :: (i, b) :: z)
case (i, Nest(j, d)) :: z => loop(pos, ((i + j), d) :: z)
- case (i, Align(d)) :: z => loop(pos, (pos, d) :: z)
- case (i, Text(s)) :: z => s #:: cheat(pos + s.length, z)
- case (i, ZeroWidth(s)) :: z => s #:: cheat(pos, z)
+ case (_, Align(d)) :: z => loop(pos, (pos, d) :: z)
+ case (_, Text(s)) :: z => s #:: cheat(pos + s.length, z)
+ case (_, ZeroWidth(s)) :: z => s #:: cheat(pos, z)
case (i, Line) :: z => Chunk.lineToStr(i) #:: cheat(i, z)
case (i, d @ LazyDoc(_)) :: z => loop(pos, (i, d.evaluated) :: z)
case (i, Union(a, _)) :: z =>
@@ -599,13 +615,13 @@ sealed abstract class Doc extends Product with Serializable {
def loop(pos: Int, lst: List[(Int, Doc)], max: Int): Int =
lst match {
case Nil => math.max(max, pos)
- case (i, Empty) :: z => loop(pos, z, max)
+ case (_, Empty) :: z => loop(pos, z, max)
case (i, FlatAlt(default, _)) :: z => loop(pos, (i, default) :: z, max)
case (i, Concat(a, b)) :: z => loop(pos, (i, a) :: (i, b) :: z, max)
case (i, Nest(j, d)) :: z => loop(pos, ((i + j), d) :: z, max)
- case (i, Align(d)) :: z => loop(pos, (pos, d) :: z, max)
- case (i, Text(s)) :: z => loop(pos + s.length, z, max)
- case (i, ZeroWidth(_)) :: z => loop(pos, z, max)
+ case (_, Align(d)) :: z => loop(pos, (pos, d) :: z, max)
+ case (_, Text(s)) :: z => loop(pos + s.length, z, max)
+ case (_, ZeroWidth(_)) :: z => loop(pos, z, max)
case (i, Line) :: z => loop(i, z, math.max(max, pos))
case (i, d @ LazyDoc(_)) :: z => loop(pos, (i, d.evaluated) :: z, max)
case (i, Union(a, _)) :: z =>
diff --git a/core/src/main/scala/org/typelevel/paiges/Document.scala b/core/src/main/scala/org/typelevel/paiges/Document.scala
index 37d18d04..36d18bd9 100644
--- a/core/src/main/scala/org/typelevel/paiges/Document.scala
+++ b/core/src/main/scala/org/typelevel/paiges/Document.scala
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2022 Typelevel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.typelevel.paiges
trait Document[A] { self =>
diff --git a/core/src/main/scala/org/typelevel/paiges/Style.scala b/core/src/main/scala/org/typelevel/paiges/Style.scala
index 240002c4..b48305d9 100644
--- a/core/src/main/scala/org/typelevel/paiges/Style.scala
+++ b/core/src/main/scala/org/typelevel/paiges/Style.scala
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2022 Typelevel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.typelevel.paiges
/**
diff --git a/core/src/main/scala/org/typelevel/paiges/package.scala b/core/src/main/scala/org/typelevel/paiges/package.scala
index c52fb509..e385d25f 100644
--- a/core/src/main/scala/org/typelevel/paiges/package.scala
+++ b/core/src/main/scala/org/typelevel/paiges/package.scala
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2022 Typelevel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.typelevel
package object paiges {
diff --git a/core/src/test/scala/org/typelevel/paiges/ColorTest.scala b/core/src/test/scala/org/typelevel/paiges/ColorTest.scala
index 54f05eeb..7309de43 100644
--- a/core/src/test/scala/org/typelevel/paiges/ColorTest.scala
+++ b/core/src/test/scala/org/typelevel/paiges/ColorTest.scala
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2022 Typelevel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.typelevel.paiges
import org.scalatest.funsuite.AnyFunSuite
diff --git a/core/src/test/scala/org/typelevel/paiges/DocumentTests.scala b/core/src/test/scala/org/typelevel/paiges/DocumentTests.scala
index 3583345a..cabc20dc 100644
--- a/core/src/test/scala/org/typelevel/paiges/DocumentTests.scala
+++ b/core/src/test/scala/org/typelevel/paiges/DocumentTests.scala
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2022 Typelevel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.typelevel.paiges
import org.scalatest.funsuite.AnyFunSuite
diff --git a/core/src/test/scala/org/typelevel/paiges/Generators.scala b/core/src/test/scala/org/typelevel/paiges/Generators.scala
index 809507ea..5f6ac010 100644
--- a/core/src/test/scala/org/typelevel/paiges/Generators.scala
+++ b/core/src/test/scala/org/typelevel/paiges/Generators.scala
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2022 Typelevel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.typelevel.paiges
import org.scalacheck.Shrink.shrink
@@ -147,7 +163,7 @@ object Generators {
n <- Gen.choose(1, max)
start <- genDoc
front <- Gen.listOfN(n, genDoc)
- } yield front.foldLeft(start)(Doc.Concat)
+ } yield front.foldLeft(start)(Doc.Concat(_, _))
def fill(max: Int): Gen[Doc] = {
// we start at 1 because fill(d, Nil) == Empty
@@ -227,6 +243,7 @@ object Generators {
if (xs.isEmpty) ys
else if (ys.isEmpty) xs
else xs.head #:: ys.head #:: interleave(xs.tail, ys.tail)
+
def combine[A](a: A)(f: A => A)(implicit F: Shrink[A]): Stream[A] = {
val sa = shrink(a)
a #:: interleave(sa, sa.map(f))
@@ -237,7 +254,7 @@ object Generators {
}
Shrink {
case FlatAlt(_, b) => b #:: shrinkDoc.shrink(b)
- case Union(a, b) => combine2(a, b)(Union)
+ case Union(a, b) => combine2(a, b)(Union(_, _))
case Concat(a, b) => combine2(a, b)(_ + _)
case Text(s) => shrink(s).map(text)
case ZeroWidth(s) => shrink(s).map(zeroWidth)
diff --git a/core/src/test/scala/org/typelevel/paiges/JsonTest.scala b/core/src/test/scala/org/typelevel/paiges/JsonTest.scala
index 13266639..f508e727 100644
--- a/core/src/test/scala/org/typelevel/paiges/JsonTest.scala
+++ b/core/src/test/scala/org/typelevel/paiges/JsonTest.scala
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2022 Typelevel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.typelevel.paiges
import org.scalatest.funsuite.AnyFunSuite
diff --git a/core/src/test/scala/org/typelevel/paiges/PaigesScalacheckTest.scala b/core/src/test/scala/org/typelevel/paiges/PaigesScalacheckTest.scala
index f8484247..3f794677 100644
--- a/core/src/test/scala/org/typelevel/paiges/PaigesScalacheckTest.scala
+++ b/core/src/test/scala/org/typelevel/paiges/PaigesScalacheckTest.scala
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2022 Typelevel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.typelevel.paiges
import org.scalacheck.Gen
diff --git a/core/src/test/scala/org/typelevel/paiges/PaigesTest.scala b/core/src/test/scala/org/typelevel/paiges/PaigesTest.scala
index 6b985e58..c0e88fcf 100644
--- a/core/src/test/scala/org/typelevel/paiges/PaigesTest.scala
+++ b/core/src/test/scala/org/typelevel/paiges/PaigesTest.scala
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2022 Typelevel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.typelevel.paiges
import scala.annotation.tailrec
diff --git a/docs/src/main/mdoc/intro.md b/docs/src/main/mdoc/index.md
similarity index 100%
rename from docs/src/main/mdoc/intro.md
rename to docs/src/main/mdoc/index.md
diff --git a/project/plugins.sbt b/project/plugins.sbt
index 9a4cd7dc..13a39b35 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -1,13 +1,9 @@
-addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.0.1")
-addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.8.0")
-addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.1" )
-addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.12")
-addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")
-addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.3")
-addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0")
-addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
-addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.13.0")
-addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.1.1")
-addSbtPlugin("io.crashbox" % "sbt-gpg" % "0.2.1")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.1.0")
+addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.8.0")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.4")
+addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.1")
+addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
+addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.3")
+addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.4.6")
+addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % "0.4.6")
+addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")