diff --git a/.github/workflows/scala.yml b/.github/workflows/scala.yml index e473d53..4caf95a 100644 --- a/.github/workflows/scala.yml +++ b/.github/workflows/scala.yml @@ -7,4 +7,4 @@ jobs: - uses: actions/checkout@v2 - uses: olafurpg/setup-scala@v10 - uses: coursier/cache-action@v3 - - run: sbt clean headerCheck +test + - run: sbt clean sourceposJVM/headerCheck +test diff --git a/build.sbt b/build.sbt index 18811d2..01757f0 100644 --- a/build.sbt +++ b/build.sbt @@ -1,52 +1,68 @@ // Our Scala versions. -lazy val `scala-2.12` = "2.12.12" -lazy val `scala-2.13` = "2.13.5" -lazy val `scala-3.0` = "3.0.0" +lazy val `scala-2.12` = "2.12.14" +lazy val `scala-2.13` = "2.13.6" +lazy val `scala-3.0` = "3.0.1" // Publishing -name := "sourcepos" -organization := "org.tpolecat" -licenses ++= Seq(("MIT", url("http://opensource.org/licenses/MIT"))) -homepage := Some(url("https://github.com/tpolecat/sourcepos")) -developers := List( +ThisBuild / organization := "org.tpolecat" +ThisBuild / licenses ++= Seq(("MIT", url("http://opensource.org/licenses/MIT"))) +ThisBuild / homepage := Some(url("https://github.com/tpolecat/sourcepos")) +ThisBuild / developers := List( Developer("tpolecat", "Rob Norris", "rob_norris@mac.com", url("http://www.tpolecat.org")) ) -// Headers -headerMappings := headerMappings.value + (HeaderFileType.scala -> HeaderCommentStyle.cppStyleLineComment) -headerLicense := Some(HeaderLicense.Custom( - """|Copyright (c) 2020-2021 by Rob Norris - |This software is licensed under the MIT License (MIT). - |For more information see LICENSE or https://opensource.org/licenses/MIT - |""".stripMargin +// Compilation +ThisBuild / scalaVersion := `scala-2.13` +ThisBuild / crossScalaVersions := Seq(`scala-2.12`, `scala-2.13`, `scala-3.0`) + +lazy val root = project + .in(file(".")) + .enablePlugins(NoPublishPlugin) + .settings( + Compile / unmanagedSourceDirectories := Seq.empty, + Test / unmanagedSourceDirectories := Seq.empty, ) -) + .aggregate(sourcepos.jvm, sourcepos.js) -// Compilation -scalaVersion := `scala-2.13` -crossScalaVersions := Seq(`scala-2.12`, `scala-2.13`, `scala-3.0`) -Compile / doc / scalacOptions --= Seq("-Xfatal-warnings") -Compile / doc / scalacOptions ++= Seq( - "-groups", - "-sourcepath", (LocalRootProject / baseDirectory).value.getAbsolutePath, - "-doc-source-url", "https://github.com/tpolecat/sourcepos/blob/v" + version.value + "€{FILE_PATH}.scala", -) +lazy val sourcepos = crossProject(JVMPlatform, JSPlatform) + .crossType(CrossType.Pure) + .in(file(".")) + .enablePlugins(AutomateHeaderPlugin) + .settings( + name := "sourcepos", + + // Headers + headerMappings := headerMappings.value + (HeaderFileType.scala -> HeaderCommentStyle.cppStyleLineComment), + headerLicense := Some(HeaderLicense.Custom( + """|Copyright (c) 2020-2021 by Rob Norris + |This software is licensed under the MIT License (MIT). + |For more information see LICENSE or https://opensource.org/licenses/MIT + |""".stripMargin + ) + ), -// MUnit -libraryDependencies += "org.scalameta" %% "munit" % "0.7.26" % Test -testFrameworks += new TestFramework("munit.Framework") + // Compilation + Compile / doc / scalacOptions --= Seq("-Xfatal-warnings"), + Compile / doc / scalacOptions ++= Seq( + "-groups", + "-sourcepath", (LocalRootProject / baseDirectory).value.getAbsolutePath, + "-doc-source-url", "https://github.com/tpolecat/sourcepos/blob/v" + version.value + "€{FILE_PATH}.scala", + ), -// Scala 2 needs scala-reflect -libraryDependencies ++= Seq("org.scala-lang" % "scala-reflect" % scalaVersion.value).filterNot(_ => scalaVersion.value.startsWith("3.")) + // MUnit + libraryDependencies += "org.scalameta" %%% "munit" % "0.7.28" % Test, + testFrameworks += new TestFramework("munit.Framework"), -// dottydoc really doesn't work at all right now -Compile / doc / sources := { - val old = (Compile / doc / sources).value - if (scalaVersion.value.startsWith("3.")) - Seq() - else - old -} + // Scala 2 needs scala-reflect + libraryDependencies ++= Seq("org.scala-lang" % "scala-reflect" % scalaVersion.value).filterNot(_ => scalaVersion.value.startsWith("3.")), -enablePlugins(AutomateHeaderPlugin) + // dottydoc really doesn't work at all right now + Compile / doc / sources := { + val old = (Compile / doc / sources).value + if (scalaVersion.value.startsWith("3.")) + Seq() + else + old + } + ) diff --git a/project/build.properties b/project/build.properties index 19479ba..10fd9ee 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.5.2 +sbt.version=1.5.5 diff --git a/project/plugins.sbt b/project/plugins.sbt index 7be8b3b..dee5626 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,3 +1,6 @@ addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.7") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0") addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.5.3") +addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.7.0") +addSbtPlugin("io.chrisdavenport" % "sbt-no-publish" % "0.1.0") diff --git a/src/test/scala/Example.scala b/src/test/scala/Example.scala index 51325d1..1f9fb5f 100644 --- a/src/test/scala/Example.scala +++ b/src/test/scala/Example.scala @@ -1,4 +1,4 @@ -// Copyright (c) 2020 by Rob Norris +// Copyright (c) 2020-2021 by Rob Norris // This software is licensed under the MIT License (MIT). // For more information see LICENSE or https://opensource.org/licenses/MIT diff --git a/src/test/scala/Test.scala b/src/test/scala/Test.scala index e08c588..7bc57c7 100644 --- a/src/test/scala/Test.scala +++ b/src/test/scala/Test.scala @@ -1,4 +1,4 @@ -// Copyright (c) 2020 by Rob Norris +// Copyright (c) 2020-2021 by Rob Norris // This software is licensed under the MIT License (MIT). // For more information see LICENSE or https://opensource.org/licenses/MIT