Skip to content

Commit

Permalink
Allow to publish mdoc-parser for Scala Native
Browse files Browse the repository at this point in the history
  • Loading branch information
jchyb authored and tgodzik committed Sep 12, 2024
1 parent c7e3519 commit 9734ce2
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
java: [11, 17]
command:
# Test legacy Scala versions, where reporting API changed
- "'++2.12.12! test'"
- "'++2.12.12! testAllNonNative'" # compiler version too old for Scala Native
- "'++2.12.19 test'"
- "'++2.13.14 test'"
# Minimal supported version
Expand Down
19 changes: 14 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import scala.collection.mutable
import sbtcrossproject.CrossPlugin.autoImport.crossProject
import scala.scalanative.build._

addCommandAlias(
"testAllNonNative",
"interfaces/test;runtime/test;parser/test;cli/test;mdoc/test;testsInput/test;tests/test;jsdocs/test;worksheets/test;unit/test;unitJS/test;jsApi/test;jsWorker/test;js/test;"
)

def scala212 = "2.12.19"
def scala213 = "2.13.14"
Expand Down Expand Up @@ -178,7 +185,8 @@ val excludePprint = ExclusionRule(organization = "com.lihaoyi")
val excludeCollection =
ExclusionRule(organization = "org.scala-lang.modules", name = "scala-collection-compat_2.13")

lazy val parser = project
lazy val parser = crossProject(JVMPlatform, NativePlatform)
.withoutSuffixFor(JVMPlatform)
.settings(
sharedSettings,
moduleName := "mdoc-parser"
Expand Down Expand Up @@ -210,7 +218,7 @@ lazy val cli = project
)
)
)
.dependsOn(parser)
.dependsOn(parser.jvm)

lazy val mdoc = project
.settings(
Expand Down Expand Up @@ -252,7 +260,7 @@ lazy val mdoc = project
"com.lihaoyi" %% "pprint" % V.pprint
)
)
.dependsOn(parser, runtime, cli)
.dependsOn(parser.jvm, runtime, cli)
.enablePlugins(BuildInfoPlugin)

lazy val testsInput = project
Expand Down Expand Up @@ -348,7 +356,7 @@ lazy val unit = project
"testsInputClassDirectory" -> (testsInput / Compile / classDirectory).value
)
)
.dependsOn(parser, mdoc, testsInput, tests)
.dependsOn(parser.jvm, mdoc, testsInput, tests)
.enablePlugins(BuildInfoPlugin, MdocPlugin)

lazy val unitJS = project
Expand Down Expand Up @@ -501,6 +509,7 @@ def localCrossPublish(versions: List[String]): Def.Initialize[Task[Unit]] =
def localCrossPublishProjects(scalaV: String): Def.Initialize[Task[Unit]] = {
val projects = List(parser, runtime, cli, mdoc, js, jsWorker).reverse
projects
.flatMap(_.componentProjects)
.map(p => localCrossPublishProject(p, scalaV))
.reduceLeft(_ dependsOn _)
}
Expand All @@ -511,7 +520,7 @@ def localCrossPublishProject(ref: Project, scalaV: String): Def.Initialize[Task[
val projects = List(parser, runtime, cli, mdoc, js, jsWorker)
val setttings =
(ThisBuild / version := versionValue) ::
projects.map(p => p / scalaVersion := scalaV)
projects.flatMap(_.componentProjects).map(p => p / scalaVersion := scalaV)
val newState = Project
.extract(state.value)
.appendWithSession(
Expand Down
4 changes: 4 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0")

addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.21.1")

addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.5")

addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2")

libraryDependencies ++= List(
"org.jsoup" % "jsoup" % "1.12.1",
"org.scala-sbt" %% "scripted-plugin" % sbtVersion.value
Expand Down

0 comments on commit 9734ce2

Please sign in to comment.