1- import com . enfore . plugin . BuildInfo
2- import com . enfore . plugin . BasicBuildPlugin ._
1+ import Dependencies . _
2+ import ScalaOptions ._
33
4- ThisBuild / organization := BuildInfo .organization
5- ThisBuild / scalaVersion := Scala213Plugin .scala213Version
6- ThisBuild / version := " unstable-SNAPSHOT"
4+ organization in ThisBuild := " com.enfore"
5+ version in ThisBuild := " unstable-SNAPSHOT"
6+ fork in Test in ThisBuild := true
7+
8+ lazy val http4s = Seq (http4sCore, http4sDsl, http4sCirce, http4sServer)
79
810lazy val commonScalaSettings = Seq (
9- scalacOptions ++= Seq (" -language:implicitConversions" ),
11+ scalacOptions ++= compilerFlags,
12+ Test / fork := true ,
13+ scalaVersion := " 2.12.11" ,
14+ organization := " com.enfore" ,
15+ scalacOptions ++= compilerFlags,
1016 scalacOptions in (Compile , console) ~= (_ filterNot (_ == " -Xfatal-warnings" )),
1117 Compile / doc / javacOptions ++= Seq (
1218 " -no-link-warnings"
@@ -16,76 +22,81 @@ lazy val commonScalaSettings = Seq(
1622 )
1723)
1824
19- lazy val scalaMacros : Seq [Def .Setting [_]] = Seq (
20- libraryDependencies ++= (CrossVersion .partialVersion(scalaVersion.value) match {
21- case Some ((2 , 12 )) => Seq (compilerPlugin(" org.scalamacros" % " paradise" % " 2.1.1" cross CrossVersion .full))
22- case _ => Seq ()
23- }),
24- scalacOptions ++= (CrossVersion .partialVersion(scalaVersion.value) match {
25- case Some ((2 , 12 )) => Seq ()
26- case _ => Seq (" -Ymacro-annotations" )
27- })
28- )
29-
30- lazy val scalaCompat = " org.scala-lang.modules" %% " scala-collection-compat" % " 2.1.2"
31- lazy val sharedDependencies = Seq (
32- " com.beachape" %% " enumeratum" % " 1.5.13" ,
33- " com.beachape" %% " enumeratum-circe" % " 1.5.22" ,
34- " io.circe" %% " circe-refined" % Circe .latestDependencies.head.revision,
35- scalaCompat
36- ) ++ Circe .latestDependencies ++ ScalaTest .latestDependencies
25+ lazy val sharedDependencies =
26+ Seq (
27+ enumaratum,
28+ enumeratumCirce,
29+ circeRefined,
30+ circeCore,
31+ circeParser,
32+ circeGeneric,
33+ circeDerivation,
34+ scalaCompat,
35+ scalatest % Test
36+ )
3737
3838lazy val root = (project in file(" ." ))
3939 .settings(name := " openapi" )
40+ .settings(publish / skip := true )
41+ .settings(commonScalaSettings : _* )
4042 .aggregate(`openapi-scala`, `openapi-lib`, `openapi-http4s-lib`, `sbt-openapi`)
41- .enablePlugins(ScalaCrossPlugin , NexusPublishPlugin )
4243
4344lazy val `openapi-scala` = (project in file(" openapi-scala" ))
4445 .settings(
4546 name := " openapi-scala" ,
46- scalaMacros ,
47+ // publishMavenStyle := true ,
4748 libraryDependencies ++= Seq (
48- " io.circe " %% " circe-yaml " % " 0.11.0-M1 " % " test" ,
49- " org. scalameta" %% " scalameta " % " 4.3.0 " % " test"
49+ circeYaml % " test" ,
50+ scalameta % " test"
5051 ) ++ sharedDependencies
5152 )
52- .settings(commonScalaSettings)
53- .enablePlugins(Scala212Plugin , NexusPublishPlugin , BasicBuildPlugin )
53+ .settings(commonScalaSettings ++ publishSettings : _* )
5454
5555lazy val `openapi-lib` = (project in file(" openapi-lib" ))
5656 .settings(
57- name := " openapi-lib"
57+ name := " openapi-lib" ,
58+ crossScalaVersions := supportedVersions
5859 )
59- .settings(commonScalaSettings)
60- .enablePlugins(ScalaCrossPlugin , NexusPublishPlugin , BasicBuildPlugin )
60+ .settings(commonScalaSettings ++ publishSettings : _* )
6161
6262lazy val `openapi-http4s-lib` = (project in file(" openapi-http4s-lib" ))
6363 .settings(
6464 name := " openapi-http4s-lib" ,
65- scalaMacros,
66- libraryDependencies ++= Seq (
67- " io.circe" %% " circe-derivation" % " 0.12.0-M7"
68- ) ++ sharedDependencies
69- ++ RefinedTypes .latestDependencies
70- ++ Http4sCirce .latestDependencies
65+ crossScalaVersions := supportedVersions,
66+ libraryDependencies ++= sharedDependencies ++ http4s
7167 )
7268 .dependsOn(`openapi-lib`)
73- .settings(commonScalaSettings)
74- .enablePlugins(ScalaCrossPlugin , NexusPublishPlugin , BasicBuildPlugin )
69+ .settings(commonScalaSettings ++ publishSettings : _* )
7570
7671lazy val `sbt-openapi` = (project in file(" sbt-openapi" ))
7772 .settings(
7873 name := " sbt-openapi" ,
7974 sbtPlugin := true ,
80- organization := " com.enfore " ,
75+ publishMavenStyle := true ,
8176 libraryDependencies ++= Seq (
82- " io.swagger.core.v3" % " swagger-core" % " 2.0.9" ,
83- " io.swagger.parser.v3" % " swagger-parser" % " 2.0.14"
84- ),
85- addSbtPlugin(" com.eed3si9n" % " sbt-buildinfo" % " 0.9.0" ),
86- buildInfoKeys := Seq [BuildInfoKey ](name, version, scalaVersion, sbtVersion, organization),
87- buildInfoPackage := organization.value + " .openapi.plugin"
77+ Dependencies .scalafmt,
78+ swaggerCore,
79+ swaggerParser,
80+ scriptedPlugin(sbtVersion.value)
81+ )
8882 )
89- .settings(commonScalaSettings)
83+ .settings(commonScalaSettings ++ publishSettings : _* )
9084 .dependsOn(`openapi-scala`)
91- .enablePlugins(Scala212Plugin , SbtPlugin , NexusPublishPlugin , BasicBuildPlugin , BuildInfoPlugin )
85+
86+ lazy val publishSettings = Seq (
87+ crossPaths := false ,
88+ autoAPIMappings := true ,
89+ publishTo := Some (
90+ if (isSnapshot.value) Opts .resolver.sonatypeSnapshots
91+ else Opts .resolver.sonatypeStaging
92+ ),
93+ homepage := Some (url(" https://github.com/NumberFour/openapi-scala" )),
94+ licenses := Seq (" MIT" -> url(" http://opensource.org/licenses/MIT" )),
95+ scmInfo := Some (
96+ ScmInfo (
97+ url(" https://github.com/NumberFour/openapi-scala" ),
98+ " scm:git:[email protected] :NumberFour/openapi-scala" ,
99+ " scm:git:https://github.com/NumberFour/openapi-scala"
100+ )
101+ )
102+ )
0 commit comments