| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- val VersionSuffix = Option(System.getenv("VERSION_SUFFIX")).getOrElse("")
- lazy val root = project.in(file("."))
- .aggregate(
- plugin,
- libraryJvm,
- libraryJs,
- playPlugin,
- //openapiPlugin
- ).settings(
- crossScalaVersions := Nil,
- publish / skip := true,
- )
- def commonSettings = Seq(
- organization := "com.tflucke",
- //maintainer := "Thomas Flucke <admin@tflucke.name>",
- scalacOptions ++= Seq(
- "-deprecation",
- "-unchecked",
- "-feature"
- ),
- )
- /****** The Actual Plugin ******/
- lazy val plugin = (project in file("plugin"))
- .enablePlugins(SbtPlugin)
- .settings(commonSettings)
- .settings(
- addSbtPlugin("org.portable-scala" % "sbt-platform-deps" % "1.0.1"),
- name := "sbt-rest-rpc",
- version := s"0.3.2$VersionSuffix",
- Compile / resourceGenerators += Def.task {
- val file = (Compile / resourceManaged).value / "version.txt"
- IO.write(file, (libraryJvm / version).value)
- Seq(file)
- }.taskValue,
- publishLocal := (publishLocal
- dependsOn (libraryJvm / publishLocal)
- dependsOn (libraryJs / publishLocal)
- ).value
- ).dependsOn(libraryJvm)
- .dependsOn(libraryJs)
- /****** The Plugin Library ******/
- lazy val library = crossProject(JSPlatform, JVMPlatform)
- .in(file("library"))
- .settings(commonSettings)
- .settings(
- name := "rest-rpc",
- version := s"0.3.2$VersionSuffix",
- crossScalaVersions ++= Seq("3.0.0-M3", "2.13.7", "2.13.3")
- )
- .jvmSettings(
- // [tflucke] 2021-12-18: TODO: Exclude 3.1.0 because scalajs doesn't support it.
- libraryDependencies += "com.typesafe.play" %% "play-json" % "2.10.0-RC5",
- libraryDependencies += "org.scalaj" %% "scalaj-http" % "2.4.2"
- )
- .jsSettings(
- crossScalaVersions ++= Seq("3.1.0"),
- libraryDependencies ++= (if (scalaJSVersion.startsWith("0.6.")) Seq(
- // Wrapper library for JS dom to scala
- // Docs: https://scala-js.github.io/scala-js-dom/
- // Scaladocs: https://www.javadoc.io/doc/org.scala-js/scalajs-dom_sjs1.0.0-M7_2.12/0.9.6/org/scalajs/dom/index.html
- "org.scala-js" %%% "scalajs-dom" % "0.9.8",
- "com.typesafe.play" %%% "play-json" % "2.8.1"
- ) else Seq(
- "org.scala-js" %%% "scalajs-dom" % "2.1.0",
- "com.typesafe.play" %%% "play-json" % "2.10.0-RC5"
- ))
- )
- lazy val libraryJvm = library.jvm
- lazy val libraryJs = library.js
- /******* The Play Plugin *******/
- lazy val playPlugin = (project in file("play"))
- .enablePlugins(SbtPlugin)
- .settings(commonSettings)
- .settings(
- addSbtPlugin("com.tflucke" % "sbt-rest-rpc" % "0.3.2-SNAPSHOT"),
- name := "sbt-rest-rpc-play",
- version := s"0.3.2$VersionSuffix",
- libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.8" % Test,
- Test / logBuffered := false,
- scriptedLaunchOpts := { scriptedLaunchOpts.value ++ Seq(
- "-Xmx1024M",
- "-Dplugin.version="+version.value,
- "-Dhttp.port=10000",
- ) },
- scriptedBufferLog := false,
- publishLocal := (publishLocal dependsOn (plugin / publishLocal)).value
- ).dependsOn(plugin)
- /******* The OpenAPI Plugin *******/
- lazy val openapiPlugin = (project in file("openapi"))
- .enablePlugins(SbtPlugin)
- .settings(commonSettings)
- .settings(
- addSbtPlugin("com.tflucke" % "sbt-rest-rpc" % "0.3.2-SNAPSHOT"),
- name := "sbt-rest-rpc-openapi",
- version := s"0.3.2$VersionSuffix",
- libraryDependencies ++= Seq(
- "io.swagger.parser.v3" % "swagger-parser" % "2.0.22",
- "org.scalatest" %% "scalatest" % "3.0.8" % Test
- ),
- Test / logBuffered := false,
- scriptedLaunchOpts := { scriptedLaunchOpts.value ++ Seq(
- "-Xmx1024M",
- "-Dplugin.version="+version.value,
- ) },
- scriptedBufferLog := false,
- publishLocal := (publishLocal dependsOn (plugin / publishLocal)).value
- ).dependsOn(plugin)
|